react-native-nami-sdk 3.2.0-beta.1 → 3.2.1-beta.2

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/.eslintignore CHANGED
@@ -1,2 +1,3 @@
1
1
  node_modules/
2
2
  .eslintrc
3
+ *.d.ts
@@ -13,7 +13,59 @@ jobs:
13
13
  steps:
14
14
  - uses: actions/setup-node@v3
15
15
  with:
16
- node-version: "16"
16
+ node-version: "18"
17
+
18
+ - name: 'Checkout ${{ inputs.ref }}'
19
+ uses: actions/checkout@v3
20
+ with:
21
+ path: source
22
+ ref: '${{ inputs.ref }}'
23
+
24
+ - name: Install dependencies
25
+ run: yarn --frozen-lockfile --prefer-offline
26
+ working-directory: source/
27
+
28
+ - name: Linter
29
+ run: |
30
+ npx eslint . --ext .js,.jsx,.ts,.tsx
31
+ working-directory: source/
32
+ tsc:
33
+ name: Generate Declaration Files
34
+ permissions:
35
+ actions: write
36
+ contents: write
37
+ id-token: write
38
+ runs-on: ubuntu-latest
39
+ steps:
40
+ - uses: actions/setup-node@v3
41
+ with:
42
+ node-version: "18"
43
+
44
+ - name: 'Checkout ${{ inputs.ref }}'
45
+ uses: actions/checkout@v3
46
+ with:
47
+ path: source
48
+ ref: '${{ inputs.ref }}'
49
+
50
+ - name: Install dependencies
51
+ run: yarn --frozen-lockfile --prefer-offline
52
+ working-directory: source/
53
+
54
+ - name: Generate .d files
55
+ run: |
56
+ npx tsc
57
+ working-directory: source/
58
+ eslintapps:
59
+ name: ESLint Sample Apps
60
+ permissions:
61
+ actions: write
62
+ contents: write
63
+ id-token: write
64
+ runs-on: ubuntu-latest
65
+ steps:
66
+ - uses: actions/setup-node@v3
67
+ with:
68
+ node-version: "18"
17
69
 
18
70
  - name: 'Checkout ${{ inputs.ref }}'
19
71
  uses: actions/checkout@v3
@@ -46,7 +98,7 @@ jobs:
46
98
  steps:
47
99
  - uses: actions/setup-node@v3
48
100
  with:
49
- node-version: 16
101
+ node-version: 18
50
102
 
51
103
  - name: 'Checkout ${{ inputs.ref }}'
52
104
  uses: actions/checkout@v3
@@ -148,7 +200,7 @@ jobs:
148
200
  - name: Setup Node.js
149
201
  uses: actions/setup-node@v3
150
202
  with:
151
- node-version: "16"
203
+ node-version: "18"
152
204
 
153
205
  - name: Cache node_modules
154
206
  uses: actions/cache@v3
@@ -166,7 +218,7 @@ jobs:
166
218
  with:
167
219
  cache: gradle
168
220
  distribution: temurin
169
- java-version: 11
221
+ java-version: 17
170
222
 
171
223
  - name: Update App Platform ID
172
224
  working-directory: source/examples/Basic/config/
@@ -1,4 +1,6 @@
1
1
  name: Generate Test React PROD
2
+ env:
3
+ DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
2
4
  on:
3
5
  workflow_dispatch:
4
6
  inputs:
@@ -30,7 +32,7 @@ jobs:
30
32
  steps:
31
33
  - uses: actions/setup-node@v3
32
34
  with:
33
- node-version: "16"
35
+ node-version: "18"
34
36
 
35
37
  - name: 'Checkout ${{ inputs.ref }}'
36
38
  uses: actions/checkout@v2
@@ -38,6 +40,13 @@ jobs:
38
40
  path: source
39
41
  ref: '${{ inputs.ref }}'
40
42
 
43
+ - name: Setup Java
44
+ uses: actions/setup-java@v3
45
+ with:
46
+ cache: gradle
47
+ distribution: temurin
48
+ java-version: 17
49
+
41
50
  - name: Install Google API python client
42
51
  run: |
