@adadapted/react-native-sdk 3.1.8 → 3.1.10
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/android/.project +1 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +2 -2
- package/android/bin/.project +34 -0
- package/android/bin/.settings/org.eclipse.buildship.core.prefs +13 -0
- package/android/bin/build.gradle +130 -0
- package/android/bin/gradle.properties +4 -0
- package/android/bin/src/main/AndroidManifest.xml +4 -0
- package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt +115 -0
- package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkPackage.kt +20 -0
- package/android/build.gradle +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.js +10 -24
- package/lib/commonjs/api/adadaptedApiRequests.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiRequests.mock.js +11 -21
- package/lib/commonjs/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/commonjs/api/adadaptedApiTypes.js +1 -30
- package/lib/commonjs/api/adadaptedApiTypes.js.map +1 -1
- package/lib/commonjs/components/AdZone.js +22 -48
- package/lib/commonjs/components/AdZone.js.map +1 -1
- package/lib/commonjs/index.js +127 -182
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/commonjs/util.js +4 -2
- package/lib/commonjs/util.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.js +9 -8
- package/lib/module/api/adadaptedApiRequests.js.map +1 -1
- package/lib/module/api/adadaptedApiRequests.mock.js +12 -11
- package/lib/module/api/adadaptedApiRequests.mock.js.map +1 -1
- package/lib/module/api/adadaptedApiTypes.js +6 -11
- package/lib/module/api/adadaptedApiTypes.js.map +1 -1
- package/lib/module/components/AdZone.js +21 -36
- package/lib/module/components/AdZone.js.map +1 -1
- package/lib/module/index.js +130 -159
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/module/util.js +4 -1
- package/lib/module/util.js.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -0
- package/package.json +12 -13
- package/src/components/AdZone.tsx +1 -1
- package/src/index.tsx +26 -5
package/android/.project
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
arguments=--init-script /var/folders/vw/1yz06gyj201f5y15zm_xv9gr0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/vw/1yz06gyj201f5y15zm_xv9gr0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
|
-
auto.sync=
|
|
2
|
+
auto.sync=true
|
|
3
3
|
build.scans.enabled=false
|
|
4
4
|
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.4.2))
|
|
5
|
-
connection.project.dir
|
|
5
|
+
connection.project.dir=
|
|
6
6
|
eclipse.preferences.version=1
|
|
7
7
|
gradle.user.home=
|
|
8
8
|
java.home=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>adadaptedreactnativesdk</name>
|
|
4
|
+
<comment>Project android_ created by Buildship.</comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
<buildCommand>
|
|
14
|
+
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
|
15
|
+
<arguments>
|
|
16
|
+
</arguments>
|
|
17
|
+
</buildCommand>
|
|
18
|
+
</buildSpec>
|
|
19
|
+
<natures>
|
|
20
|
+
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
21
|
+
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
|
22
|
+
</natures>
|
|
23
|
+
<filteredResources>
|
|
24
|
+
<filter>
|
|
25
|
+
<id>0</id>
|
|
26
|
+
<name></name>
|
|
27
|
+
<type>30</type>
|
|
28
|
+
<matcher>
|
|
29
|
+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
|
30
|
+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
|
31
|
+
</matcher>
|
|
32
|
+
</filter>
|
|
33
|
+
</filteredResources>
|
|
34
|
+
</projectDescription>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
arguments=--init-script /var/folders/vw/1yz06gyj201f5y15zm_xv9gr0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/vw/1yz06gyj201f5y15zm_xv9gr0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
|
|
2
|
+
auto.sync=false
|
|
3
|
+
build.scans.enabled=false
|
|
4
|
+
connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.4.2))
|
|
5
|
+
connection.project.dir=../example/android
|
|
6
|
+
eclipse.preferences.version=1
|
|
7
|
+
gradle.user.home=
|
|
8
|
+
java.home=/Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
|
|
9
|
+
jvm.arguments=
|
|
10
|
+
offline.mode=false
|
|
11
|
+
override.workspace.settings=true
|
|
12
|
+
show.console.view=true
|
|
13
|
+
show.executions.view=true
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['AdadaptedReactNativeSdk_kotlinVersion']
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
jcenter()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath 'com.android.tools.build:gradle:3.2.1'
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
apply plugin: 'com.android.library'
|
|
18
|
+
apply plugin: 'kotlin-android'
|
|
19
|
+
|
|
20
|
+
def getExtOrDefault(name) {
|
|
21
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['AdadaptedReactNativeSdk_' + name]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['AdadaptedReactNativeSdk_' + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
android {
|
|
29
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
30
|
+
buildToolsVersion getExtOrDefault('buildToolsVersion')
|
|
31
|
+
defaultConfig {
|
|
32
|
+
minSdkVersion 21
|
|
33
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
34
|
+
versionCode 1
|
|
35
|
+
versionName "1.0"
|
|
36
|
+
}
|
|
37
|
+
buildTypes {
|
|
38
|
+
release {
|
|
39
|
+
minifyEnabled false
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
lintOptions {
|
|
43
|
+
disable 'GradleCompatible'
|
|
44
|
+
}
|
|
45
|
+
compileOptions {
|
|
46
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
47
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
repositories {
|
|
52
|
+
mavenCentral()
|
|
53
|
+
jcenter()
|
|
54
|
+
google()
|
|
55
|
+
|
|
56
|
+
def found = false
|
|
57
|
+
def defaultDir = null
|
|
58
|
+
def androidSourcesName = 'React Native sources'
|
|
59
|
+
|
|
60
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
61
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
62
|
+
} else {
|
|
63
|
+
defaultDir = new File(
|
|
64
|
+
projectDir,
|
|
65
|
+
'/../../../node_modules/react-native/android'
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (defaultDir.exists()) {
|
|
70
|
+
maven {
|
|
71
|
+
url defaultDir.toString()
|
|
72
|
+
name androidSourcesName
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
76
|
+
found = true
|
|
77
|
+
} else {
|
|
78
|
+
def parentDir = rootProject.projectDir
|
|
79
|
+
|
|
80
|
+
1.upto(5, {
|
|
81
|
+
if (found) return true
|
|
82
|
+
parentDir = parentDir.parentFile
|
|
83
|
+
|
|
84
|
+
def androidSourcesDir = new File(
|
|
85
|
+
parentDir,
|
|
86
|
+
'node_modules/react-native'
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def androidPrebuiltBinaryDir = new File(
|
|
90
|
+
parentDir,
|
|
91
|
+
'node_modules/react-native/android'
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
95
|
+
maven {
|
|
96
|
+
url androidPrebuiltBinaryDir.toString()
|
|
97
|
+
name androidSourcesName
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
101
|
+
found = true
|
|
102
|
+
} else if (androidSourcesDir.exists()) {
|
|
103
|
+
maven {
|
|
104
|
+
url androidSourcesDir.toString()
|
|
105
|
+
name androidSourcesName
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
109
|
+
found = true
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!found) {
|
|
115
|
+
throw new GradleException(
|
|
116
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
117
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
123
|
+
|
|
124
|
+
dependencies {
|
|
125
|
+
// noinspection GradleDynamicVersion
|
|
126
|
+
api 'com.facebook.react:react-native:+'
|
|
127
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
128
|
+
|
|
129
|
+
implementation 'com.google.android.gms:play-services-ads:12.0.1'
|
|
130
|
+
}
|
package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkModule.kt
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// See https://facebook.github.io/react-native/docs/native-modules-android
|
|
2
|
+
package com.adadaptedreactnativesdk;
|
|
3
|
+
|
|
4
|
+
import android.content.pm.PackageInfo;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.util.DisplayMetrics;
|
|
7
|
+
import android.util.Log;
|
|
8
|
+
import org.json.*;
|
|
9
|
+
import java.io.IOException;
|
|
10
|
+
import java.util.Locale;
|
|
11
|
+
import java.util.TimeZone;
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
14
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
15
|
+
import com.facebook.react.bridge.Promise;
|
|
16
|
+
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
|
|
17
|
+
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
|
|
18
|
+
import com.google.android.gms.common.GooglePlayServicesRepairableException;
|
|
19
|
+
import android.telephony.TelephonyManager;
|
|
20
|
+
import android.content.Context;
|
|
21
|
+
|
|
22
|
+
class AdadaptedReactNativeSdkModule(val _reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(_reactContext) {
|
|
23
|
+
val reactContext = _reactContext;
|
|
24
|
+
|
|
25
|
+
val TAG: String = "ReactNative";
|
|
26
|
+
val UNKNOWN_VALUE: String = "Unknown";
|
|
27
|
+
|
|
28
|
+
override fun getName(): String {
|
|
29
|
+
return "AdadaptedReactNativeSdk";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@ReactMethod
|
|
33
|
+
fun getDeviceInfo(promise: Promise) {
|
|
34
|
+
val deviceDisplayMetrics: DisplayMetrics = reactContext.getResources().getDisplayMetrics();
|
|
35
|
+
var gaidInfo: AdvertisingIdClient.Info? = null;
|
|
36
|
+
var bundleVersion: String = UNKNOWN_VALUE;
|
|
37
|
+
var deviceCarrier: String = "n/a";
|
|
38
|
+
var deviceWidth: Int = 0;
|
|
39
|
+
var deviceHeight: Int = 0;
|
|
40
|
+
var deviceDensity: String = "";
|
|
41
|
+
var gaid: String = "";
|
|
42
|
+
var adTrackingEnabled: Boolean = false;
|
|
43
|
+
|
|
44
|
+
val mTelephonyMgr: TelephonyManager = reactContext.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager;
|
|
45
|
+
|
|
46
|
+
if (mTelephonyMgr != null && mTelephonyMgr.getNetworkOperatorName() != null) {
|
|
47
|
+
deviceCarrier = mTelephonyMgr.getNetworkOperatorName();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
gaidInfo = AdvertisingIdClient.getAdvertisingIdInfo(reactContext);
|
|
52
|
+
}
|
|
53
|
+
catch (ex: GooglePlayServicesNotAvailableException) {
|
|
54
|
+
logGaidException();
|
|
55
|
+
}
|
|
56
|
+
catch (ex: GooglePlayServicesRepairableException) {
|
|
57
|
+
logGaidException();
|
|
58
|
+
}
|
|
59
|
+
catch (ex: IOException) {
|
|
60
|
+
logGaidException();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
val packageInfo: PackageInfo = reactContext.getPackageManager().getPackageInfo(reactContext.getPackageName(), 0);
|
|
65
|
+
|
|
66
|
+
if (packageInfo != null) {
|
|
67
|
+
bundleVersion = packageInfo.versionName;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch(ex: PackageManager.NameNotFoundException) {
|
|
71
|
+
bundleVersion = UNKNOWN_VALUE;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (gaidInfo != null) {
|
|
75
|
+
gaid = gaidInfo.getId();
|
|
76
|
+
adTrackingEnabled = !gaidInfo.isLimitAdTrackingEnabled();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (deviceDisplayMetrics != null) {
|
|
80
|
+
deviceWidth = deviceDisplayMetrics.widthPixels;
|
|
81
|
+
deviceHeight = deviceDisplayMetrics.heightPixels;
|
|
82
|
+
deviceDensity = deviceDisplayMetrics.density.toString();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Create the HashMap that will be turned into a final JSON result.
|
|
86
|
+
var finalDeviceData: HashMap<String, Any> = HashMap<String, Any>();
|
|
87
|
+
|
|
88
|
+
finalDeviceData.put("udid", gaid);
|
|
89
|
+
finalDeviceData.put("deviceName", android.os.Build.DEVICE);
|
|
90
|
+
finalDeviceData.put("systemName", "android");
|
|
91
|
+
finalDeviceData.put("systemVersion", android.os.Build.VERSION.RELEASE);
|
|
92
|
+
finalDeviceData.put("deviceCarrier", deviceCarrier);
|
|
93
|
+
finalDeviceData.put("deviceModel", android.os.Build.MODEL);
|
|
94
|
+
finalDeviceData.put("deviceWidth", deviceWidth);
|
|
95
|
+
finalDeviceData.put("deviceHeight", deviceHeight);
|
|
96
|
+
finalDeviceData.put("deviceScreenDensity", deviceDensity);
|
|
97
|
+
finalDeviceData.put("deviceLocale", Locale.getDefault().toString());
|
|
98
|
+
finalDeviceData.put("bundleId", reactContext.getPackageName());
|
|
99
|
+
finalDeviceData.put("bundleVersion", bundleVersion);
|
|
100
|
+
finalDeviceData.put("deviceTimezone", TimeZone.getDefault().getID());
|
|
101
|
+
finalDeviceData.put("isAdTrackingEnabled", adTrackingEnabled);
|
|
102
|
+
|
|
103
|
+
promise.resolve(JSONObject(finalDeviceData as Map<*, *>?).toString());
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
fun logGaidException() {
|
|
107
|
+
Log.w(TAG, "Problem retrieving Google Play Advertiser Info");
|
|
108
|
+
Log.w(TAG, "GAID_UNAVAILABLE");
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@ReactMethod
|
|
112
|
+
fun storeCurrentSessionId(sessionId: String) {
|
|
113
|
+
// noop
|
|
114
|
+
}
|
|
115
|
+
}
|
package/android/bin/src/main/java/com/adadaptedreactnativesdk/AdadaptedReactNativeSdkPackage.kt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.adadaptedreactnativesdk
|
|
2
|
+
|
|
3
|
+
import java.util.Arrays
|
|
4
|
+
import java.util.Collections
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.ReactPackage
|
|
7
|
+
import com.facebook.react.bridge.NativeModule
|
|
8
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
9
|
+
import com.facebook.react.uimanager.ViewManager
|
|
10
|
+
import com.facebook.react.bridge.JavaScriptModule
|
|
11
|
+
|
|
12
|
+
class AdadaptedReactNativeSdkPackage : ReactPackage {
|
|
13
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
14
|
+
return Arrays.asList<NativeModule>(AdadaptedReactNativeSdkModule(reactContext))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
18
|
+
return emptyList<ViewManager<*, *>>()
|
|
19
|
+
}
|
|
20
|
+
}
|
package/android/build.gradle
CHANGED
|
@@ -29,7 +29,7 @@ android {
|
|
|
29
29
|
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
30
30
|
buildToolsVersion getExtOrDefault('buildToolsVersion')
|
|
31
31
|
defaultConfig {
|
|
32
|
-
minSdkVersion
|
|
32
|
+
minSdkVersion 21
|
|
33
33
|
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
34
34
|
versionCode 1
|
|
35
35
|
versionName "1.0"
|
|
@@ -3,27 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getKeywordIntercepts = getKeywordIntercepts;
|
|
6
7
|
exports.initializeSession = initializeSession;
|
|
7
8
|
exports.refreshSessionData = refreshSessionData;
|
|
8
9
|
exports.reportAdEvent = reportAdEvent;
|
|
9
|
-
exports.getKeywordIntercepts = getKeywordIntercepts;
|
|
10
10
|
exports.reportInterceptEvent = reportInterceptEvent;
|
|
11
11
|
exports.reportListManagerEvents = reportListManagerEvents;
|
|
12
12
|
exports.reportPayloadContentStatus = reportPayloadContentStatus;
|
|
13
13
|
exports.retrievePayloadContent = retrievePayloadContent;
|
|
14
|
-
|
|
15
14
|
var _axios = _interopRequireDefault(require("axios"));
|
|
16
|
-
|
|
17
15
|
var adadaptedApiRequestMocks = _interopRequireWildcard(require("./adadaptedApiRequests.mock"));
|
|
18
|
-
|
|
19
16
|
var _index = require("../index");
|
|
20
|
-
|
|
21
|
-
function
|
|
22
|
-
|
|
23
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
-
|
|
17
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
26
|
-
|
|
27
20
|
/**
|
|
28
21
|
* API requests focused around Settings.
|
|
29
22
|
*/
|
|
@@ -44,6 +37,7 @@ function initializeSession(requestData, deviceOS, apiEnv) {
|
|
|
44
37
|
}
|
|
45
38
|
});
|
|
46
39
|
}
|
|
40
|
+
|
|
47
41
|
/**
|
|
48
42
|
* Makes an API request to refresh the session data.
|
|
49
43
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -52,8 +46,6 @@ function initializeSession(requestData, deviceOS, apiEnv) {
|
|
|
52
46
|
* @param apiEnv - The API environment to use when making the API request.
|
|
53
47
|
* @returns a promise containing the response data.
|
|
54
48
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
49
|
function refreshSessionData(requestData, deviceOS, apiEnv) {
|
|
58
50
|
return apiEnv === _index.ApiEnv.Mock ? adadaptedApiRequestMocks.refreshSessionData() : (0, _axios.default)(`${apiEnv}/v/0.9.5/${deviceOS}/ads/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`, {
|
|
59
51
|
method: "GET",
|
|
@@ -62,6 +54,7 @@ function refreshSessionData(requestData, deviceOS, apiEnv) {
|
|
|
62
54
|
}
|
|
63
55
|
});
|
|
64
56
|
}
|
|
57
|
+
|
|
65
58
|
/**
|
|
66
59
|
* Makes an API request to report an ad event that has occurred.
|
|
67
60
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -70,8 +63,6 @@ function refreshSessionData(requestData, deviceOS, apiEnv) {
|
|
|
70
63
|
* @param apiEnv - The API environment to use when making the API request.
|
|
71
64
|
* @returns a promise containing the response data.
|
|
72
65
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
75
66
|
function reportAdEvent(requestData, deviceOS, apiEnv) {
|
|
76
67
|
return apiEnv === _index.ApiEnv.Mock ? adadaptedApiRequestMocks.reportAdEvent() : (0, _axios.default)(`${apiEnv}/v/0.9.5/${deviceOS}/ads/events`, {
|
|
77
68
|
method: "POST",
|
|
@@ -81,6 +72,7 @@ function reportAdEvent(requestData, deviceOS, apiEnv) {
|
|
|
81
72
|
}
|
|
82
73
|
});
|
|
83
74
|
}
|
|
75
|
+
|
|
84
76
|
/**
|
|
85
77
|
* Makes an API request to get all possible keyword intercepts for the session.
|
|
86
78
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -89,8 +81,6 @@ function reportAdEvent(requestData, deviceOS, apiEnv) {
|
|
|
89
81
|
* @param apiEnv - The API environment to use when making the API request.
|
|
90
82
|
* @returns a promise containing the response data.
|
|
91
83
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
84
|
function getKeywordIntercepts(requestData, deviceOS, apiEnv) {
|
|
95
85
|
return apiEnv === _index.ApiEnv.Mock ? adadaptedApiRequestMocks.getKeywordIntercepts() : (0, _axios.default)(`${apiEnv}/v/0.9.5/${deviceOS}/intercepts/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`, {
|
|
96
86
|
method: "GET",
|
|
@@ -99,6 +89,7 @@ function getKeywordIntercepts(requestData, deviceOS, apiEnv) {
|
|
|
99
89
|
}
|
|
100
90
|
});
|
|
101
91
|
}
|
|
92
|
+
|
|
102
93
|
/**
|
|
103
94
|
* Makes an API request to report an intercept event that has occurred.
|
|
104
95
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -107,8 +98,6 @@ function getKeywordIntercepts(requestData, deviceOS, apiEnv) {
|
|
|
107
98
|
* @param apiEnv - The API environment to use when making the API request.
|
|
108
99
|
* @returns a promise containing the response data.
|
|
109
100
|
*/
|
|
110
|
-
|
|
111
|
-
|
|
112
101
|
function reportInterceptEvent(requestData, deviceOS, apiEnv) {
|
|
113
102
|
return apiEnv === _index.ApiEnv.Mock ? adadaptedApiRequestMocks.reportInterceptEvent() : (0, _axios.default)(`${apiEnv}/v/0.9.5/${deviceOS}/intercepts/events`, {
|
|
114
103
|
method: "POST",
|
|
@@ -118,6 +107,7 @@ function reportInterceptEvent(requestData, deviceOS, apiEnv) {
|
|
|
118
107
|
}
|
|
119
108
|
});
|
|
120
109
|
}
|
|
110
|
+
|
|
121
111
|
/**
|
|
122
112
|
* Makes an API request to report List Manager events.
|
|
123
113
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -126,8 +116,6 @@ function reportInterceptEvent(requestData, deviceOS, apiEnv) {
|
|
|
126
116
|
* @param apiEnv - The API environment to use when making the API request.
|
|
127
117
|
* @returns a promise containing the response data.
|
|
128
118
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
119
|
function reportListManagerEvents(requestData, deviceOS, apiEnv) {
|
|
132
120
|
return apiEnv === _index.ListManagerApiEnv.Mock ? adadaptedApiRequestMocks.reportListManagerEvents() : (0, _axios.default)(`${apiEnv}/v/1/${deviceOS}/events`, {
|
|
133
121
|
method: "POST",
|
|
@@ -137,6 +125,7 @@ function reportListManagerEvents(requestData, deviceOS, apiEnv) {
|
|
|
137
125
|
}
|
|
138
126
|
});
|
|
139
127
|
}
|
|
128
|
+
|
|
140
129
|
/**
|
|
141
130
|
* Makes an API request to report the results of the
|
|
142
131
|
* "out of app" add to list payload received.
|
|
@@ -145,8 +134,6 @@ function reportListManagerEvents(requestData, deviceOS, apiEnv) {
|
|
|
145
134
|
* @param apiEnv - The API environment to use when making the API request.
|
|
146
135
|
* @returns a promise containing the response data.
|
|
147
136
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
137
|
function reportPayloadContentStatus(requestData, apiEnv) {
|
|
151
138
|
return apiEnv === _index.PayloadApiEnv.Mock ? adadaptedApiRequestMocks.reportPayloadContentStatus() : (0, _axios.default)(`${apiEnv}/v/1/tracking`, {
|
|
152
139
|
method: "POST",
|
|
@@ -156,6 +143,7 @@ function reportPayloadContentStatus(requestData, apiEnv) {
|
|
|
156
143
|
}
|
|
157
144
|
});
|
|
158
145
|
}
|
|
146
|
+
|
|
159
147
|
/**
|
|
160
148
|
* Makes an API request to get all outstanding add to list payloads for a given user.
|
|
161
149
|
* A valid session is required for this API endpoint to respond successfully.
|
|
@@ -163,8 +151,6 @@ function reportPayloadContentStatus(requestData, apiEnv) {
|
|
|
163
151
|
* @param apiEnv - The API environment to use when making the API request.
|
|
164
152
|
* @returns a promise containing the response data.
|
|
165
153
|
*/
|
|
166
|
-
|
|
167
|
-
|
|
168
154
|
function retrievePayloadContent(requestData, apiEnv) {
|
|
169
155
|
return apiEnv === _index.PayloadApiEnv.Mock ? adadaptedApiRequestMocks.retrievePayloadContent() : (0, _axios.default)(`${apiEnv}/v/1/pickup`, {
|
|
170
156
|
method: "POST",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["adadaptedApiRequests.ts"],"names":["initializeSession","requestData","deviceOS","apiEnv","ApiEnv","Mock","adadaptedApiRequestMocks","method","data","headers","accept","refreshSessionData","aid","sid","uid","reportAdEvent","getKeywordIntercepts","reportInterceptEvent","reportListManagerEvents","ListManagerApiEnv","reportPayloadContentStatus","PayloadApiEnv","retrievePayloadContent"],"mappings":";;;;;;;;;;;;;;AAmBA;;AACA;;AACA;;;;;;;;AArBA;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAT,CACHC,WADG,EAEHC,QAFG,EAGHC,MAHG,EAI8C;AACjD,SAAOA,MAAM,KAAKC,cAAOC,IAAlB,GACDC,wBAAwB,CAACN,iBAAzB,EADC,GAED,oBAAO,GAAEG,MAAO,YAAWD,QAAS,sBAApC,EAA2D;AACvDK,IAAAA,MAAM,EAAE,MAD+C;AAEvDC,IAAAA,IAAI,EAAEP,WAFiD;AAGvDQ,IAAAA,OAAO,EAAE;AACLC,MAAAA,MAAM,EAAE;AADH;AAH8C,GAA3D,CAFN;AASH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CACHV,WADG,EAEHC,QAFG,EAGHC,MAHG,EAI+C;AAClD,SAAOA,MAAM,KAAKC,cAAOC,IAAlB,GACDC,wBAAwB,CAACK,kBAAzB,EADC,GAED,oBACK,GAAER,MAAO,YAAWD,QAAS,qBAAoBD,WAAW,CAACW,GAAI,QAAOX,WAAW,CAACY,GAAI,QAAOZ,WAAW,CAACa,GAAI,EADpH,EAEI;AACIP,IAAAA,MAAM,EAAE,KADZ;AAEIE,IAAAA,OAAO,EAAE;AACLC,MAAAA,MAAM,EAAE;AADH;AAFb,GAFJ,CAFN;AAWH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,aAAT,CACHd,WADG,EAEHC,QAFG,EAGHC,MAHG,EAI0C;AAC7C,SAAOA,MAAM,KAAKC,cAAOC,IAAlB,GACDC,wBAAwB,CAACS,aAAzB,EADC,GAED,oBAAO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,EAA0C;AACtCK,IAAAA,MAAM,EAAE,MAD8B;AAEtCC,IAAAA,IAAI,EAAEP,WAFgC;AAGtCQ,IAAAA,OAAO,EAAE;AACLC,MAAAA,MAAM,EAAE;AADH;AAH6B,GAA1C,CAFN;AASH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASU,0BAAT,CACHnB,WADG,EAEHE,MAFG,EAGyB;AAC5B,SAAOA,MAAM,KAAKkB,qBAAchB,IAAzB,GACDC,wBAAwB,CAACc,0BAAzB,EADC,GAED,oBAAO,GAAEjB,MAAO,eAAhB,EAAgC;AAC5BI,IAAAA,MAAM,EAAE,MADoB;AAE5BC,IAAAA,IAAI,EAAEP,WAFsB;AAG5BQ,IAAAA,OAAO,EAAE;AACLC,MAAAA,MAAM,EAAE;AADH;AAHmB,GAAhC,CAFN;AASH;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASY,sBAAT,CACHrB,WADG,EAEHE,MAFG,EAGoD;AACvD,SAAOA,MAAM,KAAKkB,qBAAchB,IAAzB,GACDC,wBAAwB,CAACgB,sBAAzB,EADC,GAED,oBAAO,GAAEnB,MAAO,aAAhB,EAA8B;AAC1BI,IAAAA,MAAM,EAAE,MADkB;AAE1BC,IAAAA,IAAI,EAAEP,WAFoB;AAG1BQ,IAAAA,OAAO,EAAE;AACLC,MAAAA,MAAM,EAAE;AADH;AAHiB,GAA9B,CAFN;AASH","sourcesContent":["/**\n * API requests focused around Settings.\n */\nimport {\n InitializeSessionRequest,\n InitializeSessionResponse,\n KeywordInterceptsRequest,\n KeywordInterceptsResponse,\n RefreshSessionDataRequest,\n RefreshSessionDataResponse,\n ReportAdEventRequest,\n ReportAdEventResponse,\n ReportInterceptEventRequest,\n ReportInterceptEventResponse,\n ReportListManagerDataRequest,\n ReportPayloadDataRequest,\n RetrievePayloadItemDataRequest,\n RetrievePayloadItemDataResponse,\n} from \"./adadaptedApiTypes\";\nimport axios, { AxiosResponse } from \"axios\";\nimport * as adadaptedApiRequestMocks from \"./adadaptedApiRequests.mock\";\nimport { ApiEnv, DeviceOS, ListManagerApiEnv, PayloadApiEnv } from \"../index\";\n\n/**\n * Makes an API request to initialize the session for the AdAdapted API.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function initializeSession(\n requestData: InitializeSessionRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<InitializeSessionResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.initializeSession()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/sessions/initialize`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to refresh the session data.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function refreshSessionData(\n requestData: RefreshSessionDataRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<RefreshSessionDataResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.refreshSessionData()\n : axios(\n `${apiEnv}/v/0.9.5/${deviceOS}/ads/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`,\n {\n method: \"GET\",\n headers: {\n accept: \"application/json\",\n },\n }\n );\n}\n\n/**\n * Makes an API request to report an ad event that has occurred.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportAdEvent(\n requestData: ReportAdEventRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<ReportAdEventResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.reportAdEvent()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/ads/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to get all possible keyword intercepts for the session.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function getKeywordIntercepts(\n requestData: KeywordInterceptsRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<KeywordInterceptsResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.getKeywordIntercepts()\n : axios(\n `${apiEnv}/v/0.9.5/${deviceOS}/intercepts/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`,\n {\n method: \"GET\",\n headers: {\n accept: \"application/json\",\n },\n }\n );\n}\n\n/**\n * Makes an API request to report an intercept event that has occurred.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportInterceptEvent(\n requestData: ReportInterceptEventRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<ReportInterceptEventResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.reportInterceptEvent()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/intercepts/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to report List Manager events.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportListManagerEvents(\n requestData: ReportListManagerDataRequest,\n deviceOS: DeviceOS,\n apiEnv: ListManagerApiEnv\n): Promise<AxiosResponse<void>> {\n return apiEnv === ListManagerApiEnv.Mock\n ? adadaptedApiRequestMocks.reportListManagerEvents()\n : axios(`${apiEnv}/v/1/${deviceOS}/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to report the results of the\n * \"out of app\" add to list payload received.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportPayloadContentStatus(\n requestData: ReportPayloadDataRequest,\n apiEnv: PayloadApiEnv\n): Promise<AxiosResponse<void>> {\n return apiEnv === PayloadApiEnv.Mock\n ? adadaptedApiRequestMocks.reportPayloadContentStatus()\n : axios(`${apiEnv}/v/1/tracking`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to get all outstanding add to list payloads for a given user.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function retrievePayloadContent(\n requestData: RetrievePayloadItemDataRequest,\n apiEnv: PayloadApiEnv\n): Promise<AxiosResponse<RetrievePayloadItemDataResponse>> {\n return apiEnv === PayloadApiEnv.Mock\n ? adadaptedApiRequestMocks.retrievePayloadContent()\n : axios(`${apiEnv}/v/1/pickup`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n"]}
|
|
1
|
+
{"version":3,"names":["initializeSession","requestData","deviceOS","apiEnv","ApiEnv","Mock","adadaptedApiRequestMocks","axios","method","data","headers","accept","refreshSessionData","aid","sid","uid","reportAdEvent","getKeywordIntercepts","reportInterceptEvent","reportListManagerEvents","ListManagerApiEnv","reportPayloadContentStatus","PayloadApiEnv","retrievePayloadContent"],"sources":["adadaptedApiRequests.ts"],"sourcesContent":["/**\n * API requests focused around Settings.\n */\nimport {\n InitializeSessionRequest,\n InitializeSessionResponse,\n KeywordInterceptsRequest,\n KeywordInterceptsResponse,\n RefreshSessionDataRequest,\n RefreshSessionDataResponse,\n ReportAdEventRequest,\n ReportAdEventResponse,\n ReportInterceptEventRequest,\n ReportInterceptEventResponse,\n ReportListManagerDataRequest,\n ReportPayloadDataRequest,\n RetrievePayloadItemDataRequest,\n RetrievePayloadItemDataResponse,\n} from \"./adadaptedApiTypes\";\nimport axios, { AxiosResponse } from \"axios\";\nimport * as adadaptedApiRequestMocks from \"./adadaptedApiRequests.mock\";\nimport { ApiEnv, DeviceOS, ListManagerApiEnv, PayloadApiEnv } from \"../index\";\n\n/**\n * Makes an API request to initialize the session for the AdAdapted API.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function initializeSession(\n requestData: InitializeSessionRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<InitializeSessionResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.initializeSession()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/sessions/initialize`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to refresh the session data.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function refreshSessionData(\n requestData: RefreshSessionDataRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<RefreshSessionDataResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.refreshSessionData()\n : axios(\n `${apiEnv}/v/0.9.5/${deviceOS}/ads/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`,\n {\n method: \"GET\",\n headers: {\n accept: \"application/json\",\n },\n }\n );\n}\n\n/**\n * Makes an API request to report an ad event that has occurred.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportAdEvent(\n requestData: ReportAdEventRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<ReportAdEventResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.reportAdEvent()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/ads/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to get all possible keyword intercepts for the session.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function getKeywordIntercepts(\n requestData: KeywordInterceptsRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<KeywordInterceptsResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.getKeywordIntercepts()\n : axios(\n `${apiEnv}/v/0.9.5/${deviceOS}/intercepts/retrieve?aid=${requestData.aid}&sid=${requestData.sid}&uid=${requestData.uid}`,\n {\n method: \"GET\",\n headers: {\n accept: \"application/json\",\n },\n }\n );\n}\n\n/**\n * Makes an API request to report an intercept event that has occurred.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportInterceptEvent(\n requestData: ReportInterceptEventRequest,\n deviceOS: DeviceOS,\n apiEnv: ApiEnv\n): Promise<AxiosResponse<ReportInterceptEventResponse>> {\n return apiEnv === ApiEnv.Mock\n ? adadaptedApiRequestMocks.reportInterceptEvent()\n : axios(`${apiEnv}/v/0.9.5/${deviceOS}/intercepts/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to report List Manager events.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param deviceOS - The operating system being ran on the device.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportListManagerEvents(\n requestData: ReportListManagerDataRequest,\n deviceOS: DeviceOS,\n apiEnv: ListManagerApiEnv\n): Promise<AxiosResponse<void>> {\n return apiEnv === ListManagerApiEnv.Mock\n ? adadaptedApiRequestMocks.reportListManagerEvents()\n : axios(`${apiEnv}/v/1/${deviceOS}/events`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to report the results of the\n * \"out of app\" add to list payload received.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function reportPayloadContentStatus(\n requestData: ReportPayloadDataRequest,\n apiEnv: PayloadApiEnv\n): Promise<AxiosResponse<void>> {\n return apiEnv === PayloadApiEnv.Mock\n ? adadaptedApiRequestMocks.reportPayloadContentStatus()\n : axios(`${apiEnv}/v/1/tracking`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n\n/**\n * Makes an API request to get all outstanding add to list payloads for a given user.\n * A valid session is required for this API endpoint to respond successfully.\n * @param requestData - The data to be sent with the request.\n * @param apiEnv - The API environment to use when making the API request.\n * @returns a promise containing the response data.\n */\nexport function retrievePayloadContent(\n requestData: RetrievePayloadItemDataRequest,\n apiEnv: PayloadApiEnv\n): Promise<AxiosResponse<RetrievePayloadItemDataResponse>> {\n return apiEnv === PayloadApiEnv.Mock\n ? adadaptedApiRequestMocks.retrievePayloadContent()\n : axios(`${apiEnv}/v/1/pickup`, {\n method: \"POST\",\n data: requestData,\n headers: {\n accept: \"application/json\",\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA;AACA;AACA;AAA8E;AAAA;AAAA;AArB9E;AACA;AACA;;AAqBA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,iBAAiB,CAC7BC,WAAqC,EACrCC,QAAkB,EAClBC,MAAc,EACmC;EACjD,OAAOA,MAAM,KAAKC,aAAM,CAACC,IAAI,GACvBC,wBAAwB,CAACN,iBAAiB,EAAE,GAC5C,IAAAO,cAAK,EAAE,GAAEJ,MAAO,YAAWD,QAAS,sBAAqB,EAAE;IACvDM,MAAM,EAAE,MAAM;IACdC,IAAI,EAAER,WAAW;IACjBS,OAAO,EAAE;MACLC,MAAM,EAAE;IACZ;EACJ,CAAC,CAAC;AACZ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkB,CAC9BX,WAAsC,EACtCC,QAAkB,EAClBC,MAAc,EACoC;EAClD,OAAOA,MAAM,KAAKC,aAAM,CAACC,IAAI,GACvBC,wBAAwB,CAACM,kBAAkB,EAAE,GAC7C,IAAAL,cAAK,EACA,GAAEJ,MAAO,YAAWD,QAAS,qBAAoBD,WAAW,CAACY,GAAI,QAAOZ,WAAW,CAACa,GAAI,QAAOb,WAAW,CAACc,GAAI,EAAC,EACjH;IACIP,MAAM,EAAE,KAAK;IACbE,OAAO,EAAE;MACLC,MAAM,EAAE;IACZ;EACJ,CAAC,CACJ;AACX;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,aAAa,CACzBf,WAAiC,EACjCC,QAAkB,EAClBC,MAAc,EAC+B;EAC7C,OAAOA,MAAM,KAAKC,aAAM,CAACC,IAAI,GACvBC,wBAAwB,CAACU,aAAa,EAAE,GACxC,IAAAT,cAAK,EAAE,GAAEJ,MAAO,YAAWD,Q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