@adapty/capacitor 3.15.0 → 3.16.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/AdaptyCapacitor.podspec +1 -0
- package/Package.swift +1 -1
- package/README.md +9 -0
- package/android/build.gradle +23 -18
- package/dist/esm/adapty-emitter.js.map +1 -1
- package/dist/esm/adapty.js.map +1 -1
- package/dist/esm/shared/adapty-error.js.map +1 -1
- package/dist/esm/shared/coders/adapty-configuration.js.map +1 -1
- package/dist/esm/shared/coders/adapty-identify-params.js.map +1 -1
- package/dist/esm/shared/coders/adapty-installation-details.js.map +1 -1
- package/dist/esm/shared/coders/adapty-installation-status.js.map +1 -1
- package/dist/esm/shared/coders/adapty-paywall-product.js +1 -1
- package/dist/esm/shared/coders/adapty-paywall-product.js.map +1 -1
- package/dist/esm/shared/coders/adapty-purchase-params.js.map +1 -1
- package/dist/esm/shared/coders/adapty-purchase-result.js.map +1 -1
- package/dist/esm/shared/coders/adapty-subscription-offer.js.map +1 -1
- package/dist/esm/shared/coders/adapty-ui-create-onboarding-view-params.js.map +1 -1
- package/dist/esm/shared/coders/adapty-ui-create-paywall-view-params.js.map +1 -1
- package/dist/esm/shared/coders/adapty-ui-onboarding-state-updated-action.js.map +1 -1
- package/dist/esm/shared/coders/bridge-error.js.map +1 -1
- package/dist/esm/shared/coders/coder.js.map +1 -1
- package/dist/esm/shared/coders/date.js.map +1 -1
- package/dist/esm/shared/coders/json.js.map +1 -1
- package/dist/esm/shared/coders/parse-onboarding.js.map +1 -1
- package/dist/esm/shared/coders/parse-paywall.js.map +1 -1
- package/dist/esm/shared/coders/parse.js.map +1 -1
- package/dist/esm/shared/coders/utils.js.map +1 -1
- package/dist/esm/shared/logger/console-sink.js.map +1 -1
- package/dist/esm/shared/logger/log.js.map +1 -1
- package/dist/esm/shared/types/error.js.map +1 -1
- package/dist/esm/shared/utils/merge-options.js.map +1 -1
- package/dist/esm/shared/utils/with-error-context.js.map +1 -1
- package/dist/esm/ui-builder/base-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/onboarding-view-controller.js.map +1 -1
- package/dist/esm/ui-builder/onboarding-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/paywall-view-controller.js.map +1 -1
- package/dist/esm/ui-builder/paywall-view-emitter.js.map +1 -1
- package/dist/esm/ui-builder/types.js +7 -1
- 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 +8 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +8 -3
- package/dist/plugin.js.map +1 -1
- package/package.json +12 -13
package/AdaptyCapacitor.podspec
CHANGED
|
@@ -11,6 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
|
|
13
13
|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
|
|
14
|
+
s.ios.deployment_target = '15.0'
|
|
14
15
|
s.dependency 'Capacitor'
|
|
15
16
|
s.dependency 'Adapty', '3.15.3'
|
|
16
17
|
s.dependency 'AdaptyUI', '3.15.3'
|
package/Package.swift
CHANGED
|
@@ -10,7 +10,7 @@ let package = Package(
|
|
|
10
10
|
targets: ["AdaptyCapacitorPlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "8.0.0"),
|
|
14
14
|
.package(url: "https://github.com/adaptyteam/AdaptySDK-iOS.git", exact: "3.15.3")
|
|
15
15
|
],
|
|
16
16
|
targets: [
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Adapty SDK is an open-source framework that makes implementing in-app subscripti
|
|
|
32
32
|
- [Real-time analytics for your Capacitor app](#real-time-analytics-for-your-capacitor-app)
|
|
33
33
|
- [Mobile app monetization's largest community](#mobile-app-monetizations-largest-community)
|
|
34
34
|
- [Platform Support](#platform-support)
|
|
35
|
+
- [Capacitor compatibility](#capacitor-compatibility)
|
|
35
36
|
- [Examples](#examples)
|
|
36
37
|
- [Contributing](#contributing)
|
|
37
38
|
- [Like Adapty SDK?](#like-adapty-sdk)
|
|
@@ -103,6 +104,14 @@ Ask questions, participate in discussions about Adapty-related topics, become a
|
|
|
103
104
|
|
|
104
105
|
Adapty SDK for Capacitor is fully supported on **iOS** and **Android** platforms. Web platform is not supported—the build will succeed, but SDK methods will throw `CapacitorException` instead of performing actual operations.
|
|
105
106
|
|
|
107
|
+
### Capacitor compatibility
|
|
108
|
+
|
|
109
|
+
| Capacitor version | `@adapty/capacitor` version |
|
|
110
|
+
| --- |-----------------------------|
|
|
111
|
+
| 8.x | 3.16.0-beta.0 and newer |
|
|
112
|
+
| 7.x | 3.15.x and older |
|
|
113
|
+
| 6.x and older | Not supported |
|
|
114
|
+
|
|
106
115
|
|
|
107
116
|
## Examples
|
|
108
117
|
|
package/android/build.gradle
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
1
3
|
ext {
|
|
2
4
|
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.
|
|
6
|
-
kotlinVersion = project.hasProperty('kotlinVersion') ? rootProject.ext.kotlinVersion : '1.9.20'
|
|
5
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.7.1'
|
|
6
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.3.0'
|
|
7
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.7.0'
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
buildscript {
|
|
11
|
+
ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '2.2.20'
|
|
10
12
|
repositories {
|
|
11
13
|
google()
|
|
12
14
|
mavenCentral()
|
|
13
15
|
}
|
|
14
16
|
dependencies {
|
|
15
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
16
|
-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin
|
|
17
|
+
classpath 'com.android.tools.build:gradle:8.13.0'
|
|
18
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
17
19
|
}
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -21,30 +23,33 @@ apply plugin: 'com.android.library'
|
|
|
21
23
|
apply plugin: 'org.jetbrains.kotlin.android'
|
|
22
24
|
|
|
23
25
|
android {
|
|
24
|
-
namespace "com.adapty.plugin.capacitor"
|
|
25
|
-
compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion :
|
|
26
|
+
namespace = "com.adapty.plugin.capacitor"
|
|
27
|
+
compileSdk = project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 36
|
|
26
28
|
defaultConfig {
|
|
27
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion :
|
|
28
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion :
|
|
29
|
-
versionCode 1
|
|
30
|
-
versionName "1.0"
|
|
31
|
-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 24
|
|
30
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 36
|
|
31
|
+
versionCode = 1
|
|
32
|
+
versionName = "1.0"
|
|
33
|
+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
32
34
|
}
|
|
33
35
|
buildTypes {
|
|
34
36
|
release {
|
|
35
|
-
minifyEnabled false
|
|
37
|
+
minifyEnabled = false
|
|
36
38
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
lintOptions {
|
|
40
|
-
abortOnError false
|
|
42
|
+
abortOnError = false
|
|
41
43
|
}
|
|
42
44
|
compileOptions {
|
|
43
45
|
sourceCompatibility JavaVersion.VERSION_21
|
|
44
46
|
targetCompatibility JavaVersion.VERSION_21
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
kotlin {
|
|
51
|
+
compilerOptions {
|
|
52
|
+
jvmTarget = JvmTarget.JVM_21
|
|
48
53
|
}
|
|
49
54
|
}
|
|
50
55
|
|
|
@@ -58,7 +63,7 @@ dependencies {
|
|
|
58
63
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
59
64
|
implementation project(':capacitor-android')
|
|
60
65
|
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
61
|
-
|
|
66
|
+
// kotlin-stdlib is added automatically by Kotlin Gradle plugin
|
|
62
67
|
|
|
63
68
|
// Adapty SDK dependencies
|
|
64
69
|
implementation platform('io.adapty:adapty-bom:3.15.2')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapty-emitter.js","sourceRoot":"","sources":["../../src/adapty-emitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,g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AAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC9B,MAAM,KAAK,CAAC;SACb;IACH,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { AdaptyCapacitorPlugin } from './bridge/plugin';\nimport type { AdaptyError } from './shared/adapty-error';\nimport { parseCommonEvent } from './shared/coders/parse';\nimport { LogContext } from './shared/logger';\nimport type { AdaptyProfile, AdaptyInstallationDetails } from './shared/types';\nimport type { AddListenerFn, EventPayloadMap } from './types/adapty-plugin';\n\ntype EventConfig<K extends keyof EventPayloadMap> = {\n native: 'did_load_latest_profile' | 'on_installation_details_success' | 'on_installation_details_fail';\n parse: (raw: string, eventCtx: LogContext) => EventPayloadMap[K] | null;\n};\n\n// Type-safe parser functions for each event\nfunction parseProfileEvent(raw: string, eventCtx: LogContext): EventPayloadMap['onLatestProfileLoad'] | null {\n const profile = parseCommonEvent('did_load_latest_profile', raw, eventCtx);\n return profile ? { profile: profile as AdaptyProfile } : null;\n}\n\nfunction parseInstallationDetailsSuccessEvent(\n raw: string,\n eventCtx: LogContext,\n): EventPayloadMap['onInstallationDetailsSuccess'] | null {\n const details = parseCommonEvent('on_installation_details_success', raw, eventCtx);\n return details ? { details: details as AdaptyInstallationDetails } : null;\n}\n\nfunction parseInstallationDetailsFailEvent(\n raw: string,\n eventCtx: LogContext,\n): EventPayloadMap['onInstallationDetailsFail'] | null {\n const error = parseCommonEvent('on_installation_details_fail', raw, eventCtx);\n return error ? { error: error as AdaptyError } : null;\n}\n\nconst EVENT_MAP: { [K in keyof EventPayloadMap]: EventConfig<K> } = {\n onLatestProfileLoad: {\n native: 'did_load_latest_profile',\n parse: parseProfileEvent,\n },\n onInstallationDetailsSuccess: {\n native: 'on_installation_details_success',\n parse: parseInstallationDetailsSuccessEvent,\n },\n onInstallationDetailsFail: {\n native: 'on_installation_details_fail',\n parse: parseInstallationDetailsFailEvent,\n },\n};\n\nexport class AdaptyEmitter {\n private nativeEventListeners: Map<string, PluginListenerHandle> = new Map();\n private externalHandlers: Map<\n string,\n {\n id: string;\n handlerName: keyof EventPayloadMap;\n listener: (data: EventPayloadMap[keyof EventPayloadMap]) => void;\n config: EventConfig<keyof EventPayloadMap>;\n }[]\n > = new Map();\n\n public addListener: AddListenerFn = async <T extends keyof EventPayloadMap>(\n eventName: T,\n listener: (data: EventPayloadMap[T]) => void,\n ): Promise<PluginListenerHandle> => {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'addListener' });\n log.start(() => ({ eventName }));\n\n const eventConfig = EVENT_MAP[eventName];\n if (!eventConfig) {\n throw new Error(`[Adapty] Unsupported event: ${eventName}`);\n }\n\n const handlerId = `${eventName}_${Math.random().toString(36)}`;\n const handlersForEvent = this.externalHandlers.get(eventConfig.native) ?? [];\n handlersForEvent.push({\n id: handlerId,\n handlerName: eventName,\n listener: listener as (data: EventPayloadMap[keyof EventPayloadMap]) => void,\n config: eventConfig as EventConfig<keyof EventPayloadMap>,\n });\n this.externalHandlers.set(eventConfig.native, handlersForEvent);\n\n if (!this.nativeEventListeners.has(eventConfig.native)) {\n const handlers = this.externalHandlers;\n const subscription = await AdaptyCapacitorPlugin.addListener(eventConfig.native, (arg: { data: string }) => {\n const eventCtx = new LogContext();\n const eventLog = eventCtx.event({ methodName: eventConfig.native });\n eventLog.start(() => ({ raw: arg }));\n\n const rawEventData = arg?.data;\n if (typeof rawEventData !== 'string') {\n eventLog.failed(() => ({ error: new Error('[Adapty] Expected event data to be JSON string') }));\n return;\n }\n\n const eventHandlers = handlers.get(eventConfig.native) ?? [];\n for (const { handlerName, listener, config } of eventHandlers) {\n let payload: EventPayloadMap[keyof EventPayloadMap] | null = null;\n try {\n payload = config.parse(rawEventData, eventCtx);\n } catch (err) {\n eventLog.failed(() => ({ error: err }));\n continue;\n }\n\n if (!payload) {\n eventLog.failed(() => ({ error: new Error('[Adapty] Parsed payload is null') }));\n continue;\n }\n\n try {\n listener(payload);\n eventLog.success(() => ({ message: 'Event handled successfully', handlerName }));\n } catch (handlerError) {\n eventLog.failed(() => ({ handlerName, handlerError }));\n }\n }\n });\n this.nativeEventListeners.set(eventConfig.native, subscription);\n }\n\n // Return wrapper handle that can remove this specific handler\n const wrappedHandle: PluginListenerHandle = {\n remove: async () => {\n await this.removeHandler(eventConfig.native, handlerId);\n },\n } as PluginListenerHandle;\n\n return wrappedHandle;\n };\n\n private async removeHandler(nativeEvent: string, handlerId: string): Promise<void> {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'removeHandler' });\n log.start(() => ({ nativeEvent, handlerId }));\n\n const handlersForEvent = this.externalHandlers.get(nativeEvent);\n if (!handlersForEvent) {\n log.success(() => ({ message: 'No handlers found for native event', nativeEvent }));\n return;\n }\n\n const initialHandlersCount = handlersForEvent.length;\n // Remove the specific handler\n const filteredHandlers = handlersForEvent.filter((h) => h.id !== handlerId);\n this.externalHandlers.set(nativeEvent, filteredHandlers);\n\n const handlerRemoved = filteredHandlers.length < initialHandlersCount;\n if (!handlerRemoved) {\n log.success(() => ({\n message: 'Handler not found in handlers list',\n nativeEvent,\n handlerId,\n remainingHandlers: filteredHandlers.length,\n }));\n return;\n }\n\n // If no more handlers for this native event, remove the subscription\n if (filteredHandlers.length === 0) {\n this.externalHandlers.delete(nativeEvent);\n const subscription = this.nativeEventListeners.get(nativeEvent);\n if (subscription) {\n try {\n await subscription.remove();\n this.nativeEventListeners.delete(nativeEvent);\n log.success(() => ({\n message: 'Handler and native subscription removed successfully',\n nativeEvent,\n handlerId,\n }));\n } catch (error) {\n log.failed(() => ({\n message: `Failed to remove subscription for ${nativeEvent}`,\n error,\n nativeEvent,\n handlerId,\n }));\n }\n } else {\n log.success(() => ({\n message: 'Handler removed, no native subscription found',\n nativeEvent,\n handlerId,\n }));\n }\n } else {\n log.success(() => ({\n message: 'Handler removed successfully',\n nativeEvent,\n handlerId,\n remainingHandlers: filteredHandlers.length,\n }));\n }\n }\n\n async removeAllListeners(): Promise<void> {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'removeAllListeners' });\n log.start(() => ({ listenersCount: this.nativeEventListeners.size }));\n\n try {\n const removePromises = Array.from(this.nativeEventListeners.values()).map((handle, index) =>\n handle.remove().catch((error) => {\n log.failed(() => ({\n message: `Failed to remove event listener ${index}`,\n error,\n index,\n }));\n }),\n );\n\n this.nativeEventListeners.clear();\n this.externalHandlers.clear();\n await Promise.all(removePromises);\n log.success(() => ({ message: 'All listeners removed successfully' }));\n } catch (error) {\n log.failed(() => ({ error }));\n throw error;\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"adapty-emitter.js","sourceRoot":"","sources":["../../src/adapty-emitter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAS7C,4CAA4C;AAC5C,SAAS,iBAAiB,CAAC,GAAW,EAAE,QAAoB;IAC1D,MAAM,OAAO,GAAG,gBAAgB,CAAC,yBAAyB,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3E,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAwB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAChE,CAAC;AAED,SAAS,oCAAoC,CAC3C,GAAW,EACX,QAAoB;IAEpB,MAAM,OAAO,GAAG,gBAAgB,CAAC,iCAAiC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IACnF,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAoC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5E,CAAC;AAED,SAAS,iCAAiC,CACxC,GAAW,EACX,QAAoB;IAEpB,MAAM,KAAK,GAAG,gBAAgB,CAAC,8BAA8B,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC9E,OAAO,KAAK,CA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AM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAC1F,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;oBAChB,OAAO,EAAE,mCAAmC,KAAK,EAAE;oBACnD,KAAK;oBACL,KAAK;iBACN,CAAC,CAAC,CAAC;YACN,CAAC,CAAC,CACH,CAAC;YAEF,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC;YAClC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;YAC9B,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YAClC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,oCAAoC,EAAE,CAAC,CAAC,CAAC;QACzE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\nimport { AdaptyCapacitorPlugin } from './bridge/plugin';\nimport type { AdaptyError } from './shared/adapty-error';\nimport { parseCommonEvent } from './shared/coders/parse';\nimport { LogContext } from './shared/logger';\nimport type { AdaptyProfile, AdaptyInstallationDetails } from './shared/types';\nimport type { AddListenerFn, EventPayloadMap } from './types/adapty-plugin';\n\ntype EventConfig<K extends keyof EventPayloadMap> = {\n native: 'did_load_latest_profile' | 'on_installation_details_success' | 'on_installation_details_fail';\n parse: (raw: string, eventCtx: LogContext) => EventPayloadMap[K] | null;\n};\n\n// Type-safe parser functions for each event\nfunction parseProfileEvent(raw: string, eventCtx: LogContext): EventPayloadMap['onLatestProfileLoad'] | null {\n const profile = parseCommonEvent('did_load_latest_profile', raw, eventCtx);\n return profile ? { profile: profile as AdaptyProfile } : null;\n}\n\nfunction parseInstallationDetailsSuccessEvent(\n raw: string,\n eventCtx: LogContext,\n): EventPayloadMap['onInstallationDetailsSuccess'] | null {\n const details = parseCommonEvent('on_installation_details_success', raw, eventCtx);\n return details ? { details: details as AdaptyInstallationDetails } : null;\n}\n\nfunction parseInstallationDetailsFailEvent(\n raw: string,\n eventCtx: LogContext,\n): EventPayloadMap['onInstallationDetailsFail'] | null {\n const error = parseCommonEvent('on_installation_details_fail', raw, eventCtx);\n return error ? { error: error as AdaptyError } : null;\n}\n\nconst EVENT_MAP: { [K in keyof EventPayloadMap]: EventConfig<K> } = {\n onLatestProfileLoad: {\n native: 'did_load_latest_profile',\n parse: parseProfileEvent,\n },\n onInstallationDetailsSuccess: {\n native: 'on_installation_details_success',\n parse: parseInstallationDetailsSuccessEvent,\n },\n onInstallationDetailsFail: {\n native: 'on_installation_details_fail',\n parse: parseInstallationDetailsFailEvent,\n },\n};\n\nexport class AdaptyEmitter {\n private nativeEventListeners: Map<string, PluginListenerHandle> = new Map();\n private externalHandlers: Map<\n string,\n {\n id: string;\n handlerName: keyof EventPayloadMap;\n listener: (data: EventPayloadMap[keyof EventPayloadMap]) => void;\n config: EventConfig<keyof EventPayloadMap>;\n }[]\n > = new Map();\n\n public addListener: AddListenerFn = async <T extends keyof EventPayloadMap>(\n eventName: T,\n listener: (data: EventPayloadMap[T]) => void,\n ): Promise<PluginListenerHandle> => {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'addListener' });\n log.start(() => ({ eventName }));\n\n const eventConfig = EVENT_MAP[eventName];\n if (!eventConfig) {\n throw new Error(`[Adapty] Unsupported event: ${eventName}`);\n }\n\n const handlerId = `${eventName}_${Math.random().toString(36)}`;\n const handlersForEvent = this.externalHandlers.get(eventConfig.native) ?? [];\n handlersForEvent.push({\n id: handlerId,\n handlerName: eventName,\n listener: listener as (data: EventPayloadMap[keyof EventPayloadMap]) => void,\n config: eventConfig as EventConfig<keyof EventPayloadMap>,\n });\n this.externalHandlers.set(eventConfig.native, handlersForEvent);\n\n if (!this.nativeEventListeners.has(eventConfig.native)) {\n const handlers = this.externalHandlers;\n const subscription = await AdaptyCapacitorPlugin.addListener(eventConfig.native, (arg: { data: string }) => {\n const eventCtx = new LogContext();\n const eventLog = eventCtx.event({ methodName: eventConfig.native });\n eventLog.start(() => ({ raw: arg }));\n\n const rawEventData = arg?.data;\n if (typeof rawEventData !== 'string') {\n eventLog.failed(() => ({ error: new Error('[Adapty] Expected event data to be JSON string') }));\n return;\n }\n\n const eventHandlers = handlers.get(eventConfig.native) ?? [];\n for (const { handlerName, listener, config } of eventHandlers) {\n let payload: EventPayloadMap[keyof EventPayloadMap] | null = null;\n try {\n payload = config.parse(rawEventData, eventCtx);\n } catch (err) {\n eventLog.failed(() => ({ error: err }));\n continue;\n }\n\n if (!payload) {\n eventLog.failed(() => ({ error: new Error('[Adapty] Parsed payload is null') }));\n continue;\n }\n\n try {\n listener(payload);\n eventLog.success(() => ({ message: 'Event handled successfully', handlerName }));\n } catch (handlerError) {\n eventLog.failed(() => ({ handlerName, handlerError }));\n }\n }\n });\n this.nativeEventListeners.set(eventConfig.native, subscription);\n }\n\n // Return wrapper handle that can remove this specific handler\n const wrappedHandle: PluginListenerHandle = {\n remove: async () => {\n await this.removeHandler(eventConfig.native, handlerId);\n },\n } as PluginListenerHandle;\n\n return wrappedHandle;\n };\n\n private async removeHandler(nativeEvent: string, handlerId: string): Promise<void> {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'removeHandler' });\n log.start(() => ({ nativeEvent, handlerId }));\n\n const handlersForEvent = this.externalHandlers.get(nativeEvent);\n if (!handlersForEvent) {\n log.success(() => ({ message: 'No handlers found for native event', nativeEvent }));\n return;\n }\n\n const initialHandlersCount = handlersForEvent.length;\n // Remove the specific handler\n const filteredHandlers = handlersForEvent.filter((h) => h.id !== handlerId);\n this.externalHandlers.set(nativeEvent, filteredHandlers);\n\n const handlerRemoved = filteredHandlers.length < initialHandlersCount;\n if (!handlerRemoved) {\n log.success(() => ({\n message: 'Handler not found in handlers list',\n nativeEvent,\n handlerId,\n remainingHandlers: filteredHandlers.length,\n }));\n return;\n }\n\n // If no more handlers for this native event, remove the subscription\n if (filteredHandlers.length === 0) {\n this.externalHandlers.delete(nativeEvent);\n const subscription = this.nativeEventListeners.get(nativeEvent);\n if (subscription) {\n try {\n await subscription.remove();\n this.nativeEventListeners.delete(nativeEvent);\n log.success(() => ({\n message: 'Handler and native subscription removed successfully',\n nativeEvent,\n handlerId,\n }));\n } catch (error) {\n log.failed(() => ({\n message: `Failed to remove subscription for ${nativeEvent}`,\n error,\n nativeEvent,\n handlerId,\n }));\n }\n } else {\n log.success(() => ({\n message: 'Handler removed, no native subscription found',\n nativeEvent,\n handlerId,\n }));\n }\n } else {\n log.success(() => ({\n message: 'Handler removed successfully',\n nativeEvent,\n handlerId,\n remainingHandlers: filteredHandlers.length,\n }));\n }\n }\n\n async removeAllListeners(): Promise<void> {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: 'removeAllListeners' });\n log.start(() => ({ listenersCount: this.nativeEventListeners.size }));\n\n try {\n const removePromises = Array.from(this.nativeEventListeners.values()).map((handle, index) =>\n handle.remove().catch((error) => {\n log.failed(() => ({\n message: `Failed to remove event listener ${index}`,\n error,\n index,\n }));\n }),\n );\n\n this.nativeEventListeners.clear();\n this.externalHandlers.clear();\n await Promise.all(removePromises);\n log.success(() => ({ message: 'All listeners removed successfully' }));\n } catch (error) {\n log.failed(() => ({ error }));\n throw error;\n }\n }\n}\n"]}
|
package/dist/esm/adapty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapty.js","sourceRoot":"","sources":["../../src/adapty.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,OAAO,EAAE,SAAS,EAAE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GAAG,IAAI,UAAU,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;QAC7C,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QAE/B,MAAM,sBAAsB,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAElE,MAAM,iBAAiB,GAAiC;YACtD,MAAM;YACN,MAAM,EAAE,IAAI,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,OAAO,EAAE,yBAAyB,EAAE,GAAG,CAAC;SAChG,CAAC;QAEF,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC;QAEhD,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC;IAsCD;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,kBAAkB;QACtB,MAAM,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAC1C,CAAC;CACF","sourcesContent":["// PluginListenerHandle is no longer referenced directly in this file\nimport { Capacitor } from '@capacitor/core';\n\nimport { AdaptyEmitter } from './adapty-emitter';\nimport { AdaptyCapacitorPlugin } from './bridge/plugin';\nimport { getCoder } from './coder-registry';\nimport { defaultAdaptyOptions } from './default-configs';\nimport { AdaptyConfigurationCoder } from './shared/coders/adapty-configuration';\nimport { AdaptyIdentifyParamsCoder } from './shared/coders/adapty-identify-params';\nimport { AdaptyPaywallCoder } from './shared/coders/adapty-paywall';\nimport { AdaptyPaywallProductCoder } from './shared/coders/adapty-paywall-product';\nimport { AdaptyProfileParametersCoder } from './shared/coders/adapty-profile-parameters';\nimport { AdaptyPurchaseParamsCoder } from './shared/coders/adapty-purchase-params';\nimport { Log, LogContext } from './shared/logger';\nimport type { LoggerConfig, LogScope } from './shared/logger';\nimport type {\n AdaptyPaywall,\n AdaptyPaywallProduct,\n AdaptyOnboarding,\n AdaptyProfile,\n AdaptyPurchaseResult,\n AdaptyProfileParameters,\n RefundPreference,\n AdaptyInstallationStatus,\n WebPresentation,\n} from './shared/types';\nimport type { components } from './shared/types/api';\nimport type { ActivateParamsInput, FileLocation, LogLevel, IdentifyParamsInput } from './shared/types/inputs';\nimport {\n isErrorResponse,\n isSuccessResponse,\n type CrossPlatformResponse,\n type MethodName,\n type MethodResponseMap,\n} from './shared/types/method-types';\nimport { filterUndefined } from './shared/utils/compact-object';\nimport { mergeOptions } from './shared/utils/merge-options';\nimport { withErrorContext } from './shared/utils/with-error-context';\nimport type { AdaptyPlugin, AddListenerFn, EventPayloadMap } from './types/adapty-plugin';\nimport type {\n AdaptyDefaultOptions,\n GetPaywallOptions,\n GetPaywallOptionsWithDefaults,\n GetPaywallForDefaultAudienceOptions,\n GetPaywallForDefaultAudienceOptionsWithDefaults,\n MakePurchaseOptions,\n GetOnboardingOptions,\n GetOnboardingOptionsWithDefaults,\n GetOnboardingForDefaultAudienceOptions,\n GetOnboardingForDefaultAudienceOptionsWithDefaults,\n} from './types/configs';\n\ntype Req = components['requests'];\n\n/**\n * Entry point for the Adapty SDK.\n *\n * @remarks\n * This is the main Adapty class, excluding UI rendering functionality.\n *\n * @public\n */\nexport class Adapty implements AdaptyPlugin {\n private activating: Promise<void> | null = null;\n private resolveHeldActivation?: (() => Promise<void>) | null = null;\n private readonly emitter = new AdaptyEmitter();\n private nonWaitingMethods: MethodName[] = [\n 'activate',\n 'is_activated',\n 'get_paywall_for_default_audience',\n 'get_onboarding_for_default_audience',\n 'set_log_level',\n 'set_fallback',\n ];\n private readonly options: AdaptyDefaultOptions = defaultAdaptyOptions;\n\n /**\n * Helper method for logging encode operations\n */\n private encodeWithLogging<T, R>(\n coder: { encode(data: T): R },\n data: T,\n methodName: string,\n parentCtx?: LogContext,\n ): R {\n if (!parentCtx) {\n return coder.encode(data);\n }\n\n const encodeLog = parentCtx.encode({ methodName: `encode/${methodName}` });\n encodeLog.start(() => ({ data }));\n\n try {\n const result = coder.encode(data);\n encodeLog.success(() => ({ result }));\n return result;\n } catch (error) {\n encodeLog.failed(() => ({ error }));\n throw error;\n }\n }\n\n /**\n * Handle method calls through crossplatform bridge with type safety\n * @internal\n */\n public async handleMethodCall<M extends MethodName>(\n methodName: M,\n args: string,\n ctx: LogContext,\n log: LogScope,\n ): Promise<MethodResponseMap[M]> {\n // Hold on deferred activation first\n if (this.resolveHeldActivation && !this.nonWaitingMethods.includes(methodName)) {\n log.wait(() => ({}));\n await this.resolveHeldActivation();\n this.resolveHeldActivation = null;\n log.waitComplete(() => ({}));\n }\n\n // Then wait for ongoing activation if required\n if (this.activating && (!this.nonWaitingMethods.includes(methodName) || methodName === 'is_activated')) {\n log.wait(() => ({}));\n await this.activating;\n log.waitComplete(() => ({}));\n }\n\n const bridgeLog = ctx.bridge({ methodName: `fetch/${methodName}` });\n bridgeLog.start(() => ({ method: methodName, args }));\n\n try {\n const result = await AdaptyCapacitorPlugin.handleMethodCall({\n methodName,\n args,\n });\n\n bridgeLog.success(() => ({ crossPlatformJson: result.crossPlatformJson }));\n\n // Parse JSON response with type safety\n const parsedResponse: CrossPlatformResponse = JSON.parse(result.crossPlatformJson);\n\n // Check for native errors\n if (isErrorResponse(parsedResponse)) {\n const error = parsedResponse.error;\n const errorMessage = `Native error: ${error.message} (code: ${error.adaptyCode})`;\n const nativeError = new Error(errorMessage);\n\n log.failed(() => ({ error: nativeError }));\n throw nativeError;\n }\n\n // Extract success data with type safety\n if (isSuccessResponse(parsedResponse)) {\n const successData: any = parsedResponse.success;\n\n // Apply decoder if available for this method\n const coder = getCoder(methodName);\n let result: MethodResponseMap[M];\n\n if (coder) {\n // Create decode scope for logging decode operations\n const decodeLog = ctx.decode({ methodName: `decode/${methodName}` });\n decodeLog.start(() => ({ successData }));\n\n try {\n result = coder.decode(successData) as MethodResponseMap[M];\n decodeLog.success(() => ({ result }));\n } catch (error) {\n decodeLog.failed(() => ({ error }));\n throw error;\n }\n } else {\n result = successData as MethodResponseMap[M];\n }\n\n log.success(() => ({ result }));\n return result;\n }\n\n const formatError = new Error('Invalid response format: missing success or error field');\n log.failed(() => ({ error: formatError }));\n throw formatError;\n } catch (error) {\n bridgeLog.failed(() => ({ error }));\n // If it's our custom error and log wasn't called yet, log it\n if (error instanceof Error && !error.message.startsWith('{')) {\n if (!error.message.startsWith('Native error:')) {\n log.failed(() => ({ error }));\n }\n throw error;\n }\n\n // If JSON parsing fails, wrap the error\n const parseError = new Error(`Failed to parse native response: ${error}`);\n log.failed(() => ({ error: parseError }));\n throw parseError;\n }\n }\n\n private isPaywallProduct(obj: AdaptyPaywall | AdaptyPaywallProduct): obj is AdaptyPaywallProduct {\n return 'vendorProductId' in obj;\n }\n\n /**\n * Initializes the Adapty SDK.\n *\n * @remarks\n * This method must be called in order for the SDK to work.\n * It is preferred to call it as early as possible in the app lifecycle,\n * so background activities can be performed and cache can be updated.\n *\n * @example\n *\n * @example\n * Usage with your user identifier from your system\n * ```typescript\n * await adapty.activate({\n * apiKey: 'YOUR_PUBLIC_SDK_KEY',\n * params: {\n * customerUserId: 'YOUR_USER_ID'\n * }\n * });\n * ```\n *\n * @param options - The activation options\n * @param options.apiKey - You can find it in your app settings in Adapty Dashboard App settings > General.\n * @param options.params - Optional activation parameters of type {@link ActivateParamsInput}.\n * @returns A promise that resolves when the SDK is activated.\n * @throws Error if the SDK is already activated or if the API key is invalid.\n */\n async activate(options: { apiKey: string; params?: ActivateParamsInput }): Promise<void> {\n const { apiKey, params = {} } = options;\n\n // Validate API key\n if (!apiKey || typeof apiKey !== 'string' || apiKey.trim().length === 0) {\n throw new Error('API key is required and must be a non-empty string');\n }\n\n // Prevent multiple activations\n if (this.activating) {\n await this.activating;\n return;\n }\n\n // Check if already activated (if __ignoreActivationOnFastRefresh is enabled)\n if (params.__ignoreActivationOnFastRefresh) {\n try {\n const isActivated = await this.isActivated();\n if (isActivated) {\n return;\n }\n } catch (error) {\n // Continue with activation if we can't check activation status\n }\n }\n\n // Defer activation if requested (for debugging) — start activation lazily on first blocked call\n if (params.__debugDeferActivation) {\n return new Promise<void>((resolve) => {\n // Do not start activation immediately. It will be started when a blocked method comes in.\n this.resolveHeldActivation = async () => {\n this.activating = this.performActivation(apiKey, params);\n try {\n await this.activating;\n } finally {\n this.activating = null;\n }\n resolve();\n };\n });\n }\n\n // Perform activation\n this.activating = this.performActivation(apiKey, params);\n await this.activating;\n this.activating = null;\n }\n\n private async performActivation(apiKey: string, params: ActivateParamsInput): Promise<void> {\n const method = 'activate';\n\n // Set log level before creating LogContext\n const logLevel = params.logLevel;\n Log.logLevel = logLevel || null;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ apiKey, params }));\n\n const configurationCoder = new AdaptyConfigurationCoder();\n const configuration = configurationCoder.encode(apiKey, params);\n\n const activateRequestWithUndefined: Req['Activate.Request'] = {\n method,\n configuration,\n };\n\n const activateRequest = filterUndefined(activateRequestWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(activateRequest), ctx, log);\n }\n\n /**\n * Checks if the Adapty SDK is activated.\n *\n * @returns A promise that resolves to `true` if the SDK is activated, `false` otherwise.\n * @throws Error if an error occurs while checking activation status.\n */\n async isActivated(): Promise<boolean> {\n const method = 'is_activated';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['IsActivated.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Gets the current installation status.\n *\n * @remarks\n * Installation status provides information about when the app was installed,\n * how many times it has been launched, and other installation-related details.\n * The status can be \"not_available\", \"not_determined\", or \"determined\" with details.\n *\n * @returns A promise that resolves with the installation status.\n * @throws Error if an error occurs while retrieving the installation status.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const status = await adapty.getCurrentInstallationStatus();\n * if (status.status === 'determined') {\n * console.log('Install time:', status.details.installTime);\n * console.log('Launch count:', status.details.appLaunchCount);\n * }\n * } catch (error) {\n * console.error('Failed to get installation status:', error);\n * }\n * ```\n */\n async getCurrentInstallationStatus(): Promise<AdaptyInstallationStatus> {\n const method = 'get_current_installation_status';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['GetCurrentInstallationStatus.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the paywall by the specified placement.\n *\n * @remarks\n * With Adapty, you can remotely configure the products and offers in your app\n * by simply adding them to paywalls – no need for hardcoding them.\n * The only thing you hardcode is the placement ID.\n * This flexibility allows you to easily update paywalls, products, and offers,\n * or run A/B tests, all without the need for a new app release.\n *\n * @param options - The options for fetching the paywall\n * @param options.placementId - The identifier of the desired placement. This is the value you specified when creating a placement in the Adapty Dashboard.\n * @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.\n * @param options.params - Optional. Additional parameters for fetching the paywall, including fetch policy and load timeout.\n * @returns A promise that resolves with the requested {@link AdaptyPaywall}.\n * @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.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * console.log('Paywall fetched successfully');\n * } catch (error) {\n * console.error('Failed to fetch paywall:', error);\n * }\n * ```\n */\n async getPaywall(options: GetPaywallOptions): Promise<AdaptyPaywall> {\n const method = 'get_paywall';\n const optionsWithDefault = mergeOptions<GetPaywallOptionsWithDefaults>(options, this.options[method]);\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetPaywall.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n load_timeout: params.loadTimeoutMs / 1000,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the paywall of the specified placement for the **All Users** audience.\n *\n * @remarks\n * With Adapty, you can remotely configure the products and offers in your app\n * by simply adding them to paywalls – no need for hardcoding them.\n * The only thing you hardcode is the placement ID.\n *\n * However, it's crucial to understand that the recommended approach is to fetch the paywall\n * through the placement ID by the {@link getPaywall} method.\n * The `getPaywallForDefaultAudience` method should be a last resort due to its significant drawbacks:\n * - Potential backward compatibility issues\n * - Loss of targeting (all users see the same paywall)\n *\n * 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.\n *\n * @param options - The options for fetching the paywall\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the paywall localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the paywall.\n * @returns A promise that resolves with the requested {@link AdaptyPaywall}.\n * @throws Error if the paywall with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywallForDefaultAudience({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * } catch (error) {\n * console.error('Failed to fetch paywall:', error);\n * }\n * ```\n */\n async getPaywallForDefaultAudience(options: GetPaywallForDefaultAudienceOptions): Promise<AdaptyPaywall> {\n const method = 'get_paywall_for_default_audience';\n const optionsWithDefault = mergeOptions<GetPaywallForDefaultAudienceOptionsWithDefaults>(\n options,\n this.options[method],\n );\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetPaywallForDefaultAudience.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy ?? 'reload_revalidating_cache_data' },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches a list of products associated with a provided paywall.\n *\n * @param options - The options object\n * @param options.paywall - A paywall to fetch products for. You can get it using {@link getPaywall} method.\n * @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided paywall.\n * @throws Error if an error occurs while fetching products.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * const products = await adapty.getPaywallProducts({ paywall });\n * console.log('Products:', products);\n * } catch (error) {\n * console.error('Failed to fetch products:', error);\n * }\n * ```\n */\n async getPaywallProducts(options: { paywall: AdaptyPaywall }): Promise<AdaptyPaywallProduct[]> {\n const method = 'get_paywall_products';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n\n const argsWithUndefined: Req['GetPaywallProducts.Request'] = {\n method,\n paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the onboarding by the specified placement.\n *\n * @remarks\n * When you create an onboarding with the no-code builder, it's stored as a container with configuration\n * that your app needs to fetch and display. This container manages the entire experience - what content appears,\n * how it's presented, and how user interactions are processed.\n *\n * @param options - The options for fetching the onboarding\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the onboarding localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the onboarding.\n * @returns A promise that resolves with the requested {@link AdaptyOnboarding}.\n * @throws Error if the onboarding with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const onboarding = await adapty.getOnboarding({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * params: {\n * fetchPolicy: 'reload_revalidating_cache_data',\n * loadTimeoutMs: 5000\n * }\n * });\n * console.log('Onboarding fetched successfully');\n * } catch (error) {\n * console.error('Failed to fetch onboarding:', error);\n * }\n * ```\n */\n async getOnboarding(options: GetOnboardingOptions): Promise<AdaptyOnboarding> {\n const method = 'get_onboarding';\n const optionsWithDefault = mergeOptions<GetOnboardingOptionsWithDefaults>(options, this.options[method]);\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetOnboarding.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n load_timeout: params.loadTimeoutMs / 1000,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the onboarding of the specified placement for the **All Users** audience.\n *\n * @remarks\n * It's crucial to understand that the recommended approach is to fetch the onboarding\n * by the {@link getOnboarding} method. The `getOnboardingForDefaultAudience` method\n * should be used only if faster fetching outweighs the drawbacks:\n * - Potential backward compatibility issues\n * - Loss of personalization (no targeting based on country, attribution, or custom attributes)\n *\n * @param options - The options for fetching the onboarding\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the onboarding localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the onboarding.\n * @returns A promise that resolves with the requested {@link AdaptyOnboarding}.\n * @throws Error if the onboarding with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const onboarding = await adapty.getOnboardingForDefaultAudience({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * } catch (error) {\n * console.error('Failed to fetch onboarding:', error);\n * }\n * ```\n */\n async getOnboardingForDefaultAudience(options: GetOnboardingForDefaultAudienceOptions): Promise<AdaptyOnboarding> {\n const method = 'get_onboarding_for_default_audience';\n const optionsWithDefault = mergeOptions<GetOnboardingForDefaultAudienceOptionsWithDefaults>(\n options,\n this.options[method],\n );\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetOnboardingForDefaultAudience.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy ?? 'reload_revalidating_cache_data' },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches a user profile.\n *\n * @remarks\n * The getProfile method provides the most up-to-date result\n * as it always tries to query the API.\n * If for some reason (e.g. no internet connection),\n * the Adapty SDK fails to retrieve information from the server,\n * the data from cache will be returned.\n * It is also important to note\n * that the Adapty SDK updates {@link AdaptyProfile} cache\n * on a regular basis, in order\n * to keep this information as up-to-date as possible.\n *\n * @returns A promise that resolves with the user's {@link AdaptyProfile}.\n * @throws Error if an error occurs while fetching the profile.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const profile = await adapty.getProfile();\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User has access to premium features');\n * }\n * } catch (error) {\n * console.error('Failed to get profile:', error);\n * }\n * ```\n */\n async getProfile(): Promise<AdaptyProfile> {\n const method = 'get_profile';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['GetProfile.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs in a user with a provided customerUserId.\n *\n * @remarks\n * If you don't have a user id on SDK initialization,\n * you can set it later at any time with this method.\n * The most common cases are after registration/authorization\n * when the user switches from being an anonymous user to an authenticated user.\n *\n * @param options - The identification options\n * @param options.customerUserId - A unique user identifier.\n * @param options.params - Optional. Additional parameters for identification, including platform-specific settings.\n * @returns A promise that resolves when identification is complete.\n * @throws Error if an error occurs during identification.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.identify({ customerUserId: 'YOUR_USER_ID' });\n * console.log('User identified successfully');\n * } catch (error) {\n * console.error('Failed to identify user:', error);\n * }\n * ```\n */\n async identify(options: { customerUserId: string; params?: IdentifyParamsInput }): Promise<void> {\n const method = 'identify';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const identifyParamsCoder = new AdaptyIdentifyParamsCoder();\n const parameters = identifyParamsCoder.encode(options.params);\n\n const argsWithUndefined: Req['Identify.Request'] = {\n method,\n customer_user_id: options.customerUserId,\n parameters,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs a paywall view event.\n *\n * @remarks\n * Adapty helps you to measure the performance of the paywalls.\n * We automatically collect all the metrics related to purchases except for custom paywall views.\n * This is because only you know when the paywall was shown to a customer.\n *\n * Whenever you show a paywall to your user,\n * call this function to log the event,\n * and it will be accumulated in the paywall metrics.\n *\n * @param options - The options object\n * @param options.paywall - The paywall object that was shown to the user.\n * @returns A promise that resolves when the event is logged.\n * @throws Error if an error occurs while logging the event.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * // ...after opening the paywall\n * await adapty.logShowPaywall({ paywall });\n * ```\n */\n async logShowPaywall(options: { paywall: AdaptyPaywall }): Promise<void> {\n const method = 'log_show_paywall';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n\n const argsWithUndefined: Req['LogShowPaywall.Request'] = {\n method,\n paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Opens a web paywall in the default browser.\n *\n * @param options - The options object\n * @param options.paywallOrProduct - The paywall or product to open as a web paywall.\n * @returns A promise that resolves when the web paywall is opened.\n * @throws Error if an error occurs while opening the web paywall.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * await adapty.openWebPaywall({ paywallOrProduct: paywall });\n * } catch (error) {\n * console.error('Failed to open web paywall:', error);\n * }\n * ```\n */\n async openWebPaywall(options: {\n paywallOrProduct: AdaptyPaywall | AdaptyPaywallProduct;\n openIn?: WebPresentation;\n }): Promise<void> {\n const method = 'open_web_paywall';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n const productCoder = new AdaptyPaywallProductCoder();\n\n const argsWithUndefined: Req['OpenWebPaywall.Request'] = {\n method,\n ...(this.isPaywallProduct(options.paywallOrProduct)\n ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }\n : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) }),\n ...(options.openIn ? { open_in: options.openIn } : {}),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Creates a URL for a web paywall.\n *\n * @remarks\n * This method generates a URL that can be used to open a web version of the paywall.\n * You can use this URL in a custom web view or a browser.\n *\n * @param options - The options object\n * @param options.paywallOrProduct - The paywall or product to create a URL for.\n * @returns A promise that resolves with the web paywall URL.\n * @throws Error if an error occurs while creating the URL.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * const url = await adapty.createWebPaywallUrl({ paywallOrProduct: paywall });\n * console.log('Web paywall URL:', url);\n * } catch (error) {\n * console.error('Failed to create web paywall URL:', error);\n * }\n * ```\n */\n async createWebPaywallUrl(options: { paywallOrProduct: AdaptyPaywall | AdaptyPaywallProduct }): Promise<string> {\n const method = 'create_web_paywall_url';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n const productCoder = new AdaptyPaywallProductCoder();\n\n const argsWithUndefined: Req['CreateWebPaywallUrl.Request'] = {\n method,\n ...(this.isPaywallProduct(options.paywallOrProduct)\n ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }\n : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) }),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs out the current user.\n *\n * @remarks\n * You can then login the user using {@link identify} method.\n *\n * @returns A promise that resolves when the user is logged out.\n * @throws Error if an error occurs during logout.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.logout();\n * console.log('User logged out successfully');\n * } catch (error) {\n * console.error('Failed to logout user:', error);\n * }\n * ```\n */\n async logout(): Promise<void> {\n const method = 'logout';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['Logout.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Performs a purchase of the specified product.\n *\n * @remarks\n * In paywalls built with Paywall Builder, purchases are processed automatically with no additional code.\n *\n * @param options - The purchase options\n * @param options.product - The product to be purchased. You can get it using {@link getPaywallProducts} method.\n * @param options.params - Optional. Additional parameters for the purchase, including Android subscription update params.\n * @returns A promise that resolves with the {@link AdaptyPurchaseResult} object containing details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n * @throws Error if an error occurs during the purchase process.\n *\n * @example\n * Basic purchase\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const result = await adapty.makePurchase({ product });\n *\n * if (result.type === 'success') {\n * const isSubscribed = result.profile?.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User is now subscribed!');\n * }\n * }\n * } catch (error) {\n * console.error('Purchase failed:', error);\n * }\n * ```\n */\n async makePurchase(options: MakePurchaseOptions): Promise<AdaptyPurchaseResult> {\n const method = 'make_purchase';\n const params = options.params ?? {};\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const productCoder = new AdaptyPaywallProductCoder();\n const purchaseParamsCoder = new AdaptyPurchaseParamsCoder();\n\n const encodedProduct = this.encodeWithLogging(productCoder, options.product, 'AdaptyPaywallProduct', ctx);\n const productInput = productCoder.getInput(encodedProduct);\n const purchaseParams = this.encodeWithLogging(purchaseParamsCoder, params, 'AdaptyPurchaseParams', ctx);\n\n const argsWithUndefined: Req['MakePurchase.Request'] = {\n method,\n product: productInput,\n parameters: purchaseParams,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Opens a native modal screen to redeem Apple Offer Codes.\n *\n * @remarks\n * iOS 14+ only. Since iOS 14.0, your users can redeem Offer Codes.\n * To enable users to redeem offer codes, you can display the offer code redemption sheet.\n *\n * @returns A promise that resolves when the redemption sheet is presented.\n * @throws Error if an error occurs or if called on Android.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.presentCodeRedemptionSheet();\n * } catch (error) {\n * console.error('Failed to present code redemption sheet:', error);\n * }\n * ```\n */\n async presentCodeRedemptionSheet(): Promise<void> {\n const method = 'present_code_redemption_sheet';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['PresentCodeRedemptionSheet.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the variation ID of the purchase.\n *\n * @remarks\n * In Observer mode, Adapty SDK doesn't know where the purchase was made from.\n * you can manually assign variation to the purchase.\n * After doing this, you'll be able to see metrics in Adapty Dashboard.\n *\n * @param options - The options object\n * @param options.transactionId - The transaction ID of the purchase.\n * @param options.variationId - Optional. The variation ID from the {@link AdaptyPaywall}.\n * @returns A promise that resolves when the transaction is reported.\n * @throws Error if an error occurs while reporting the transaction.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.reportTransaction({\n * transactionId: 'transaction_123',\n * variationId: 'variation_456'\n * });\n * } catch (error) {\n * console.error('Failed to report transaction:', error);\n * }\n * ```\n */\n async reportTransaction(options: { transactionId: string; variationId?: string }): Promise<void> {\n const method = 'report_transaction';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['ReportTransaction.Request'] = {\n method,\n transaction_id: options.transactionId,\n variation_id: options.variationId,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Restores user purchases and updates the profile.\n *\n * @remarks\n * Restoring purchases allows users to regain access to previously purchased content,\n * such as subscriptions or in-app purchases, without being charged again.\n * This feature is especially useful for users who may have uninstalled and reinstalled the app\n * or switched to a new device.\n *\n * In paywalls built with Paywall Builder, purchases are restored automatically without additional code from you.\n *\n * @returns A promise that resolves with the updated user's {@link AdaptyProfile}.\n * @throws Error if an error occurs during the restore process.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const profile = await adapty.restorePurchases();\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n *\n * if (isSubscribed) {\n * console.log('Access restored successfully!');\n * } else {\n * console.log('No active subscriptions found');\n * }\n * } catch (error) {\n * console.error('Failed to restore purchases:', error);\n * }\n * ```\n */\n async restorePurchases(): Promise<AdaptyProfile> {\n const method = 'restore_purchases';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['RestorePurchases.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the fallback paywalls.\n *\n * @remarks\n * Fallback file will be used if the SDK fails\n * to fetch the paywalls from the dashboard.\n * It is not designed to be used for the offline flow,\n * as products are not cached in Adapty.\n *\n * @param options - The options object\n * @param options.fileLocation - The location of the fallback file for each platform.\n * @returns A promise that resolves when fallback placements are saved.\n * @throws Error if an error occurs while setting the fallback.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.setFallback({\n * fileLocation: {\n * ios: { fileName: 'fallback_paywalls.json' },\n * android: { relativeAssetPath: 'fallback_paywalls.json' }\n * }\n * });\n * } catch (error) {\n * console.error('Failed to set fallback:', error);\n * }\n * ```\n */\n async setFallback(options: { fileLocation: FileLocation }): Promise<void> {\n const method = 'set_fallback';\n\n const platform = Capacitor.getPlatform();\n let fileLocationString: string;\n\n if (platform === 'ios') {\n fileLocationString = options.fileLocation.ios.fileName;\n } else if (platform === 'android') {\n // Add suffixes to distinguish resource types on Android\n if ('relativeAssetPath' in options.fileLocation.android) {\n fileLocationString = `${options.fileLocation.android.relativeAssetPath}a`;\n } else {\n fileLocationString = `${options.fileLocation.android.rawResName}r`;\n }\n } else {\n fileLocationString = '';\n }\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ platform, fileLocationString }));\n\n const argsWithUndefined: Req['SetFallback.Request'] = {\n method,\n asset_id: fileLocationString,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets an integration identifier for the current user.\n *\n * @remarks\n * Integration identifiers can be used to link Adapty profiles to external systems\n * and track users across different platforms.\n *\n * @param options - The options object\n * @param options.key - The key of the integration identifier.\n * @param options.value - The value of the integration identifier.\n * @returns A promise that resolves when the integration identifier is set.\n * @throws Error if an error occurs while setting the identifier.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.setIntegrationIdentifier({\n * key: 'firebase_app_instance_id',\n * value: 'YOUR_FIREBASE_ID'\n * });\n * } catch (error) {\n * console.error('Failed to set integration identifier:', error);\n * }\n * ```\n */\n async setIntegrationIdentifier(options: { key: string; value: string }): Promise<void> {\n const method = 'set_integration_identifiers';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['SetIntegrationIdentifier.Request'] = {\n method,\n key_values: { [options.key]: options.value },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the preferred log level and/or custom logger configuration.\n *\n * @remarks\n * By default, the log level is set to `error`.\n *\n * There are four levels available:\n * - `error`: only errors will be logged\n * - `warn`: messages from the SDK that do not cause critical errors, but are worth paying attention to\n * - `info`: various information messages, such as those that log the lifecycle of various modules\n * - `verbose`: any additional information that may be useful during debugging, such as function calls, API queries, etc.\n *\n * @param options - The options object\n * @param options.logLevel - Optional. The new preferred log level.\n * @param options.logger - Optional. Custom logger configuration.\n * @returns A promise that resolves when the log level is set.\n * @throws Error if the log level is invalid.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * // Set log level\n * await adapty.setLogLevel({ logLevel: 'verbose' });\n *\n * // Or set custom logger\n * await adapty.setLogLevel({\n * logger: {\n * handler: (level, scope, message, data) => {\n * sendLogToYourServer(`[${level}] ${message}`, data);\n * }\n * }\n * });\n * ```\n */\n async setLogLevel(options: { logLevel?: LogLevel; logger?: LoggerConfig }): Promise<void> {\n const method = 'set_log_level';\n\n if (options.logger) {\n Log.configure(options.logger);\n }\n\n if (options.logLevel !== undefined) {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options: { logLevel: options.logLevel } }));\n\n // Update log level immediately\n Log.logLevel = options.logLevel;\n\n const argsWithUndefined: Req['SetLogLevel.Request'] = {\n method,\n value: options.logLevel,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n }\n\n /**\n * Updates attribution data for the current user.\n *\n * @remarks\n * Attribution data can be used to track marketing campaigns and user acquisition sources.\n *\n * @param options - The options object\n * @param options.attribution - An object containing attribution data.\n * @param options.source - The source of the attribution data (e.g., 'adjust', 'appsflyer').\n * @returns A promise that resolves when the attribution data is updated.\n * @throws Error if parameters are invalid or not provided.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const attribution = {\n * 'Adjust Adid': 'adjust_adid',\n * 'Adjust Network': 'adjust_network',\n * 'Adjust Campaign': 'adjust_campaign',\n * 'Adjust Adgroup': 'adjust_adgroup',\n * };\n *\n * await adapty.updateAttribution({ attribution, source: 'adjust' });\n * } catch (error) {\n * console.error('Failed to update attribution:', error);\n * }\n * ```\n */\n async updateAttribution(options: { attribution: Record<string, any>; source: string }): Promise<void> {\n const method = 'update_attribution_data';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateAttributionData.Request'] = {\n method,\n attribution: JSON.stringify(options.attribution),\n source: options.source,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates the user's consent for collecting refund data.\n *\n * @remarks\n * iOS only. This method has no effect on Android.\n * Use this method to update whether the SDK should collect refund data for the user.\n *\n * @param options - The options object\n * @param options.consent - Whether to collect refund data.\n * @returns A promise that resolves when the consent is updated (or immediately on Android).\n * @throws Error if an error occurs on iOS.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateCollectingRefundDataConsent({ consent: true });\n * } catch (error) {\n * console.error('Failed to update consent:', error);\n * }\n * ```\n */\n async updateCollectingRefundDataConsent(options: { consent: boolean }): Promise<void> {\n const platform = Capacitor.getPlatform();\n if (platform === 'android') {\n return Promise.resolve();\n }\n\n const method = 'update_collecting_refund_data_consent';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateCollectingRefundDataConsent.Request'] = {\n method,\n consent: options.consent,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates the user's refund preference.\n *\n * @remarks\n * iOS only. This method has no effect on Android.\n * Use this method to set the user's preference for handling refunds.\n *\n * @param options - The options object\n * @param options.refundPreference - The refund preference setting.\n * @returns A promise that resolves when the preference is updated (or immediately on Android).\n * @throws Error if an error occurs on iOS.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateRefundPreference({ refundPreference: 'ask_to_cancel' });\n * } catch (error) {\n * console.error('Failed to update refund preference:', error);\n * }\n * ```\n */\n async updateRefundPreference(options: { refundPreference: RefundPreference }): Promise<void> {\n const platform = Capacitor.getPlatform();\n if (platform === 'android') {\n return Promise.resolve();\n }\n\n const method = 'update_refund_preference';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateRefundPreference.Request'] = {\n method,\n refund_preference: options.refundPreference,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates a profile for the current user.\n *\n * @remarks\n * You can set optional attributes such as email, phone number, etc. to the user of your app.\n * You can then use attributes to create user segments or just view them in CRM.\n *\n * The attributes that you've previously set won't be reset.\n * Custom attributes can be removed by passing `null` as their values.\n *\n * @param options - An object of parameters to update. Partial {@link AdaptyProfileParameters}.\n * @returns A promise that resolves when the profile is updated.\n * @throws Error if parameters are invalid or there is a network error.\n *\n * @example\n * Basic profile update\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateProfile({\n * email: 'email@email.com',\n * phoneNumber: '+18888888888',\n * firstName: 'John',\n * lastName: 'Appleseed',\n * gender: 'other',\n * birthday: new Date().toISOString(),\n * });\n * console.log('Profile updated successfully');\n * } catch (error) {\n * console.error('Failed to update profile:', error);\n * }\n * ```\n *\n * @example\n * Custom attributes\n * ```typescript\n * await adapty.updateProfile({\n * codableCustomAttributes: {\n * key_1: 'value_1',\n * key_2: 2,\n * },\n * });\n *\n * // To remove keys, pass null as their values\n * await adapty.updateProfile({\n * codableCustomAttributes: {\n * key_1: null,\n * },\n * });\n * ```\n */\n async updateProfile(options: Partial<AdaptyProfileParameters>): Promise<void> {\n const method = 'update_profile';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const profileParametersCoder = new AdaptyProfileParametersCoder();\n\n const argsWithUndefined: Req['UpdateProfile.Request'] = {\n method,\n params: this.encodeWithLogging(profileParametersCoder, options, 'AdaptyProfileParameters', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Adds an event listener for SDK events.\n *\n * @remarks\n * You can listen to various events from the Adapty SDK such as profile updates.\n * The listener will be called whenever the corresponding event occurs.\n *\n * @param eventName - The name of the event to listen to.\n * @param listenerFunc - The function to call when the event occurs.\n * @returns A listener handle that can be used to remove the listener.\n *\n * @example\n * Listen to profile updates\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * const listener = adapty.addListener('onLatestProfileLoad', (profile) => {\n * console.log('Profile updated:', profile);\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User has premium access');\n * }\n * });\n *\n * // Later, remove the listener\n * listener.remove();\n * ```\n */\n public addListener: AddListenerFn = <T extends keyof EventPayloadMap>(\n eventName: T,\n listenerFunc: (data: EventPayloadMap[T]) => void,\n ) => {\n const wrappedListener = withErrorContext(listenerFunc, eventName, 'Adapty');\n return this.emitter.addListener(eventName, wrappedListener);\n };\n\n /**\n * Removes all attached event listeners.\n *\n * @remarks\n * This method removes all event listeners that were added via {@link addListener}.\n * It's recommended to call this method when cleaning up resources,\n * such as when unmounting a component.\n *\n * @returns A promise that resolves when all listeners are removed.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * // Remove all listeners\n * await adapty.removeAllListeners();\n * ```\n */\n async removeAllListeners(): Promise<void> {\n await this.emitter.removeAllList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AAC,kBAAkB,EAAE,CAAC;IAC1C,CAAC;CACF","sourcesContent":["// PluginListenerHandle is no longer referenced directly in this file\nimport { Capacitor } from '@capacitor/core';\n\nimport { AdaptyEmitter } from './adapty-emitter';\nimport { AdaptyCapacitorPlugin } from './bridge/plugin';\nimport { getCoder } from './coder-registry';\nimport { defaultAdaptyOptions } from './default-configs';\nimport { AdaptyConfigurationCoder } from './shared/coders/adapty-configuration';\nimport { AdaptyIdentifyParamsCoder } from './shared/coders/adapty-identify-params';\nimport { AdaptyPaywallCoder } from './shared/coders/adapty-paywall';\nimport { AdaptyPaywallProductCoder } from './shared/coders/adapty-paywall-product';\nimport { AdaptyProfileParametersCoder } from './shared/coders/adapty-profile-parameters';\nimport { AdaptyPurchaseParamsCoder } from './shared/coders/adapty-purchase-params';\nimport { Log, LogContext } from './shared/logger';\nimport type { LoggerConfig, LogScope } from './shared/logger';\nimport type {\n AdaptyPaywall,\n AdaptyPaywallProduct,\n AdaptyOnboarding,\n AdaptyProfile,\n AdaptyPurchaseResult,\n AdaptyProfileParameters,\n RefundPreference,\n AdaptyInstallationStatus,\n WebPresentation,\n} from './shared/types';\nimport type { components } from './shared/types/api';\nimport type { ActivateParamsInput, FileLocation, LogLevel, IdentifyParamsInput } from './shared/types/inputs';\nimport {\n isErrorResponse,\n isSuccessResponse,\n type CrossPlatformResponse,\n type MethodName,\n type MethodResponseMap,\n} from './shared/types/method-types';\nimport { filterUndefined } from './shared/utils/compact-object';\nimport { mergeOptions } from './shared/utils/merge-options';\nimport { withErrorContext } from './shared/utils/with-error-context';\nimport type { AdaptyPlugin, AddListenerFn, EventPayloadMap } from './types/adapty-plugin';\nimport type {\n AdaptyDefaultOptions,\n GetPaywallOptions,\n GetPaywallOptionsWithDefaults,\n GetPaywallForDefaultAudienceOptions,\n GetPaywallForDefaultAudienceOptionsWithDefaults,\n MakePurchaseOptions,\n GetOnboardingOptions,\n GetOnboardingOptionsWithDefaults,\n GetOnboardingForDefaultAudienceOptions,\n GetOnboardingForDefaultAudienceOptionsWithDefaults,\n} from './types/configs';\n\ntype Req = components['requests'];\n\n/**\n * Entry point for the Adapty SDK.\n *\n * @remarks\n * This is the main Adapty class, excluding UI rendering functionality.\n *\n * @public\n */\nexport class Adapty implements AdaptyPlugin {\n private activating: Promise<void> | null = null;\n private resolveHeldActivation?: (() => Promise<void>) | null = null;\n private readonly emitter = new AdaptyEmitter();\n private nonWaitingMethods: MethodName[] = [\n 'activate',\n 'is_activated',\n 'get_paywall_for_default_audience',\n 'get_onboarding_for_default_audience',\n 'set_log_level',\n 'set_fallback',\n ];\n private readonly options: AdaptyDefaultOptions = defaultAdaptyOptions;\n\n /**\n * Helper method for logging encode operations\n */\n private encodeWithLogging<T, R>(\n coder: { encode(data: T): R },\n data: T,\n methodName: string,\n parentCtx?: LogContext,\n ): R {\n if (!parentCtx) {\n return coder.encode(data);\n }\n\n const encodeLog = parentCtx.encode({ methodName: `encode/${methodName}` });\n encodeLog.start(() => ({ data }));\n\n try {\n const result = coder.encode(data);\n encodeLog.success(() => ({ result }));\n return result;\n } catch (error) {\n encodeLog.failed(() => ({ error }));\n throw error;\n }\n }\n\n /**\n * Handle method calls through crossplatform bridge with type safety\n * @internal\n */\n public async handleMethodCall<M extends MethodName>(\n methodName: M,\n args: string,\n ctx: LogContext,\n log: LogScope,\n ): Promise<MethodResponseMap[M]> {\n // Hold on deferred activation first\n if (this.resolveHeldActivation && !this.nonWaitingMethods.includes(methodName)) {\n log.wait(() => ({}));\n await this.resolveHeldActivation();\n this.resolveHeldActivation = null;\n log.waitComplete(() => ({}));\n }\n\n // Then wait for ongoing activation if required\n if (this.activating && (!this.nonWaitingMethods.includes(methodName) || methodName === 'is_activated')) {\n log.wait(() => ({}));\n await this.activating;\n log.waitComplete(() => ({}));\n }\n\n const bridgeLog = ctx.bridge({ methodName: `fetch/${methodName}` });\n bridgeLog.start(() => ({ method: methodName, args }));\n\n try {\n const result = await AdaptyCapacitorPlugin.handleMethodCall({\n methodName,\n args,\n });\n\n bridgeLog.success(() => ({ crossPlatformJson: result.crossPlatformJson }));\n\n // Parse JSON response with type safety\n const parsedResponse: CrossPlatformResponse = JSON.parse(result.crossPlatformJson);\n\n // Check for native errors\n if (isErrorResponse(parsedResponse)) {\n const error = parsedResponse.error;\n const errorMessage = `Native error: ${error.message} (code: ${error.adaptyCode})`;\n const nativeError = new Error(errorMessage);\n\n log.failed(() => ({ error: nativeError }));\n throw nativeError;\n }\n\n // Extract success data with type safety\n if (isSuccessResponse(parsedResponse)) {\n const successData: any = parsedResponse.success;\n\n // Apply decoder if available for this method\n const coder = getCoder(methodName);\n let result: MethodResponseMap[M];\n\n if (coder) {\n // Create decode scope for logging decode operations\n const decodeLog = ctx.decode({ methodName: `decode/${methodName}` });\n decodeLog.start(() => ({ successData }));\n\n try {\n result = coder.decode(successData) as MethodResponseMap[M];\n decodeLog.success(() => ({ result }));\n } catch (error) {\n decodeLog.failed(() => ({ error }));\n throw error;\n }\n } else {\n result = successData as MethodResponseMap[M];\n }\n\n log.success(() => ({ result }));\n return result;\n }\n\n const formatError = new Error('Invalid response format: missing success or error field');\n log.failed(() => ({ error: formatError }));\n throw formatError;\n } catch (error) {\n bridgeLog.failed(() => ({ error }));\n // If it's our custom error and log wasn't called yet, log it\n if (error instanceof Error && !error.message.startsWith('{')) {\n if (!error.message.startsWith('Native error:')) {\n log.failed(() => ({ error }));\n }\n throw error;\n }\n\n // If JSON parsing fails, wrap the error\n const parseError = new Error(`Failed to parse native response: ${error}`);\n log.failed(() => ({ error: parseError }));\n throw parseError;\n }\n }\n\n private isPaywallProduct(obj: AdaptyPaywall | AdaptyPaywallProduct): obj is AdaptyPaywallProduct {\n return 'vendorProductId' in obj;\n }\n\n /**\n * Initializes the Adapty SDK.\n *\n * @remarks\n * This method must be called in order for the SDK to work.\n * It is preferred to call it as early as possible in the app lifecycle,\n * so background activities can be performed and cache can be updated.\n *\n * @example\n *\n * @example\n * Usage with your user identifier from your system\n * ```typescript\n * await adapty.activate({\n * apiKey: 'YOUR_PUBLIC_SDK_KEY',\n * params: {\n * customerUserId: 'YOUR_USER_ID'\n * }\n * });\n * ```\n *\n * @param options - The activation options\n * @param options.apiKey - You can find it in your app settings in Adapty Dashboard App settings > General.\n * @param options.params - Optional activation parameters of type {@link ActivateParamsInput}.\n * @returns A promise that resolves when the SDK is activated.\n * @throws Error if the SDK is already activated or if the API key is invalid.\n */\n async activate(options: { apiKey: string; params?: ActivateParamsInput }): Promise<void> {\n const { apiKey, params = {} } = options;\n\n // Validate API key\n if (!apiKey || typeof apiKey !== 'string' || apiKey.trim().length === 0) {\n throw new Error('API key is required and must be a non-empty string');\n }\n\n // Prevent multiple activations\n if (this.activating) {\n await this.activating;\n return;\n }\n\n // Check if already activated (if __ignoreActivationOnFastRefresh is enabled)\n if (params.__ignoreActivationOnFastRefresh) {\n try {\n const isActivated = await this.isActivated();\n if (isActivated) {\n return;\n }\n } catch (error) {\n // Continue with activation if we can't check activation status\n }\n }\n\n // Defer activation if requested (for debugging) — start activation lazily on first blocked call\n if (params.__debugDeferActivation) {\n return new Promise<void>((resolve) => {\n // Do not start activation immediately. It will be started when a blocked method comes in.\n this.resolveHeldActivation = async () => {\n this.activating = this.performActivation(apiKey, params);\n try {\n await this.activating;\n } finally {\n this.activating = null;\n }\n resolve();\n };\n });\n }\n\n // Perform activation\n this.activating = this.performActivation(apiKey, params);\n await this.activating;\n this.activating = null;\n }\n\n private async performActivation(apiKey: string, params: ActivateParamsInput): Promise<void> {\n const method = 'activate';\n\n // Set log level before creating LogContext\n const logLevel = params.logLevel;\n Log.logLevel = logLevel || null;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ apiKey, params }));\n\n const configurationCoder = new AdaptyConfigurationCoder();\n const configuration = configurationCoder.encode(apiKey, params);\n\n const activateRequestWithUndefined: Req['Activate.Request'] = {\n method,\n configuration,\n };\n\n const activateRequest = filterUndefined(activateRequestWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(activateRequest), ctx, log);\n }\n\n /**\n * Checks if the Adapty SDK is activated.\n *\n * @returns A promise that resolves to `true` if the SDK is activated, `false` otherwise.\n * @throws Error if an error occurs while checking activation status.\n */\n async isActivated(): Promise<boolean> {\n const method = 'is_activated';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['IsActivated.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Gets the current installation status.\n *\n * @remarks\n * Installation status provides information about when the app was installed,\n * how many times it has been launched, and other installation-related details.\n * The status can be \"not_available\", \"not_determined\", or \"determined\" with details.\n *\n * @returns A promise that resolves with the installation status.\n * @throws Error if an error occurs while retrieving the installation status.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const status = await adapty.getCurrentInstallationStatus();\n * if (status.status === 'determined') {\n * console.log('Install time:', status.details.installTime);\n * console.log('Launch count:', status.details.appLaunchCount);\n * }\n * } catch (error) {\n * console.error('Failed to get installation status:', error);\n * }\n * ```\n */\n async getCurrentInstallationStatus(): Promise<AdaptyInstallationStatus> {\n const method = 'get_current_installation_status';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['GetCurrentInstallationStatus.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the paywall by the specified placement.\n *\n * @remarks\n * With Adapty, you can remotely configure the products and offers in your app\n * by simply adding them to paywalls – no need for hardcoding them.\n * The only thing you hardcode is the placement ID.\n * This flexibility allows you to easily update paywalls, products, and offers,\n * or run A/B tests, all without the need for a new app release.\n *\n * @param options - The options for fetching the paywall\n * @param options.placementId - The identifier of the desired placement. This is the value you specified when creating a placement in the Adapty Dashboard.\n * @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.\n * @param options.params - Optional. Additional parameters for fetching the paywall, including fetch policy and load timeout.\n * @returns A promise that resolves with the requested {@link AdaptyPaywall}.\n * @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.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * console.log('Paywall fetched successfully');\n * } catch (error) {\n * console.error('Failed to fetch paywall:', error);\n * }\n * ```\n */\n async getPaywall(options: GetPaywallOptions): Promise<AdaptyPaywall> {\n const method = 'get_paywall';\n const optionsWithDefault = mergeOptions<GetPaywallOptionsWithDefaults>(options, this.options[method]);\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetPaywall.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n load_timeout: params.loadTimeoutMs / 1000,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the paywall of the specified placement for the **All Users** audience.\n *\n * @remarks\n * With Adapty, you can remotely configure the products and offers in your app\n * by simply adding them to paywalls – no need for hardcoding them.\n * The only thing you hardcode is the placement ID.\n *\n * However, it's crucial to understand that the recommended approach is to fetch the paywall\n * through the placement ID by the {@link getPaywall} method.\n * The `getPaywallForDefaultAudience` method should be a last resort due to its significant drawbacks:\n * - Potential backward compatibility issues\n * - Loss of targeting (all users see the same paywall)\n *\n * 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.\n *\n * @param options - The options for fetching the paywall\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the paywall localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the paywall.\n * @returns A promise that resolves with the requested {@link AdaptyPaywall}.\n * @throws Error if the paywall with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywallForDefaultAudience({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * } catch (error) {\n * console.error('Failed to fetch paywall:', error);\n * }\n * ```\n */\n async getPaywallForDefaultAudience(options: GetPaywallForDefaultAudienceOptions): Promise<AdaptyPaywall> {\n const method = 'get_paywall_for_default_audience';\n const optionsWithDefault = mergeOptions<GetPaywallForDefaultAudienceOptionsWithDefaults>(\n options,\n this.options[method],\n );\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetPaywallForDefaultAudience.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy ?? 'reload_revalidating_cache_data' },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches a list of products associated with a provided paywall.\n *\n * @param options - The options object\n * @param options.paywall - A paywall to fetch products for. You can get it using {@link getPaywall} method.\n * @returns A promise that resolves with a list of {@link AdaptyPaywallProduct} associated with a provided paywall.\n * @throws Error if an error occurs while fetching products.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * const products = await adapty.getPaywallProducts({ paywall });\n * console.log('Products:', products);\n * } catch (error) {\n * console.error('Failed to fetch products:', error);\n * }\n * ```\n */\n async getPaywallProducts(options: { paywall: AdaptyPaywall }): Promise<AdaptyPaywallProduct[]> {\n const method = 'get_paywall_products';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n\n const argsWithUndefined: Req['GetPaywallProducts.Request'] = {\n method,\n paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the onboarding by the specified placement.\n *\n * @remarks\n * When you create an onboarding with the no-code builder, it's stored as a container with configuration\n * that your app needs to fetch and display. This container manages the entire experience - what content appears,\n * how it's presented, and how user interactions are processed.\n *\n * @param options - The options for fetching the onboarding\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the onboarding localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the onboarding.\n * @returns A promise that resolves with the requested {@link AdaptyOnboarding}.\n * @throws Error if the onboarding with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const onboarding = await adapty.getOnboarding({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * params: {\n * fetchPolicy: 'reload_revalidating_cache_data',\n * loadTimeoutMs: 5000\n * }\n * });\n * console.log('Onboarding fetched successfully');\n * } catch (error) {\n * console.error('Failed to fetch onboarding:', error);\n * }\n * ```\n */\n async getOnboarding(options: GetOnboardingOptions): Promise<AdaptyOnboarding> {\n const method = 'get_onboarding';\n const optionsWithDefault = mergeOptions<GetOnboardingOptionsWithDefaults>(options, this.options[method]);\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetOnboarding.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n load_timeout: params.loadTimeoutMs / 1000,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches the onboarding of the specified placement for the **All Users** audience.\n *\n * @remarks\n * It's crucial to understand that the recommended approach is to fetch the onboarding\n * by the {@link getOnboarding} method. The `getOnboardingForDefaultAudience` method\n * should be used only if faster fetching outweighs the drawbacks:\n * - Potential backward compatibility issues\n * - Loss of personalization (no targeting based on country, attribution, or custom attributes)\n *\n * @param options - The options for fetching the onboarding\n * @param options.placementId - The identifier of the desired placement.\n * @param options.locale - Optional. The identifier of the onboarding localization. Default: `'en'`.\n * @param options.params - Optional. Additional parameters for fetching the onboarding.\n * @returns A promise that resolves with the requested {@link AdaptyOnboarding}.\n * @throws Error if the onboarding with the specified ID is not found.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const onboarding = await adapty.getOnboardingForDefaultAudience({\n * placementId: 'YOUR_PLACEMENT_ID',\n * locale: 'en',\n * });\n * } catch (error) {\n * console.error('Failed to fetch onboarding:', error);\n * }\n * ```\n */\n async getOnboardingForDefaultAudience(options: GetOnboardingForDefaultAudienceOptions): Promise<AdaptyOnboarding> {\n const method = 'get_onboarding_for_default_audience';\n const optionsWithDefault = mergeOptions<GetOnboardingForDefaultAudienceOptionsWithDefaults>(\n options,\n this.options[method],\n );\n const params = optionsWithDefault.params;\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ optionsWithDefault }));\n\n const argsWithUndefined: Req['GetOnboardingForDefaultAudience.Request'] = {\n method,\n placement_id: optionsWithDefault.placementId,\n locale: optionsWithDefault.locale,\n fetch_policy:\n params.fetchPolicy === 'return_cache_data_if_not_expired_else_load'\n ? { type: params.fetchPolicy, max_age: params.maxAgeSeconds }\n : { type: params.fetchPolicy ?? 'reload_revalidating_cache_data' },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Fetches a user profile.\n *\n * @remarks\n * The getProfile method provides the most up-to-date result\n * as it always tries to query the API.\n * If for some reason (e.g. no internet connection),\n * the Adapty SDK fails to retrieve information from the server,\n * the data from cache will be returned.\n * It is also important to note\n * that the Adapty SDK updates {@link AdaptyProfile} cache\n * on a regular basis, in order\n * to keep this information as up-to-date as possible.\n *\n * @returns A promise that resolves with the user's {@link AdaptyProfile}.\n * @throws Error if an error occurs while fetching the profile.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const profile = await adapty.getProfile();\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User has access to premium features');\n * }\n * } catch (error) {\n * console.error('Failed to get profile:', error);\n * }\n * ```\n */\n async getProfile(): Promise<AdaptyProfile> {\n const method = 'get_profile';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['GetProfile.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs in a user with a provided customerUserId.\n *\n * @remarks\n * If you don't have a user id on SDK initialization,\n * you can set it later at any time with this method.\n * The most common cases are after registration/authorization\n * when the user switches from being an anonymous user to an authenticated user.\n *\n * @param options - The identification options\n * @param options.customerUserId - A unique user identifier.\n * @param options.params - Optional. Additional parameters for identification, including platform-specific settings.\n * @returns A promise that resolves when identification is complete.\n * @throws Error if an error occurs during identification.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.identify({ customerUserId: 'YOUR_USER_ID' });\n * console.log('User identified successfully');\n * } catch (error) {\n * console.error('Failed to identify user:', error);\n * }\n * ```\n */\n async identify(options: { customerUserId: string; params?: IdentifyParamsInput }): Promise<void> {\n const method = 'identify';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const identifyParamsCoder = new AdaptyIdentifyParamsCoder();\n const parameters = identifyParamsCoder.encode(options.params);\n\n const argsWithUndefined: Req['Identify.Request'] = {\n method,\n customer_user_id: options.customerUserId,\n parameters,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs a paywall view event.\n *\n * @remarks\n * Adapty helps you to measure the performance of the paywalls.\n * We automatically collect all the metrics related to purchases except for custom paywall views.\n * This is because only you know when the paywall was shown to a customer.\n *\n * Whenever you show a paywall to your user,\n * call this function to log the event,\n * and it will be accumulated in the paywall metrics.\n *\n * @param options - The options object\n * @param options.paywall - The paywall object that was shown to the user.\n * @returns A promise that resolves when the event is logged.\n * @throws Error if an error occurs while logging the event.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * // ...after opening the paywall\n * await adapty.logShowPaywall({ paywall });\n * ```\n */\n async logShowPaywall(options: { paywall: AdaptyPaywall }): Promise<void> {\n const method = 'log_show_paywall';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n\n const argsWithUndefined: Req['LogShowPaywall.Request'] = {\n method,\n paywall: this.encodeWithLogging(paywallCoder, options.paywall, 'AdaptyPaywall', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Opens a web paywall in the default browser.\n *\n * @param options - The options object\n * @param options.paywallOrProduct - The paywall or product to open as a web paywall.\n * @returns A promise that resolves when the web paywall is opened.\n * @throws Error if an error occurs while opening the web paywall.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * await adapty.openWebPaywall({ paywallOrProduct: paywall });\n * } catch (error) {\n * console.error('Failed to open web paywall:', error);\n * }\n * ```\n */\n async openWebPaywall(options: {\n paywallOrProduct: AdaptyPaywall | AdaptyPaywallProduct;\n openIn?: WebPresentation;\n }): Promise<void> {\n const method = 'open_web_paywall';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n const productCoder = new AdaptyPaywallProductCoder();\n\n const argsWithUndefined: Req['OpenWebPaywall.Request'] = {\n method,\n ...(this.isPaywallProduct(options.paywallOrProduct)\n ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }\n : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) }),\n ...(options.openIn ? { open_in: options.openIn } : {}),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Creates a URL for a web paywall.\n *\n * @remarks\n * This method generates a URL that can be used to open a web version of the paywall.\n * You can use this URL in a custom web view or a browser.\n *\n * @param options - The options object\n * @param options.paywallOrProduct - The paywall or product to create a URL for.\n * @returns A promise that resolves with the web paywall URL.\n * @throws Error if an error occurs while creating the URL.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const paywall = await adapty.getPaywall({ placementId: 'YOUR_PLACEMENT_ID' });\n * const url = await adapty.createWebPaywallUrl({ paywallOrProduct: paywall });\n * console.log('Web paywall URL:', url);\n * } catch (error) {\n * console.error('Failed to create web paywall URL:', error);\n * }\n * ```\n */\n async createWebPaywallUrl(options: { paywallOrProduct: AdaptyPaywall | AdaptyPaywallProduct }): Promise<string> {\n const method = 'create_web_paywall_url';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const paywallCoder = new AdaptyPaywallCoder();\n const productCoder = new AdaptyPaywallProductCoder();\n\n const argsWithUndefined: Req['CreateWebPaywallUrl.Request'] = {\n method,\n ...(this.isPaywallProduct(options.paywallOrProduct)\n ? { product: this.encodeWithLogging(productCoder, options.paywallOrProduct, 'AdaptyPaywallProduct', ctx) }\n : { paywall: this.encodeWithLogging(paywallCoder, options.paywallOrProduct, 'AdaptyPaywall', ctx) }),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Logs out the current user.\n *\n * @remarks\n * You can then login the user using {@link identify} method.\n *\n * @returns A promise that resolves when the user is logged out.\n * @throws Error if an error occurs during logout.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.logout();\n * console.log('User logged out successfully');\n * } catch (error) {\n * console.error('Failed to logout user:', error);\n * }\n * ```\n */\n async logout(): Promise<void> {\n const method = 'logout';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['Logout.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Performs a purchase of the specified product.\n *\n * @remarks\n * In paywalls built with Paywall Builder, purchases are processed automatically with no additional code.\n *\n * @param options - The purchase options\n * @param options.product - The product to be purchased. You can get it using {@link getPaywallProducts} method.\n * @param options.params - Optional. Additional parameters for the purchase, including Android subscription update params.\n * @returns A promise that resolves with the {@link AdaptyPurchaseResult} object containing details about the purchase.\n * If the result is `'success'`, it also includes the updated user's profile.\n * @throws Error if an error occurs during the purchase process.\n *\n * @example\n * Basic purchase\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const result = await adapty.makePurchase({ product });\n *\n * if (result.type === 'success') {\n * const isSubscribed = result.profile?.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User is now subscribed!');\n * }\n * }\n * } catch (error) {\n * console.error('Purchase failed:', error);\n * }\n * ```\n */\n async makePurchase(options: MakePurchaseOptions): Promise<AdaptyPurchaseResult> {\n const method = 'make_purchase';\n const params = options.params ?? {};\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const productCoder = new AdaptyPaywallProductCoder();\n const purchaseParamsCoder = new AdaptyPurchaseParamsCoder();\n\n const encodedProduct = this.encodeWithLogging(productCoder, options.product, 'AdaptyPaywallProduct', ctx);\n const productInput = productCoder.getInput(encodedProduct);\n const purchaseParams = this.encodeWithLogging(purchaseParamsCoder, params, 'AdaptyPurchaseParams', ctx);\n\n const argsWithUndefined: Req['MakePurchase.Request'] = {\n method,\n product: productInput,\n parameters: purchaseParams,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Opens a native modal screen to redeem Apple Offer Codes.\n *\n * @remarks\n * iOS 14+ only. Since iOS 14.0, your users can redeem Offer Codes.\n * To enable users to redeem offer codes, you can display the offer code redemption sheet.\n *\n * @returns A promise that resolves when the redemption sheet is presented.\n * @throws Error if an error occurs or if called on Android.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.presentCodeRedemptionSheet();\n * } catch (error) {\n * console.error('Failed to present code redemption sheet:', error);\n * }\n * ```\n */\n async presentCodeRedemptionSheet(): Promise<void> {\n const method = 'present_code_redemption_sheet';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['PresentCodeRedemptionSheet.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the variation ID of the purchase.\n *\n * @remarks\n * In Observer mode, Adapty SDK doesn't know where the purchase was made from.\n * you can manually assign variation to the purchase.\n * After doing this, you'll be able to see metrics in Adapty Dashboard.\n *\n * @param options - The options object\n * @param options.transactionId - The transaction ID of the purchase.\n * @param options.variationId - Optional. The variation ID from the {@link AdaptyPaywall}.\n * @returns A promise that resolves when the transaction is reported.\n * @throws Error if an error occurs while reporting the transaction.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.reportTransaction({\n * transactionId: 'transaction_123',\n * variationId: 'variation_456'\n * });\n * } catch (error) {\n * console.error('Failed to report transaction:', error);\n * }\n * ```\n */\n async reportTransaction(options: { transactionId: string; variationId?: string }): Promise<void> {\n const method = 'report_transaction';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['ReportTransaction.Request'] = {\n method,\n transaction_id: options.transactionId,\n variation_id: options.variationId,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Restores user purchases and updates the profile.\n *\n * @remarks\n * Restoring purchases allows users to regain access to previously purchased content,\n * such as subscriptions or in-app purchases, without being charged again.\n * This feature is especially useful for users who may have uninstalled and reinstalled the app\n * or switched to a new device.\n *\n * In paywalls built with Paywall Builder, purchases are restored automatically without additional code from you.\n *\n * @returns A promise that resolves with the updated user's {@link AdaptyProfile}.\n * @throws Error if an error occurs during the restore process.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const profile = await adapty.restorePurchases();\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n *\n * if (isSubscribed) {\n * console.log('Access restored successfully!');\n * } else {\n * console.log('No active subscriptions found');\n * }\n * } catch (error) {\n * console.error('Failed to restore purchases:', error);\n * }\n * ```\n */\n async restorePurchases(): Promise<AdaptyProfile> {\n const method = 'restore_purchases';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({}));\n\n const argsWithUndefined: Req['RestorePurchases.Request'] = {\n method,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n return await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the fallback paywalls.\n *\n * @remarks\n * Fallback file will be used if the SDK fails\n * to fetch the paywalls from the dashboard.\n * It is not designed to be used for the offline flow,\n * as products are not cached in Adapty.\n *\n * @param options - The options object\n * @param options.fileLocation - The location of the fallback file for each platform.\n * @returns A promise that resolves when fallback placements are saved.\n * @throws Error if an error occurs while setting the fallback.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.setFallback({\n * fileLocation: {\n * ios: { fileName: 'fallback_paywalls.json' },\n * android: { relativeAssetPath: 'fallback_paywalls.json' }\n * }\n * });\n * } catch (error) {\n * console.error('Failed to set fallback:', error);\n * }\n * ```\n */\n async setFallback(options: { fileLocation: FileLocation }): Promise<void> {\n const method = 'set_fallback';\n\n const platform = Capacitor.getPlatform();\n let fileLocationString: string;\n\n if (platform === 'ios') {\n fileLocationString = options.fileLocation.ios.fileName;\n } else if (platform === 'android') {\n // Add suffixes to distinguish resource types on Android\n if ('relativeAssetPath' in options.fileLocation.android) {\n fileLocationString = `${options.fileLocation.android.relativeAssetPath}a`;\n } else {\n fileLocationString = `${options.fileLocation.android.rawResName}r`;\n }\n } else {\n fileLocationString = '';\n }\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ platform, fileLocationString }));\n\n const argsWithUndefined: Req['SetFallback.Request'] = {\n method,\n asset_id: fileLocationString,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets an integration identifier for the current user.\n *\n * @remarks\n * Integration identifiers can be used to link Adapty profiles to external systems\n * and track users across different platforms.\n *\n * @param options - The options object\n * @param options.key - The key of the integration identifier.\n * @param options.value - The value of the integration identifier.\n * @returns A promise that resolves when the integration identifier is set.\n * @throws Error if an error occurs while setting the identifier.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.setIntegrationIdentifier({\n * key: 'firebase_app_instance_id',\n * value: 'YOUR_FIREBASE_ID'\n * });\n * } catch (error) {\n * console.error('Failed to set integration identifier:', error);\n * }\n * ```\n */\n async setIntegrationIdentifier(options: { key: string; value: string }): Promise<void> {\n const method = 'set_integration_identifiers';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['SetIntegrationIdentifier.Request'] = {\n method,\n key_values: { [options.key]: options.value },\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Sets the preferred log level and/or custom logger configuration.\n *\n * @remarks\n * By default, the log level is set to `error`.\n *\n * There are four levels available:\n * - `error`: only errors will be logged\n * - `warn`: messages from the SDK that do not cause critical errors, but are worth paying attention to\n * - `info`: various information messages, such as those that log the lifecycle of various modules\n * - `verbose`: any additional information that may be useful during debugging, such as function calls, API queries, etc.\n *\n * @param options - The options object\n * @param options.logLevel - Optional. The new preferred log level.\n * @param options.logger - Optional. Custom logger configuration.\n * @returns A promise that resolves when the log level is set.\n * @throws Error if the log level is invalid.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * // Set log level\n * await adapty.setLogLevel({ logLevel: 'verbose' });\n *\n * // Or set custom logger\n * await adapty.setLogLevel({\n * logger: {\n * handler: (level, scope, message, data) => {\n * sendLogToYourServer(`[${level}] ${message}`, data);\n * }\n * }\n * });\n * ```\n */\n async setLogLevel(options: { logLevel?: LogLevel; logger?: LoggerConfig }): Promise<void> {\n const method = 'set_log_level';\n\n if (options.logger) {\n Log.configure(options.logger);\n }\n\n if (options.logLevel !== undefined) {\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options: { logLevel: options.logLevel } }));\n\n // Update log level immediately\n Log.logLevel = options.logLevel;\n\n const argsWithUndefined: Req['SetLogLevel.Request'] = {\n method,\n value: options.logLevel,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n }\n\n /**\n * Updates attribution data for the current user.\n *\n * @remarks\n * Attribution data can be used to track marketing campaigns and user acquisition sources.\n *\n * @param options - The options object\n * @param options.attribution - An object containing attribution data.\n * @param options.source - The source of the attribution data (e.g., 'adjust', 'appsflyer').\n * @returns A promise that resolves when the attribution data is updated.\n * @throws Error if parameters are invalid or not provided.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * const attribution = {\n * 'Adjust Adid': 'adjust_adid',\n * 'Adjust Network': 'adjust_network',\n * 'Adjust Campaign': 'adjust_campaign',\n * 'Adjust Adgroup': 'adjust_adgroup',\n * };\n *\n * await adapty.updateAttribution({ attribution, source: 'adjust' });\n * } catch (error) {\n * console.error('Failed to update attribution:', error);\n * }\n * ```\n */\n async updateAttribution(options: { attribution: Record<string, any>; source: string }): Promise<void> {\n const method = 'update_attribution_data';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateAttributionData.Request'] = {\n method,\n attribution: JSON.stringify(options.attribution),\n source: options.source,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates the user's consent for collecting refund data.\n *\n * @remarks\n * iOS only. This method has no effect on Android.\n * Use this method to update whether the SDK should collect refund data for the user.\n *\n * @param options - The options object\n * @param options.consent - Whether to collect refund data.\n * @returns A promise that resolves when the consent is updated (or immediately on Android).\n * @throws Error if an error occurs on iOS.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateCollectingRefundDataConsent({ consent: true });\n * } catch (error) {\n * console.error('Failed to update consent:', error);\n * }\n * ```\n */\n async updateCollectingRefundDataConsent(options: { consent: boolean }): Promise<void> {\n const platform = Capacitor.getPlatform();\n if (platform === 'android') {\n return Promise.resolve();\n }\n\n const method = 'update_collecting_refund_data_consent';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateCollectingRefundDataConsent.Request'] = {\n method,\n consent: options.consent,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates the user's refund preference.\n *\n * @remarks\n * iOS only. This method has no effect on Android.\n * Use this method to set the user's preference for handling refunds.\n *\n * @param options - The options object\n * @param options.refundPreference - The refund preference setting.\n * @returns A promise that resolves when the preference is updated (or immediately on Android).\n * @throws Error if an error occurs on iOS.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateRefundPreference({ refundPreference: 'ask_to_cancel' });\n * } catch (error) {\n * console.error('Failed to update refund preference:', error);\n * }\n * ```\n */\n async updateRefundPreference(options: { refundPreference: RefundPreference }): Promise<void> {\n const platform = Capacitor.getPlatform();\n if (platform === 'android') {\n return Promise.resolve();\n }\n\n const method = 'update_refund_preference';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const argsWithUndefined: Req['UpdateRefundPreference.Request'] = {\n method,\n refund_preference: options.refundPreference,\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Updates a profile for the current user.\n *\n * @remarks\n * You can set optional attributes such as email, phone number, etc. to the user of your app.\n * You can then use attributes to create user segments or just view them in CRM.\n *\n * The attributes that you've previously set won't be reset.\n * Custom attributes can be removed by passing `null` as their values.\n *\n * @param options - An object of parameters to update. Partial {@link AdaptyProfileParameters}.\n * @returns A promise that resolves when the profile is updated.\n * @throws Error if parameters are invalid or there is a network error.\n *\n * @example\n * Basic profile update\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * try {\n * await adapty.updateProfile({\n * email: 'email@email.com',\n * phoneNumber: '+18888888888',\n * firstName: 'John',\n * lastName: 'Appleseed',\n * gender: 'other',\n * birthday: new Date().toISOString(),\n * });\n * console.log('Profile updated successfully');\n * } catch (error) {\n * console.error('Failed to update profile:', error);\n * }\n * ```\n *\n * @example\n * Custom attributes\n * ```typescript\n * await adapty.updateProfile({\n * codableCustomAttributes: {\n * key_1: 'value_1',\n * key_2: 2,\n * },\n * });\n *\n * // To remove keys, pass null as their values\n * await adapty.updateProfile({\n * codableCustomAttributes: {\n * key_1: null,\n * },\n * });\n * ```\n */\n async updateProfile(options: Partial<AdaptyProfileParameters>): Promise<void> {\n const method = 'update_profile';\n\n const ctx = new LogContext();\n const log = ctx.call({ methodName: method });\n log.start(() => ({ options }));\n\n const profileParametersCoder = new AdaptyProfileParametersCoder();\n\n const argsWithUndefined: Req['UpdateProfile.Request'] = {\n method,\n params: this.encodeWithLogging(profileParametersCoder, options, 'AdaptyProfileParameters', ctx),\n };\n\n const args = filterUndefined(argsWithUndefined);\n\n await this.handleMethodCall(method, JSON.stringify(args), ctx, log);\n }\n\n /**\n * Adds an event listener for SDK events.\n *\n * @remarks\n * You can listen to various events from the Adapty SDK such as profile updates.\n * The listener will be called whenever the corresponding event occurs.\n *\n * @param eventName - The name of the event to listen to.\n * @param listenerFunc - The function to call when the event occurs.\n * @returns A listener handle that can be used to remove the listener.\n *\n * @example\n * Listen to profile updates\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * const listener = adapty.addListener('onLatestProfileLoad', (profile) => {\n * console.log('Profile updated:', profile);\n * const isSubscribed = profile.accessLevels['YOUR_ACCESS_LEVEL']?.isActive;\n * if (isSubscribed) {\n * console.log('User has premium access');\n * }\n * });\n *\n * // Later, remove the listener\n * listener.remove();\n * ```\n */\n public addListener: AddListenerFn = <T extends keyof EventPayloadMap>(\n eventName: T,\n listenerFunc: (data: EventPayloadMap[T]) => void,\n ) => {\n const wrappedListener = withErrorContext(listenerFunc, eventName, 'Adapty');\n return this.emitter.addListener(eventName, wrappedListener);\n };\n\n /**\n * Removes all attached event listeners.\n *\n * @remarks\n * This method removes all event listeners that were added via {@link addListener}.\n * It's recommended to call this method when cleaning up resources,\n * such as when unmounting a component.\n *\n * @returns A promise that resolves when all listeners are removed.\n *\n * @example\n * ```typescript\n * import { adapty } from '@adapty/capacitor';\n *\n * // Remove all listeners\n * await adapty.removeAllListeners();\n * ```\n */\n async removeAllListeners(): Promise<void> {\n await this.emitter.removeAllListeners();\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapty-error.js","sourceRoot":"","sources":["../../../src/shared/adapty-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAWpC,YAAY,KAAuB;QACjC,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAErC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;QACnC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC;QAC1C,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAE3B,IAAI,WAAW,CAAC,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"adapty-error.js","sourceRoot":"","sources":["../../../src/shared/adapty-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAQ1C,MAAM,OAAO,WAAY,SAAQ,KAAK;IAWpC,YAAY,KAAuB;QAC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AAG,WAAW,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;QAC/C,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;;AA9DD,+CAA+C;AACjC,kBAAM,GAAG,EAAE,CAAC","sourcesContent":["import { ErrorCode } from './types/error';\n\nexport interface AdaptyErrorInput {\n adaptyCode: ErrorCode;\n message: string;\n detail?: string | undefined;\n}\n\nexport class AdaptyError extends Error {\n // Custom prefix to be shown before log message\n public static prefix = '';\n static middleware?: (error: AdaptyError) => void;\n\n // For example `2` for cancelled payment\n public adaptyCode: ErrorCode;\n // Message that is safe to show to a user\n public localizedDescription: string;\n public detail: string | undefined;\n\n constructor(input: AdaptyErrorInput) {\n super(AdaptyError.getMessage(input));\n\n this.adaptyCode = input.adaptyCode;\n this.localizedDescription = input.message;\n this.detail = input.detail;\n\n if (AdaptyError.middleware) {\n AdaptyError.middleware(this);\n }\n }\n\n public static set onError(callback: (error: AdaptyError) => void) {\n AdaptyError.middleware = callback;\n }\n\n public static failedToDecodeNativeError(\n message: string,\n error: unknown,\n ): AdaptyError {\n return new AdaptyError({\n adaptyCode: 0,\n message: message,\n detail: JSON.stringify(error),\n });\n }\n\n public static failedToEncode(message: string): AdaptyError {\n return new AdaptyError({\n adaptyCode: 2009,\n message: message,\n });\n }\n\n public static failedToDecode(message: string): AdaptyError {\n return new AdaptyError({\n adaptyCode: 2006,\n message: message,\n });\n }\n\n private static getMessage(input: AdaptyErrorInput): string {\n const code = input.adaptyCode;\n const codeText = ErrorCode[code];\n\n let message = `#${code} (${codeText}): ${input.message}`;\n\n if (AdaptyError.prefix) {\n message = `${AdaptyError.prefix} ${message}`;\n }\n\n return message;\n }\n}\n"]}
|