43
52
  pip install google-api-python-client
@@ -107,12 +116,12 @@ jobs:
107
116
  actions: write
108
117
  contents: write
109
118
  id-token: write
110
- runs-on: macos-12
119
+ runs-on: macos-13
111
120
  timeout-minutes: 40
112
121
  steps:
113
122
  - uses: actions/setup-node@v3
114
123
  with:
115
- node-version: "16"
124
+ node-version: "18"
116
125
 
117
126
  - name: "Checkout ${{ inputs.ref }}"
118
127
  uses: actions/checkout@v2
@@ -156,7 +165,7 @@ jobs:
156
165
  - name: Install the provisioning profile
157
166
  run: |
158
167
  PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
159
- echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
168
+ echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode -o $PP_PATH
160
169
  mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
161
170
  cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
162
171
  env:
@@ -199,6 +208,11 @@ jobs:
199
208
  pod install --repo-update
200
209
  working-directory: source/examples/Basic/ios
201
210
 
211
+ - name: Apply Patches
212
+ run: |
213
+ patch -p0 < *.patch
214
+ working-directory: source/examples/Basic/patches
215
+
202
216
  - name: Build resolve Swift dependencies
203
217
  run: |
204
218
  xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme BasicProduction -configuration Release
@@ -227,12 +241,12 @@ jobs:
227
241
  actions: write
228
242
  contents: write
229
243
  id-token: write
230
- runs-on: macos-12
244
+ runs-on: macos-13
231
245
  timeout-minutes: 40
232
246
  steps:
233
247
  - uses: actions/setup-node@v3
234
248
  with:
235
- node-version: "16"
249
+ node-version: "18"
236
250
 
237
251
  - name: "Checkout ${{ inputs.ref }}"
238
252
  uses: actions/checkout@v2
@@ -276,7 +290,7 @@ jobs:
276
290
  - name: Install the provisioning profile
277
291
  run: |
278
292
  PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
279
- echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
293
+ echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode -o $PP_PATH
280
294
  mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
281
295
  cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
282
296
  env:
@@ -319,6 +333,11 @@ jobs:
319
333
  RCT_NEW_ARCH_ENABLED=0 SWIFT_VERSION=5 pod install --repo-update
320
334
  working-directory: source/examples/TestNamiTV/ios
321
335
 
336
+ - name: Apply Patches
337
+ run: |
338
+ patch -p0 < *.patch
339
+ working-directory: source/examples/TestNamiTV/patches
340
+
322
341
  - name: Build resolve Swift dependencies
323
342
  run: |
324
343
  xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme Basic-tvOS-PROD -configuration Release
@@ -1,4 +1,6 @@
1
1
  name: Generate Test React STG
2
+ env:
3
+ DEVELOPER_DIR: /Applications/Xcode_15.0.1.app/Contents/Developer
2
4
  on:
3
5
  workflow_dispatch:
4
6
  inputs:
@@ -30,7 +32,7 @@ jobs:
30
32
  steps:
31
33
  - uses: actions/setup-node@v3
32
34
  with:
33
- node-version: "16"
35
+ node-version: "18"
34
36
 
35
37
  - name: 'Checkout ${{ inputs.ref }}'
36
38
  uses: actions/checkout@v2
@@ -38,6 +40,13 @@ jobs:
38
40
  path: source
39
41
  ref: '${{ inputs.ref }}'
40
42
 
43
+ - name: Setup Java
44
+ uses: actions/setup-java@v3
45
+ with:
46
+ cache: gradle
47
+ distribution: temurin
48
+ java-version: 17
49
+
41
50
  - name: Install Google API python client
42
51
  run: |
43
52
  pip install google-api-python-client
@@ -107,12 +116,12 @@ jobs:
107
116
  actions: write
108
117
  contents: write
109
118
  id-token: write
110
- runs-on: macos-12
119
+ runs-on: macos-13
111
120
  timeout-minutes: 40
112
121
  steps:
113
122
  - uses: actions/setup-node@v3
114
123
  with:
115
- node-version: "16"
124
+ node-version: "18"
116
125
 
