react-native-nami-sdk 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/CI.yaml +6 -6
- package/.github/workflows/app_prod.yaml +10 -3
- package/.github/workflows/app_stg.yaml +18 -11
- package/android/build.gradle +21 -66
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +1 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +48 -6
- package/android/src/main/java/com/nami/reactlibrary/NamiPaywallManagerBridgeModule.kt +1 -1
- package/ios/Nami.m +1 -1
- package/ios/NamiCampaignManagerBridge.swift +47 -4
- package/ios/NamiPaywallManagerBridge.swift +2 -2
- package/package.json +6 -6
- package/react-native-nami-sdk.podspec +1 -1
- package/src/NamiCampaignManager.ts +2 -0
- package/src/types.d.ts +21 -0
- package/src/types.ts +22 -0
|
@@ -13,7 +13,7 @@ jobs:
|
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/setup-node@v3
|
|
15
15
|
with:
|
|
16
|
-
node-version: "
|
|
16
|
+
node-version: "18"
|
|
17
17
|
|
|
18
18
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
19
19
|
uses: actions/checkout@v3
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
steps:
|
|
40
40
|
- uses: actions/setup-node@v3
|
|
41
41
|
with:
|
|
42
|
-
node-version: "
|
|
42
|
+
node-version: "18"
|
|
43
43
|
|
|
44
44
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
45
45
|
uses: actions/checkout@v3
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
steps:
|
|
66
66
|
- uses: actions/setup-node@v3
|
|
67
67
|
with:
|
|
68
|
-
node-version: "
|
|
68
|
+
node-version: "18"
|
|
69
69
|
|
|
70
70
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
71
71
|
uses: actions/checkout@v3
|
|
@@ -98,7 +98,7 @@ jobs:
|
|
|
98
98
|
steps:
|
|
99
99
|
- uses: actions/setup-node@v3
|
|
100
100
|
with:
|
|
101
|
-
node-version:
|
|
101
|
+
node-version: 18
|
|
102
102
|
|
|
103
103
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
104
104
|
uses: actions/checkout@v3
|
|
@@ -200,7 +200,7 @@ jobs:
|
|
|
200
200
|
- name: Setup Node.js
|
|
201
201
|
uses: actions/setup-node@v3
|
|
202
202
|
with:
|
|
203
|
-
node-version: "
|
|
203
|
+
node-version: "18"
|
|
204
204
|
|
|
205
205
|
- name: Cache node_modules
|
|
206
206
|
uses: actions/cache@v3
|
|
@@ -218,7 +218,7 @@ jobs:
|
|
|
218
218
|
with:
|
|
219
219
|
cache: gradle
|
|
220
220
|
distribution: temurin
|
|
221
|
-
java-version:
|
|
221
|
+
java-version: 17
|
|
222
222
|
|
|
223
223
|
- name: Update App Platform ID
|
|
224
224
|
working-directory: source/examples/Basic/config/
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
steps:
|
|
33
33
|
- uses: actions/setup-node@v3
|
|
34
34
|
with:
|
|
35
|
-
node-version: "
|
|
35
|
+
node-version: "18"
|
|
36
36
|
|
|
37
37
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
38
38
|
uses: actions/checkout@v2
|
|
@@ -40,6 +40,13 @@ jobs:
|
|
|
40
40
|
path: source
|
|
41
41
|
ref: '${{ inputs.ref }}'
|
|
42
42
|
|
|
43
|
+
- name: Setup Java
|
|
44
|
+
uses: actions/setup-java@v3
|
|
45
|
+
with:
|
|
46
|
+
cache: gradle
|
|
47
|
+
distribution: temurin
|
|
48
|
+
java-version: 17
|
|
49
|
+
|
|
43
50
|
- name: Install Google API python client
|
|
44
51
|
run: |
|
|
45
52
|
pip install google-api-python-client
|
|
@@ -114,7 +121,7 @@ jobs:
|
|
|
114
121
|
steps:
|
|
115
122
|
- uses: actions/setup-node@v3
|
|
116
123
|
with:
|
|
117
|
-
node-version: "
|
|
124
|
+
node-version: "18"
|
|
118
125
|
|
|
119
126
|
- name: "Checkout ${{ inputs.ref }}"
|
|
120
127
|
uses: actions/checkout@v2
|
|
@@ -239,7 +246,7 @@ jobs:
|
|
|
239
246
|
steps:
|
|
240
247
|
- uses: actions/setup-node@v3
|
|
241
248
|
with:
|
|
242
|
-
node-version: "
|
|
249
|
+
node-version: "18"
|
|
243
250
|
|
|
244
251
|
- name: "Checkout ${{ inputs.ref }}"
|
|
245
252
|
uses: actions/checkout@v2
|
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
steps:
|
|
33
33
|
- uses: actions/setup-node@v3
|
|
34
34
|
with:
|
|
35
|
-
node-version: "
|
|
35
|
+
node-version: "18"
|
|
36
36
|
|
|
37
37
|
- name: 'Checkout ${{ inputs.ref }}'
|
|
38
38
|
uses: actions/checkout@v2
|
|
@@ -40,6 +40,13 @@ jobs:
|
|
|
40
40
|
path: source
|
|
41
41
|
ref: '${{ inputs.ref }}'
|
|
42
42
|
|
|
43
|
+
- name: Setup Java
|
|
44
|
+
uses: actions/setup-java@v3
|
|
45
|
+
with:
|
|
46
|
+
cache: gradle
|
|
47
|
+
distribution: temurin
|
|
48
|
+
java-version: 17
|
|
49
|
+
|
|
43
50
|
- name: Install Google API python client
|
|
44
51
|
run: |
|
|
45
52
|
pip install google-api-python-client
|
|
@@ -114,7 +121,7 @@ jobs:
|
|
|
114
121
|
steps:
|
|
115
122
|
- uses: actions/setup-node@v3
|
|
116
123
|
with:
|
|
117
|
-
node-version: "
|
|
124
|
+
node-version: "18"
|
|
118
125
|
|
|
119
126
|
- name: "Checkout ${{ inputs.ref }}"
|
|
120
127
|
uses: actions/checkout@v2
|
|
@@ -201,10 +208,10 @@ jobs:
|
|
|
201
208
|
pod install --repo-update
|
|
202
209
|
working-directory: source/examples/Basic/ios
|
|
203
210
|
|
|
204
|
-
- name: Apply Patches
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
# - name: Apply Patches
|
|
212
|
+
# run: |
|
|
213
|
+
# patch -p0 < *.patch
|
|
214
|
+
# working-directory: source/examples/Basic/patches
|
|
208
215
|
|
|
209
216
|
- name: Build resolve Swift dependencies
|
|
210
217
|
run: |
|
|
@@ -239,7 +246,7 @@ jobs:
|
|
|
239
246
|
steps:
|
|
240
247
|
- uses: actions/setup-node@v3
|
|
241
248
|
with:
|
|
242
|
-
node-version: "
|
|
249
|
+
node-version: "18"
|
|
243
250
|
|
|
244
251
|
- name: "Checkout ${{ inputs.ref }}"
|
|
245
252
|
uses: actions/checkout@v2
|
|
@@ -326,10 +333,10 @@ jobs:
|
|
|
326
333
|
RCT_NEW_ARCH_ENABLED=0 SWIFT_VERSION=5 pod install --repo-update
|
|
327
334
|
working-directory: source/examples/TestNamiTV/ios
|
|
328
335
|
|
|
329
|
-
- name: Apply Patches
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
336
|
+
# - name: Apply Patches
|
|
337
|
+
# run: |
|
|
338
|
+
# patch -p0 < *.patch
|
|
339
|
+
# working-directory: source/examples/TestNamiTV/patches
|
|
333
340
|
|
|
334
341
|
- name: Build resolve Swift dependencies
|
|
335
342
|
run: |
|
package/android/build.gradle
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import groovy.json.JsonSlurper
|
|
2
|
-
|
|
3
1
|
// android/build.gradle
|
|
4
2
|
// based on:
|
|
5
3
|
//
|
|
@@ -10,7 +8,7 @@ import groovy.json.JsonSlurper
|
|
|
10
8
|
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
|
|
11
9
|
// original location:
|
|
12
10
|
// - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle
|
|
13
|
-
def DEFAULT_BUILD_TOOLS_VERSION = '
|
|
11
|
+
def DEFAULT_BUILD_TOOLS_VERSION = '34.0.0'
|
|
14
12
|
def safeExtGet(prop, fallback) {
|
|
15
13
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
16
14
|
}
|
|
@@ -18,7 +16,7 @@ apply plugin: 'com.android.library'
|
|
|
18
16
|
// apply plugin: 'maven'
|
|
19
17
|
apply plugin: "kotlin-android"
|
|
20
18
|
buildscript {
|
|
21
|
-
ext.kotlin_version = '1.
|
|
19
|
+
ext.kotlin_version = '1.8.20'
|
|
22
20
|
// The Android Gradle plugin is only required when opening the android folder stand-alone.
|
|
23
21
|
// This avoids unnecessary downloads and potential conflicts when the library is included as a
|
|
24
22
|
// module dependency in an application project.
|
|
@@ -29,13 +27,13 @@ buildscript {
|
|
|
29
27
|
google()
|
|
30
28
|
}
|
|
31
29
|
dependencies {
|
|
32
|
-
classpath 'com.android.tools.build:gradle:7.
|
|
30
|
+
classpath 'com.android.tools.build:gradle:7.4.2'
|
|
33
31
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
android {
|
|
38
|
-
compileSdkVersion
|
|
36
|
+
compileSdkVersion 34
|
|
39
37
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
|
40
38
|
defaultConfig {
|
|
41
39
|
minSdkVersion 22
|
|
@@ -44,28 +42,32 @@ android {
|
|
|
44
42
|
versionName "1.0"
|
|
45
43
|
}
|
|
46
44
|
compileOptions {
|
|
47
|
-
sourceCompatibility JavaVersion.VERSION_1_8
|
|
48
|
-
targetCompatibility JavaVersion.VERSION_1_8
|
|
49
45
|
coreLibraryDesugaringEnabled true
|
|
50
46
|
}
|
|
51
47
|
lintOptions {
|
|
52
48
|
abortOnError false
|
|
53
49
|
}
|
|
54
|
-
kotlinOptions {
|
|
55
|
-
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
56
|
-
}
|
|
57
|
-
dexOptions {
|
|
58
|
-
javaMaxHeapSize "4g"
|
|
59
|
-
}
|
|
60
50
|
buildFeatures {
|
|
61
51
|
viewBinding true
|
|
62
52
|
}
|
|
53
|
+
|
|
54
|
+
flavorDimensions "store"
|
|
55
|
+
productFlavors {
|
|
56
|
+
amazon {
|
|
57
|
+
dimension "store"
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
play {
|
|
61
|
+
dimension "store"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
65
|
repositories {
|
|
65
66
|
mavenCentral()
|
|
66
67
|
// ref: https://www.baeldung.com/maven-local-repository
|
|
67
68
|
mavenLocal()
|
|
68
69
|
maven { url("https://packages.namiml.com/NamiSDK/Amazon/") }
|
|
70
|
+
maven { url("https://packages.namiml.com/NamiSDK/Android/") }
|
|
69
71
|
maven { url 'https://jitpack.io' }
|
|
70
72
|
maven {
|
|
71
73
|
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
@@ -83,35 +85,12 @@ dependencies {
|
|
|
83
85
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
84
86
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
85
87
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
playImplementation "com.namiml:sdk-android:3.2.1"
|
|
89
|
+
amazonImplementation "com.namiml:sdk-amazon:3.2.1"
|
|
88
90
|
|
|
89
|
-
implementation
|
|
91
|
+
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
90
92
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
|
|
91
|
-
|
|
92
|
-
def configureReactNativePom(def pom) {
|
|
93
|
-
def packageJson = new JsonSlurper().parseText(file('../package.json').text)
|
|
94
|
-
pom.project {
|
|
95
|
-
name packageJson.title
|
|
96
|
-
artifactId packageJson.name
|
|
97
|
-
version = packageJson.version
|
|
98
|
-
group = "com.nami.reactlibrary"
|
|
99
|
-
description packageJson.description
|
|
100
|
-
url packageJson.repository.baseUrl
|
|
101
|
-
licenses {
|
|
102
|
-
license {
|
|
103
|
-
name packageJson.license
|
|
104
|
-
url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
|
|
105
|
-
distribution 'repo'
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
developers {
|
|
109
|
-
developer {
|
|
110
|
-
id packageJson.author.username
|
|
111
|
-
name packageJson.author.name
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
93
|
+
|
|
115
94
|
}
|
|
116
95
|
|
|
117
96
|
configurations {
|
|
@@ -121,22 +100,6 @@ configurations {
|
|
|
121
100
|
afterEvaluate { project ->
|
|
122
101
|
// some Gradle build hooks ref:
|
|
123
102
|
// https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
|
|
124
|
-
task androidJavadoc(type: Javadoc) {
|
|
125
|
-
source = android.sourceSets.main.java.srcDirs
|
|
126
|
-
classpath += files(android.bootClasspath)
|
|
127
|
-
// classpath += files(project.getConfigurations().getByName('compile').asList())
|
|
128
|
-
// classpath += files(project.getConfigurations().getByName('customConfig').asList())
|
|
129
|
-
include '**/*.java'
|
|
130
|
-
}
|
|
131
|
-
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
|
132
|
-
classifier = 'javadoc'
|
|
133
|
-
from androidJavadoc.destinationDir
|
|
134
|
-
}
|
|
135
|
-
task androidSourcesJar(type: Jar) {
|
|
136
|
-
classifier = 'sources'
|
|
137
|
-
from android.sourceSets.main.java.srcDirs
|
|
138
|
-
include '**/*.java'
|
|
139
|
-
}
|
|
140
103
|
android.libraryVariants.all { variant ->
|
|
141
104
|
def name = variant.name.capitalize()
|
|
142
105
|
def javaCompileTask = variant.javaCompileProvider.get()
|
|
@@ -144,16 +107,8 @@ afterEvaluate { project ->
|
|
|
144
107
|
from javaCompileTask.destinationDir
|
|
145
108
|
}
|
|
146
109
|
}
|
|
147
|
-
|
|
148
|
-
archives androidSourcesJar
|
|
149
|
-
archives androidJavadocJar
|
|
150
|
-
}
|
|
110
|
+
|
|
151
111
|
task installArchives(type: Upload) {
|
|
152
112
|
configuration = configurations.archives
|
|
153
|
-
// repositories.mavenDeployer {
|
|
154
|
-
// // Deploy to react-native-event-bridge/maven, ready to publish to npm
|
|
155
|
-
// repository url: "file://${projectDir}/../android/maven"
|
|
156
|
-
// configureReactNativePom pom
|
|
157
|
-
// }
|
|
158
113
|
}
|
|
159
114
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#Wed May 26 17:12:26 EDT 2021
|
|
2
2
|
distributionBase=GRADLE_USER_HOME
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
|
4
4
|
distributionPath=wrapper/dists
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
@@ -106,7 +106,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
106
106
|
} else {
|
|
107
107
|
Arguments.createArray()
|
|
108
108
|
}
|
|
109
|
-
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.
|
|
109
|
+
val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.1")
|
|
110
110
|
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
|
|
111
111
|
settingsList.addAll(commandsFromReact)
|
|
112
112
|
}
|
|
@@ -28,11 +28,12 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
28
28
|
const val CAMPAIGN_TYPE = "campaignType"
|
|
29
29
|
const val CAMPAIGN_URL = "campaignUrl"
|
|
30
30
|
const val PAYWALL_NAME = "paywallName"
|
|
31
|
-
const val
|
|
32
|
-
const val COMPONENT_CHANGE_NAME = "componentChangeName"
|
|
31
|
+
const val COMPONENT_CHANGE = "componentChange"
|
|
33
32
|
const val SEGMENT_ID = "segmentId"
|
|
34
33
|
const val EXTERNAL_SEGMENT_ID = "externalSegmentId"
|
|
35
34
|
const val DEEP_LINK_URL = "deeplinkUrl"
|
|
35
|
+
const val TIME_SPENT_ON_PAYWALL = "timeSpentOnPaywall"
|
|
36
|
+
const val VIDEO_METADATA = "videoMetadata"
|
|
36
37
|
const val _RESULT_CAMPAIGN = "ResultCampaign"
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -60,6 +61,7 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
60
61
|
if (context != null) {
|
|
61
62
|
val productGroups: MutableList<String> = mutableListOf()
|
|
62
63
|
val customAttributes: MutableMap<String, String> = mutableMapOf()
|
|
64
|
+
val customObject: MutableMap<String, String> = mutableMapOf()
|
|
63
65
|
|
|
64
66
|
if (context.hasKey("productGroups")) {
|
|
65
67
|
val groups = context.getArray("productGroups")
|
|
@@ -86,10 +88,22 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
86
88
|
}
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
if (context.hasKey("customObject")) {
|
|
92
|
+
val attr = context.getMap("customObject")
|
|
93
|
+
if (attr != null) {
|
|
94
|
+
val keyIterator = attr.keySetIterator()
|
|
95
|
+
while (keyIterator.hasNextKey()) {
|
|
96
|
+
val key = keyIterator.nextKey()
|
|
97
|
+
customObject[key] = attr.getString(key) ?: ""
|
|
98
|
+
}
|
|
99
|
+
Log.d(LOG_TAG, "customObject $customObject")
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
89
103
|
if (context.hasKey("productGroups")) {
|
|
90
|
-
paywallLaunchContext = PaywallLaunchContext(productGroups.toList(), customAttributes)
|
|
104
|
+
paywallLaunchContext = PaywallLaunchContext(productGroups.toList(), customAttributes, customObject)
|
|
91
105
|
} else {
|
|
92
|
-
paywallLaunchContext = PaywallLaunchContext(null, customAttributes)
|
|
106
|
+
paywallLaunchContext = PaywallLaunchContext(null, customAttributes, customObject)
|
|
93
107
|
}
|
|
94
108
|
}
|
|
95
109
|
|
|
@@ -150,12 +164,40 @@ class NamiCampaignManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
150
164
|
putString(CAMPAIGN_TYPE, paywallEvent.campaignType ?: "")
|
|
151
165
|
putString(CAMPAIGN_URL, paywallEvent.campaignUrl ?: "")
|
|
152
166
|
putString(PAYWALL_NAME, paywallEvent.paywallName ?: "")
|
|
153
|
-
putString(COMPONENT_CHANGE_ID, paywallEvent?.componentChange?.id ?: "")
|
|
154
|
-
putString(COMPONENT_CHANGE_NAME, paywallEvent?.componentChange?.name ?: "")
|
|
155
167
|
putString(SEGMENT_ID, paywallEvent.segmentId ?: "")
|
|
156
168
|
putString(EXTERNAL_SEGMENT_ID, paywallEvent.externalSegmentId ?: "")
|
|
157
169
|
putString(DEEP_LINK_URL, paywallEvent.deeplinkUrl ?: "")
|
|
170
|
+
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (paywallEvent.componentChange != null) {
|
|
174
|
+
val componentChangeMap = Arguments.createMap().apply {
|
|
175
|
+
putString("id", paywallEvent.componentChange?.id ?: "")
|
|
176
|
+
putString("name", paywallEvent.componentChange?.name ?: "")
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
resultMap.putMap(COMPONENT_CHANGE, componentChangeMap)
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (paywallEvent.videoMetadata != null) {
|
|
183
|
+
val videoMetadataMap = Arguments.createMap().apply {
|
|
184
|
+
putString("id", paywallEvent.videoMetadata?.id ?: "")
|
|
185
|
+
putString("name", paywallEvent.videoMetadata?.name ?: "")
|
|
186
|
+
putString("url", paywallEvent.videoMetadata?.url ?: "")
|
|
187
|
+
putBoolean("autoplayVideo", paywallEvent.videoMetadata?.autoplayVideo ?: false)
|
|
188
|
+
putBoolean("muteByDefault", paywallEvent.videoMetadata?.muteByDefault ?: false)
|
|
189
|
+
putBoolean("loopVideo", paywallEvent.videoMetadata?.loopVideo ?: false)
|
|
190
|
+
putDouble("contentDuration", paywallEvent.videoMetadata?.contentDuration ?: 0.0)
|
|
191
|
+
putDouble("contentTimecode", paywallEvent.videoMetadata?.contentTimecode ?: 0.0)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
resultMap.putMap(VIDEO_METADATA, videoMetadataMap)
|
|
158
195
|
}
|
|
196
|
+
|
|
197
|
+
if (paywallEvent.timeSpentOnPaywall != null) {
|
|
198
|
+
resultMap.putDouble(TIME_SPENT_ON_PAYWALL, paywallEvent.timeSpentOnPaywall ?: 0.0)
|
|
199
|
+
}
|
|
200
|
+
|
|
159
201
|
emitEvent(_RESULT_CAMPAIGN, resultMap)
|
|
160
202
|
}
|
|
161
203
|
|
|
@@ -227,7 +227,7 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
227
227
|
|
|
228
228
|
@ReactMethod
|
|
229
229
|
fun setAppSuppliedVideoDetails(url: String, name: String?) {
|
|
230
|
-
|
|
230
|
+
NamiPaywallManager.setAppSuppliedVideoDetails(url = url, name = name)
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
@ReactMethod
|
package/ios/Nami.m
CHANGED
|
@@ -50,7 +50,7 @@ RCT_EXPORT_METHOD(configure: (NSDictionary *)configDict completion: (RCTResponse
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
// Start commands with header iformation for Nami to let them know this is a React client.
|
|
53
|
-
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.2.
|
|
53
|
+
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.2.1"]];
|
|
54
54
|
|
|
55
55
|
// Add additional namiCommands app may have sent in.
|
|
56
56
|
NSObject *appCommandStrings = configDict[@"namiCommands"];
|
|
@@ -81,6 +81,24 @@ class RNNamiCampaignManager: RCTEventEmitter {
|
|
|
81
81
|
actionString = "PAGE_CHANGE"
|
|
82
82
|
case .slide_change:
|
|
83
83
|
actionString = "SLIDE_CHANGE"
|
|
84
|
+
case .nami_collapsible_drawer_open:
|
|
85
|
+
actionString = "COLLAPSIBLE_DRAWER_OPEN"
|
|
86
|
+
case .nami_collapsible_drawer_close:
|
|
87
|
+
actionString = "COLLAPSIBLE_DRAWER_CLOSE"
|
|
88
|
+
case .video_play:
|
|
89
|
+
actionString = "VIDEO_STARTED"
|
|
90
|
+
case .video_pause:
|
|
91
|
+
actionString = "VIDEO_PAUSED"
|
|
92
|
+
case .video_resume:
|
|
93
|
+
actionString = "VIDEO_RESUMED"
|
|
94
|
+
case .video_end:
|
|
95
|
+
actionString = "VIDEO_ENDED"
|
|
96
|
+
case .video_change:
|
|
97
|
+
actionString = "VIDEO_CHANGED"
|
|
98
|
+
case .video_mute:
|
|
99
|
+
actionString = "VIDEO_MUTED"
|
|
100
|
+
case .video_unmute:
|
|
101
|
+
actionString = "VIDEO_UNMUTED"
|
|
84
102
|
default:
|
|
85
103
|
actionString = "UNKNOWN"
|
|
86
104
|
}
|
|
@@ -88,6 +106,26 @@ class RNNamiCampaignManager: RCTEventEmitter {
|
|
|
88
106
|
|
|
89
107
|
let dictionaries = paywallEvent.purchases.map { purchase in RNNamiPurchaseManager.purchaseToPurchaseDict(purchase) }
|
|
90
108
|
|
|
109
|
+
var componentChange: [String: Any?] = [:]
|
|
110
|
+
|
|
111
|
+
if let eventComponentChange = paywallEvent.componentChange {
|
|
112
|
+
componentChange["id"] = eventComponentChange.id
|
|
113
|
+
componentChange["name"] = eventComponentChange.name
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var videoMetadata: [String: Any?] = [:]
|
|
117
|
+
|
|
118
|
+
if let eventVideoMetadata = paywallEvent.videoMetadata {
|
|
119
|
+
videoMetadata["id"] = eventVideoMetadata.id
|
|
120
|
+
videoMetadata["name"] = eventVideoMetadata.name
|
|
121
|
+
videoMetadata["url"] = eventVideoMetadata.url
|
|
122
|
+
videoMetadata["loopVideo"] = eventVideoMetadata.loopVideo
|
|
123
|
+
videoMetadata["muteByDefault"] = eventVideoMetadata.muteByDefault
|
|
124
|
+
videoMetadata["autoplayVideo"] = eventVideoMetadata.autoplayVideo
|
|
125
|
+
videoMetadata["contentTimecode"] = eventVideoMetadata.contentTimecode
|
|
126
|
+
videoMetadata["contentDuration"] = eventVideoMetadata.contentDuration
|
|
127
|
+
}
|
|
128
|
+
|
|
91
129
|
let payload: [String: Any?] = [
|
|
92
130
|
"campaignId": paywallEvent.campaignId,
|
|
93
131
|
"campaignName": paywallEvent.campaignName,
|
|
@@ -103,8 +141,9 @@ class RNNamiCampaignManager: RCTEventEmitter {
|
|
|
103
141
|
"purchaseError": errorSting,
|
|
104
142
|
"purchases": dictionaries,
|
|
105
143
|
"deeplinkUrl": paywallEvent.deeplinkUrl,
|
|
106
|
-
"
|
|
107
|
-
"
|
|
144
|
+
"componentChange": componentChange,
|
|
145
|
+
"videoMetadata": videoMetadata,
|
|
146
|
+
"timeSpentOnPaywall": paywallEvent.timeSpentOnPaywall,
|
|
108
147
|
]
|
|
109
148
|
|
|
110
149
|
RNNamiCampaignManager.shared?.sendEvent(withName: "ResultCampaign", body: payload)
|
|
@@ -126,6 +165,7 @@ class RNNamiCampaignManager: RCTEventEmitter {
|
|
|
126
165
|
|
|
127
166
|
var productGroups: [String]?
|
|
128
167
|
var customAttributes: [String: Any]?
|
|
168
|
+
var customObject: [String: Any]?
|
|
129
169
|
|
|
130
170
|
if let context = context {
|
|
131
171
|
if let contextProductGroups = context["productGroups"] as? [String] {
|
|
@@ -134,10 +174,13 @@ class RNNamiCampaignManager: RCTEventEmitter {
|
|
|
134
174
|
if let contextCustomAttributes = context["customAttributes"] as? [String: Any] {
|
|
135
175
|
customAttributes = contextCustomAttributes
|
|
136
176
|
}
|
|
177
|
+
if let contextCustomObject = context["customObject"] as? [String: Any] {
|
|
178
|
+
customObject = contextCustomObject
|
|
179
|
+
}
|
|
137
180
|
}
|
|
138
181
|
|
|
139
|
-
if productGroups != nil || customAttributes != nil {
|
|
140
|
-
paywallLaunchContext = PaywallLaunchContext(productGroups: productGroups, customAttributes: customAttributes)
|
|
182
|
+
if productGroups != nil || customAttributes != nil || customObject != nil {
|
|
183
|
+
paywallLaunchContext = PaywallLaunchContext(productGroups: productGroups, customAttributes: customAttributes, customObject: customObject)
|
|
141
184
|
}
|
|
142
185
|
|
|
143
186
|
var launchMethod: (() -> Void)?
|
|
@@ -159,7 +159,7 @@ class RNNamiPaywallManager: RCTEventEmitter {
|
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
@objc(setAppSuppliedVideoDetails:name:)
|
|
162
|
-
func setAppSuppliedVideoDetails(url
|
|
163
|
-
|
|
162
|
+
func setAppSuppliedVideoDetails(url: String, name: String?) {
|
|
163
|
+
NamiPaywallManager.setAppSuppliedVideoDetails(url: url, name: name)
|
|
164
164
|
}
|
|
165
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nami-sdk",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "React Native Module for Nami - Easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"react": ">=
|
|
53
|
-
"react-native": ">=0.
|
|
52
|
+
"react": ">=18",
|
|
53
|
+
"react-native": ">=0.73"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
57
|
-
"@types/react-native": "^0.
|
|
57
|
+
"@types/react-native": "^0.73.0",
|
|
58
58
|
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
59
59
|
"eslint": "^8.41.0",
|
|
60
60
|
"eslint-plugin-jest": "^27.2.2",
|
|
61
61
|
"@types/jest": "^29.5.2",
|
|
62
62
|
"prettier": "^2.8.7",
|
|
63
|
-
"react": "^
|
|
64
|
-
"react-native": "^0.
|
|
63
|
+
"react": "^18.2.0",
|
|
64
|
+
"react-native": "^0.73.0",
|
|
65
65
|
"react-native-codegen": "^0.0.12",
|
|
66
66
|
"typescript": "^5.0.2"
|
|
67
67
|
},
|
|
@@ -68,6 +68,8 @@ export const NamiCampaignManager: ICampaignManager = {
|
|
|
68
68
|
segmentId: body.segmentId,
|
|
69
69
|
externalSegmentId: body.externalSegmentId,
|
|
70
70
|
deeplinkUrl: body.deeplinkUrl,
|
|
71
|
+
videoMetadata: body.videoMetadata,
|
|
72
|
+
timeSpentOnPaywall: body.timeSpentOnPaywall,
|
|
71
73
|
sku: body.sku,
|
|
72
74
|
purchaseError: body.purchaseError,
|
|
73
75
|
purchases: body.purchases,
|
package/src/types.d.ts
CHANGED
|
@@ -143,6 +143,15 @@ export declare enum NamiPaywallAction {
|
|
|
143
143
|
TOGGLE_CHANGE = "TOGGLE_CHANGE",
|
|
144
144
|
PAGE_CHANGE = "PAGE_CHANGE",
|
|
145
145
|
SLIDE_CHANGE = "SLIDE_CHANGE",
|
|
146
|
+
COLLAPSIBLE_DRAWER_OPEN = "COLLAPSIBLE_DRAWER_OPEN",
|
|
147
|
+
COLLAPSIBLE_DRAWER_CLOSE = "COLLAPSIBLE_DRAWER_CLOSE",
|
|
148
|
+
VIDEO_STARTED = "VIDEO_STARTED",
|
|
149
|
+
VIDEO_PAUSED = "VIDEO_PAUSED",
|
|
150
|
+
VIDEO_RESUMED = "VIDEO_RESUMED",
|
|
151
|
+
VIDEO_ENDED = "VIDEO_ENDED",
|
|
152
|
+
VIDEO_CHANGED = "VIDEO_CHANGED",
|
|
153
|
+
VIDEO_MUTED = "VIDEO_MUTED",
|
|
154
|
+
VIDEO_UNMUTED = "VIDEO_UNMUTED",
|
|
146
155
|
UNKNOWN = "UNKNOWN"
|
|
147
156
|
}
|
|
148
157
|
export type NamiPurchase = {
|
|
@@ -170,9 +179,21 @@ export type NamiPaywallEvent = {
|
|
|
170
179
|
sku?: NamiSKU;
|
|
171
180
|
purchaseError?: string;
|
|
172
181
|
purchases?: NamiPurchase[];
|
|
182
|
+
videoMetadata?: NamiPaywallEventVideoMetadata;
|
|
183
|
+
timeSpentOnPaywall?: number;
|
|
173
184
|
};
|
|
174
185
|
export type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
175
186
|
export type NamiPaywallComponentChange = {
|
|
176
187
|
id?: string;
|
|
177
188
|
name?: string;
|
|
178
189
|
};
|
|
190
|
+
export type NamiPaywallEventVideoMetadata = {
|
|
191
|
+
id?: string;
|
|
192
|
+
name?: string;
|
|
193
|
+
url?: string;
|
|
194
|
+
loopVideo: boolean;
|
|
195
|
+
muteByDefault: boolean;
|
|
196
|
+
autoplayVideo: boolean;
|
|
197
|
+
contentTimecode?: number;
|
|
198
|
+
contentDuration?: number;
|
|
199
|
+
};
|
package/src/types.ts
CHANGED
|
@@ -278,6 +278,15 @@ export enum NamiPaywallAction {
|
|
|
278
278
|
TOGGLE_CHANGE = 'TOGGLE_CHANGE',
|
|
279
279
|
PAGE_CHANGE = 'PAGE_CHANGE',
|
|
280
280
|
SLIDE_CHANGE = 'SLIDE_CHANGE',
|
|
281
|
+
COLLAPSIBLE_DRAWER_OPEN = 'COLLAPSIBLE_DRAWER_OPEN',
|
|
282
|
+
COLLAPSIBLE_DRAWER_CLOSE = 'COLLAPSIBLE_DRAWER_CLOSE',
|
|
283
|
+
VIDEO_STARTED = 'VIDEO_STARTED',
|
|
284
|
+
VIDEO_PAUSED = 'VIDEO_PAUSED',
|
|
285
|
+
VIDEO_RESUMED = 'VIDEO_RESUMED',
|
|
286
|
+
VIDEO_ENDED = 'VIDEO_ENDED',
|
|
287
|
+
VIDEO_CHANGED = 'VIDEO_CHANGED',
|
|
288
|
+
VIDEO_MUTED = 'VIDEO_MUTED',
|
|
289
|
+
VIDEO_UNMUTED = 'VIDEO_UNMUTED',
|
|
281
290
|
UNKNOWN = 'UNKNOWN',
|
|
282
291
|
}
|
|
283
292
|
|
|
@@ -318,6 +327,8 @@ export type NamiPaywallEvent = {
|
|
|
318
327
|
sku?: NamiSKU;
|
|
319
328
|
purchaseError?: string;
|
|
320
329
|
purchases?: NamiPurchase[];
|
|
330
|
+
videoMetadata?: NamiPaywallEventVideoMetadata;
|
|
331
|
+
timeSpentOnPaywall?: number;
|
|
321
332
|
};
|
|
322
333
|
|
|
323
334
|
export type NamiPaywallActionHandler = (event: NamiPaywallEvent) => void;
|
|
@@ -326,3 +337,14 @@ export type NamiPaywallComponentChange = {
|
|
|
326
337
|
id?: string;
|
|
327
338
|
name?: string;
|
|
328
339
|
};
|
|
340
|
+
|
|
341
|
+
export type NamiPaywallEventVideoMetadata = {
|
|
342
|
+
id?: string;
|
|
343
|
+
name?: string;
|
|
344
|
+
url?: string;
|
|
345
|
+
loopVideo: boolean;
|
|
346
|
+
muteByDefault: boolean;
|
|
347
|
+
autoplayVideo: boolean;
|
|
348
|
+
contentTimecode?: number;
|
|
349
|
+
contentDuration?: number;
|
|
350
|
+
};
|