@thealteroffice/react-native-adgeist 0.0.29-beta → 0.0.31-beta
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/build.gradle +1 -1
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +14 -9
- package/android/src/main/java/com/adgeist/utils/CreativeExtensions.kt +0 -34
- package/ios/AdgeistImpl.swift +16 -10
- package/lib/module/constants.js +1 -5
- package/lib/module/constants.js.map +1 -1
- package/lib/typescript/src/constants.d.ts +1 -3
- package/lib/typescript/src/constants.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +1 -4
package/android/build.gradle
CHANGED
|
@@ -113,7 +113,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
113
113
|
|
|
114
114
|
dependencies {
|
|
115
115
|
implementation "com.facebook.react:react-android"
|
|
116
|
-
implementation "ai.adgeist:adgeistkit:1.1.
|
|
116
|
+
implementation "ai.adgeist:adgeistkit:1.1.22-beta"
|
|
117
117
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
118
118
|
|
|
119
119
|
/*
|
|
@@ -5,6 +5,7 @@ import android.util.Log
|
|
|
5
5
|
import com.facebook.react.bridge.Promise
|
|
6
6
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
7
|
import com.adgeistkit.AdgeistCore
|
|
8
|
+
import com.adgeistkit.data.models.AdData
|
|
8
9
|
import com.adgeistkit.data.models.CPMAdResponse
|
|
9
10
|
import com.adgeistkit.data.models.Event
|
|
10
11
|
import com.adgeistkit.data.models.FixedAdResponse
|
|
@@ -41,16 +42,20 @@ class AdgeistImpl internal constructor(private val context: ReactApplicationCont
|
|
|
41
42
|
fun fetchCreative(adSpaceId: String, buyType: String, isTestEnvironment: Boolean, promise: Promise) {
|
|
42
43
|
getAd?.fetchCreative(adSpaceId, buyType, isTestEnvironment) { adData ->
|
|
43
44
|
if (adData != null) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
if (adData.isSuccess && adData.data != null) {
|
|
46
|
+
when (val response = adData.data) {
|
|
47
|
+
is CPMAdResponse -> {
|
|
48
|
+
promise.resolve(response.toWritableMap())
|
|
49
|
+
}
|
|
50
|
+
is FixedAdResponse -> {
|
|
51
|
+
promise.resolve(response.toWritableMap())
|
|
52
|
+
}
|
|
53
|
+
else -> {
|
|
54
|
+
promise.reject("UNKNOWN_RESPONSE", "Unknown ad response type")
|
|
55
|
+
}
|
|
53
56
|
}
|
|
57
|
+
} else {
|
|
58
|
+
promise.reject("AD_ERROR", adData.errorMessage)
|
|
54
59
|
}
|
|
55
60
|
} else {
|
|
56
61
|
promise.reject("NO_AD", "Ad data not available")
|
|
@@ -79,40 +79,6 @@ fun FixedAdResponse.toWritableMap(): WritableMap {
|
|
|
79
79
|
map.putMap("campaignValidity", cvMap)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
val creativesArr = Arguments.createArray()
|
|
83
|
-
creatives.forEach { creative ->
|
|
84
|
-
val cMap = Arguments.createMap()
|
|
85
|
-
cMap.putString("ctaUrl", creative.ctaUrl)
|
|
86
|
-
cMap.putString("description", creative.description)
|
|
87
|
-
cMap.putString("fileName", creative.fileName)
|
|
88
|
-
cMap.putInt("fileSize", creative.fileSize ?: 0)
|
|
89
|
-
cMap.putString("fileUrl", creative.fileUrl)
|
|
90
|
-
cMap.putString("thumbnailUrl", creative.thumbnailUrl)
|
|
91
|
-
cMap.putString("title", creative.title)
|
|
92
|
-
cMap.putString("type", creative.type)
|
|
93
|
-
|
|
94
|
-
creative.contentModerationResult?.let {
|
|
95
|
-
val cm = Arguments.createMap()
|
|
96
|
-
cm.putString("\$oid", it.`$oid`)
|
|
97
|
-
cMap.putMap("contentModerationResult", cm)
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
creative.createdAt?.let {
|
|
101
|
-
val cm = Arguments.createMap()
|
|
102
|
-
cm.putDouble("\$date", it.`$date`?.toDouble() ?: 0.0)
|
|
103
|
-
cMap.putMap("createdAt", cm)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
creative.updatedAt?.let {
|
|
107
|
-
val cm = Arguments.createMap()
|
|
108
|
-
cm.putDouble("\$date", it.`$date`?.toDouble() ?: 0.0)
|
|
109
|
-
cMap.putMap("updatedAt", cm)
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
creativesArr.pushMap(cMap)
|
|
113
|
-
}
|
|
114
|
-
map.putArray("creatives", creativesArr)
|
|
115
|
-
|
|
116
82
|
val creativesV1Arr = Arguments.createArray()
|
|
117
83
|
creativesV1.forEach { creativeV1 ->
|
|
118
84
|
val cv1Map = Arguments.createMap()
|
package/ios/AdgeistImpl.swift
CHANGED
|
@@ -52,18 +52,24 @@ import React
|
|
|
52
52
|
adUnitID: adSpaceId,
|
|
53
53
|
buyType: buyType,
|
|
54
54
|
isTestEnvironment: isTestEnvironment
|
|
55
|
-
) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
) { adData in
|
|
56
|
+
// Check if the request was successful
|
|
57
|
+
if adData.isSuccess, let creativeData = adData.data {
|
|
58
|
+
var result: [String: Any] = [:]
|
|
59
|
+
|
|
60
|
+
// Use Mirror to reflect the object's properties
|
|
61
|
+
let mirror = Mirror(reflecting: creativeData)
|
|
62
|
+
for child in mirror.children {
|
|
63
|
+
if let label = child.label {
|
|
64
|
+
result[label] = child.value
|
|
65
|
+
}
|
|
63
66
|
}
|
|
67
|
+
|
|
68
|
+
resolver(result)
|
|
69
|
+
} else {
|
|
70
|
+
// Return error from AdData
|
|
71
|
+
rejecter("AD_ERROR", adData.errorMessage, nil)
|
|
64
72
|
}
|
|
65
|
-
|
|
66
|
-
resolver(result)
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
|
package/lib/module/constants.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export const PACKAGE_VERSION_TAG = 'RN';
|
|
4
|
-
export const PACKAGE_VERSION = '0.0.
|
|
4
|
+
export const PACKAGE_VERSION = '0.0.31-beta';
|
|
5
5
|
export const AdSizes = {
|
|
6
|
-
custom: (width, height) => ({
|
|
7
|
-
width,
|
|
8
|
-
height
|
|
9
|
-
}),
|
|
10
6
|
Responsive: {
|
|
11
7
|
width: -1,
|
|
12
8
|
height: -1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PACKAGE_VERSION_TAG","PACKAGE_VERSION","AdSizes","
|
|
1
|
+
{"version":3,"names":["PACKAGE_VERSION_TAG","PACKAGE_VERSION","AdSizes","Responsive","width","height","HTML_5_AD_NATIVE_COMPONENT_NAME"],"sourceRoot":"../../src","sources":["constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,mBAAmB,GAAG,IAAI;AACvC,OAAO,MAAMC,eAAe,GAAG,aAAa;AAE5C,OAAO,MAAMC,OAAO,GAAG;EACrBC,UAAU,EAAE;IAAEC,KAAK,EAAE,CAAC,CAAC;IAAEC,MAAM,EAAE,CAAC;EAAE;AACtC,CAAC;AAED,OAAO,MAAMC,+BAA+B,GAAG,wBAAwB","ignoreList":[]}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import type { AdSize } from './types/AdSize';
|
|
2
1
|
export declare const PACKAGE_VERSION_TAG = "RN";
|
|
3
|
-
export declare const PACKAGE_VERSION = "0.0.
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.0.31-beta";
|
|
4
3
|
export declare const AdSizes: {
|
|
5
|
-
custom: (width: number, height: number) => AdSize;
|
|
6
4
|
Responsive: {
|
|
7
5
|
width: number;
|
|
8
6
|
height: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,eAAO,MAAM,OAAO;;;;;CAEnB,CAAC;AAEF,eAAO,MAAM,+BAA+B,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thealteroffice/react-native-adgeist",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31-beta",
|
|
4
4
|
"description": "Publishers can integrate our SDK to connect their ad spaces to the AdGeist marketplace.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
package/src/constants.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { AdSize } from './types/AdSize';
|
|
2
|
-
|
|
3
1
|
export const PACKAGE_VERSION_TAG = 'RN';
|
|
4
|
-
export const PACKAGE_VERSION = '0.0.
|
|
2
|
+
export const PACKAGE_VERSION = '0.0.31-beta';
|
|
5
3
|
|
|
6
4
|
export const AdSizes = {
|
|
7
|
-
custom: (width: number, height: number): AdSize => ({ width, height }),
|
|
8
5
|
Responsive: { width: -1, height: -1 },
|
|
9
6
|
};
|
|
10
7
|
|