117
126
  - name: "Checkout ${{ inputs.ref }}"
118
127
  uses: actions/checkout@v2
@@ -156,7 +165,7 @@ jobs:
156
165
  - name: Install the provisioning profile
157
166
  run: |
158
167
  PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
159
- echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
168
+ echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode -o $PP_PATH
160
169
  mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
161
170
  cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
162
171
  env:
@@ -199,6 +208,11 @@ jobs:
199
208
  pod install --repo-update
200
209
  working-directory: source/examples/Basic/ios
201
210
 
211
+ # - name: Apply Patches
212
+ # run: |
213
+ # patch -p0 < *.patch
214
+ # working-directory: source/examples/Basic/patches
215
+
202
216
  - name: Build resolve Swift dependencies
203
217
  run: |
204
218
  xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme Basic -configuration Release
@@ -227,12 +241,12 @@ jobs:
227
241
  actions: write
228
242
  contents: write
229
243
  id-token: write
230
- runs-on: macos-12
244
+ runs-on: macos-13
231
245
  timeout-minutes: 40
232
246
  steps:
233
247
  - uses: actions/setup-node@v3
234
248
  with:
235
- node-version: "16"
249
+ node-version: "18"
236
250
 
237
251
  - name: "Checkout ${{ inputs.ref }}"
238
252
  uses: actions/checkout@v2
@@ -276,7 +290,7 @@ jobs:
276
290
  - name: Install the provisioning profile
277
291
  run: |
278
292
  PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
279
- echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode --output $PP_PATH
293
+ echo -n "$PROVISIONING_CERTIFICATE_BASE64" | base64 --decode -o $PP_PATH
280
294
  mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
281
295
  cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
282
296
  env:
@@ -319,6 +333,11 @@ jobs:
319
333
  RCT_NEW_ARCH_ENABLED=0 SWIFT_VERSION=5 pod install --repo-update
320
334
  working-directory: source/examples/TestNamiTV/ios
321
335
 
336
+ # - name: Apply Patches
337
+ # run: |
338
+ # patch -p0 < *.patch
339
+ # working-directory: source/examples/TestNamiTV/patches
340
+
322
341
  - name: Build resolve Swift dependencies
323
342
  run: |
324
343
  xcodebuild -resolvePackageDependencies -workspace ios/Basic.xcworkspace -scheme Basic-tvOS -configuration Release
@@ -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 = '30.0.2'
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.6.10'
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.0.4'
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 33
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
- implementation 'com.github.jeziellago:compose-markdown:0.3.0'
87
- compileOnly "com.namiml:sdk-amazon:3.2.0-beta.01"
88
+ playImplementation "com.namiml:sdk-android:3.2.1"
89
+ amazonImplementation "com.namiml:sdk-amazon:3.2.1"
88
90
 
89
- implementation 'com.facebook.react:react-native:+' // From node_modules
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
- artifacts {
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-7.0.2-bin.zip
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.0-beta.01")
109
+ val settingsList = mutableListOf("extendedClientInfo:react-native:3.2.1-beta.2")
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 COMPONENT_CHANGE_ID = "componentChangeId"
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
 
@@ -221,10 +221,15 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
221
221
  }
222
222
 
223
223
  @ReactMethod
224
- fun setProductDetails(productDetails: String, allowOffers: Boolean) {
224
+ fun setProductDetails(productDetails: String, allowOffers: Boolean) {
225
225
  NamiPaywallManager.setProductDetails(productDetails, allowOffers = false)
226
226
  }
227
227
 
228
+ @ReactMethod
229
+ fun setAppSuppliedVideoDetails(url: String, name: String?) {
230
+ NamiPaywallManager.setAppSuppliedVideoDetails(url = url, name = name)
231
+ }
232
+
228
233
  @ReactMethod
229
234
  fun addListener(eventName: String?) {
230
235
  }
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.0-beta.1"]];
53
+ NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.2.1-beta.2"]];
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
- "componentChangeId": paywallEvent.componentChange?.id,
107
- "componentChangeName": paywallEvent.componentChange?.name,
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)?