teads-react-native 6.0.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/LICENSE +20 -0
- package/README.md +93 -0
- package/android/bin/build/generated/source/buildConfig/debug/com/outbrainreactnative/BuildConfig.class +0 -0
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +7 -0
- package/android/bin/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +18 -0
- package/android/bin/build/intermediates/aar_metadata/debug/aar-metadata.properties +6 -0
- package/android/bin/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +1 -0
- package/android/bin/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
- package/android/bin/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
- package/android/bin/build/intermediates/compile_symbol_list/debug/R.txt +0 -0
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
- package/android/bin/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
- package/android/bin/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
- package/android/bin/build/intermediates/local_only_symbol_list/debug/R-def.txt +2 -0
- package/android/bin/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +7 -0
- package/android/bin/build/intermediates/merged_manifest/debug/AndroidManifest.xml +7 -0
- package/android/bin/build/intermediates/navigation_json/debug/navigation.json +1 -0
- package/android/bin/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
- package/android/bin/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +1 -0
- package/android/bin/build/outputs/logs/manifest-merger-debug-report.txt +16 -0
- package/android/bin/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/bin/build.gradle +101 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/bin/gradle/wrapper/gradle-wrapper.properties +7 -0
- package/android/bin/gradle.properties +5 -0
- package/android/bin/gradlew +249 -0
- package/android/bin/gradlew.bat +92 -0
- package/android/bin/src/main/AndroidManifest.xml +3 -0
- package/android/bin/src/main/AndroidManifestNew.xml +2 -0
- package/android/bin/src/main/java/com/outbrainreactnative/OutbrainNativePackage.class +0 -0
- package/android/bin/src/main/java/com/outbrainreactnative/SFWebViewWidgetManager.class +0 -0
- package/android/bin/src/main/java/com/outbrainreactnative/SFWebViewWidgetWrapper.class +0 -0
- package/android/bin/src/main/java/com/outbrainreactnative/Utils.class +0 -0
- package/android/build.gradle +129 -0
- package/android/generated/java/com/facebook/react/viewmanagers/TeadsAdPlacementFeedManagerDelegate.java +62 -0
- package/android/generated/java/com/facebook/react/viewmanagers/TeadsAdPlacementFeedManagerInterface.java +28 -0
- package/android/generated/java/com/facebook/react/viewmanagers/TeadsAdPlacementMediaManagerDelegate.java +44 -0
- package/android/generated/java/com/facebook/react/viewmanagers/TeadsAdPlacementMediaManagerInterface.java +22 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNTeadsReactNativeViewSpec-generated.cpp +22 -0
- package/android/generated/jni/RNTeadsReactNativeViewSpec.h +24 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/ComponentDescriptors.cpp +23 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/ComponentDescriptors.h +25 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/EventEmitters.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/EventEmitters.h +30 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/Props.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/Props.h +51 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/RNTeadsReactNativeViewSpecJSI-generated.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/RNTeadsReactNativeViewSpecJSI.h +19 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/ShadowNodes.cpp +18 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/ShadowNodes.h +43 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNTeadsReactNativeViewSpec/States.h +41 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/tv/teads/reactnative/SFWidgetContainer.java +19 -0
- package/android/src/main/java/tv/teads/reactnative/TeadsAdPlacementFeedManager.java +109 -0
- package/android/src/main/java/tv/teads/reactnative/TeadsFeedPackage.java +53 -0
- package/android/src/main/java/tv/teads/reactnative/TeadsMediaPlacementManager.java +76 -0
- package/android/src/main/java/tv/teads/reactnative/TeadsPlacementContainer.java +327 -0
- package/android/src/main/java/tv/teads/reactnative/Utils.java +65 -0
- package/ios/RCTTeadsAdPlacementFeed.h +22 -0
- package/ios/RCTTeadsAdPlacementFeed.mm +114 -0
- package/ios/RCTTeadsAdPlacementMedia.h +23 -0
- package/ios/RCTTeadsAdPlacementMedia.mm +91 -0
- package/ios/TeadsAdContainer.swift +212 -0
- package/ios/TeadsEventModule.h +16 -0
- package/ios/TeadsEventModule.mm +52 -0
- package/ios/TeadsReactNative.h +8 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/ComponentDescriptors.cpp +23 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/ComponentDescriptors.h +25 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/EventEmitters.cpp +17 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/EventEmitters.h +30 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/Props.cpp +46 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/Props.h +51 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/RCTComponentViewHelpers.h +24 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/RNTeadsReactNativeViewSpec-generated.mm +16 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/RNTeadsReactNativeViewSpec.h +38 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/ShadowNodes.cpp +18 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/ShadowNodes.h +43 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/States.cpp +16 -0
- package/ios/generated/RNTeadsReactNativeViewSpec/States.h +41 -0
- package/ios/generated/RNTeadsReactNativeViewSpecJSI-generated.cpp +17 -0
- package/ios/generated/RNTeadsReactNativeViewSpecJSI.h +19 -0
- package/lib/commonjs/DefaultTeadsWidgetHandler.js +21 -0
- package/lib/commonjs/DefaultTeadsWidgetHandler.js.map +1 -0
- package/lib/commonjs/TeadsAdPlacementFeed.js +131 -0
- package/lib/commonjs/TeadsAdPlacementFeed.js.map +1 -0
- package/lib/commonjs/TeadsAdPlacementMedia.js +115 -0
- package/lib/commonjs/TeadsAdPlacementMedia.js.map +1 -0
- package/lib/commonjs/TeadsInAppBrowser.js +48 -0
- package/lib/commonjs/TeadsInAppBrowser.js.map +1 -0
- package/lib/commonjs/TeadsMediaNativeComponent.ts +15 -0
- package/lib/commonjs/WebViewNativeComponent.ts +21 -0
- package/lib/commonjs/constants.js +9 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/index.js +20 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/types.d.js +2 -0
- package/lib/commonjs/types.d.js.map +1 -0
- package/lib/commonjs/version.js +8 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/DefaultTeadsWidgetHandler.js +17 -0
- package/lib/module/DefaultTeadsWidgetHandler.js.map +1 -0
- package/lib/module/TeadsAdPlacementFeed.js +126 -0
- package/lib/module/TeadsAdPlacementFeed.js.map +1 -0
- package/lib/module/TeadsAdPlacementMedia.js +110 -0
- package/lib/module/TeadsAdPlacementMedia.js.map +1 -0
- package/lib/module/TeadsInAppBrowser.js +44 -0
- package/lib/module/TeadsInAppBrowser.js.map +1 -0
- package/lib/module/TeadsMediaNativeComponent.ts +15 -0
- package/lib/module/WebViewNativeComponent.ts +21 -0
- package/lib/module/constants.js +5 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/types.d.js +2 -0
- package/lib/module/types.d.js.map +1 -0
- package/lib/module/version.js +4 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/DefaultTeadsWidgetHandler.d.ts +4 -0
- package/lib/typescript/commonjs/src/DefaultTeadsWidgetHandler.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TeadsAdPlacementFeed.d.ts +3 -0
- package/lib/typescript/commonjs/src/TeadsAdPlacementFeed.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TeadsAdPlacementMedia.d.ts +3 -0
- package/lib/typescript/commonjs/src/TeadsAdPlacementMedia.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TeadsInAppBrowser.d.ts +4 -0
- package/lib/typescript/commonjs/src/TeadsInAppBrowser.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TeadsMediaNativeComponent.d.ts +12 -0
- package/lib/typescript/commonjs/src/TeadsMediaNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/WebViewNativeComponent.d.ts +18 -0
- package/lib/typescript/commonjs/src/WebViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/constants.d.ts +3 -0
- package/lib/typescript/commonjs/src/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/version.d.ts +2 -0
- package/lib/typescript/commonjs/src/version.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/DefaultTeadsWidgetHandler.d.ts +4 -0
- package/lib/typescript/module/src/DefaultTeadsWidgetHandler.d.ts.map +1 -0
- package/lib/typescript/module/src/TeadsAdPlacementFeed.d.ts +3 -0
- package/lib/typescript/module/src/TeadsAdPlacementFeed.d.ts.map +1 -0
- package/lib/typescript/module/src/TeadsAdPlacementMedia.d.ts +3 -0
- package/lib/typescript/module/src/TeadsAdPlacementMedia.d.ts.map +1 -0
- package/lib/typescript/module/src/TeadsInAppBrowser.d.ts +4 -0
- package/lib/typescript/module/src/TeadsInAppBrowser.d.ts.map +1 -0
- package/lib/typescript/module/src/TeadsMediaNativeComponent.d.ts +12 -0
- package/lib/typescript/module/src/TeadsMediaNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/WebViewNativeComponent.d.ts +18 -0
- package/lib/typescript/module/src/WebViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/constants.d.ts +3 -0
- package/lib/typescript/module/src/constants.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/version.d.ts +2 -0
- package/lib/typescript/module/src/version.d.ts.map +1 -0
- package/package.json +227 -0
- package/src/DefaultTeadsWidgetHandler.ts +17 -0
- package/src/TeadsAdPlacementFeed.tsx +142 -0
- package/src/TeadsAdPlacementMedia.tsx +127 -0
- package/src/TeadsInAppBrowser.ts +42 -0
- package/src/TeadsMediaNativeComponent.ts +15 -0
- package/src/WebViewNativeComponent.ts +21 -0
- package/src/constants.ts +11 -0
- package/src/index.tsx +9 -0
- package/src/types.d.ts +32 -0
- package/src/version.ts +1 -0
- package/teads-react-native.podspec +42 -0
package/package.json
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "teads-react-native",
|
|
3
|
+
"version": "6.0.2",
|
|
4
|
+
"description": "Easily embed Teads Widgets in your React Native app!",
|
|
5
|
+
"source": "./src/index.tsx",
|
|
6
|
+
"main": "./lib/commonjs/index.js",
|
|
7
|
+
"module": "./lib/module/index.js",
|
|
8
|
+
"react-native": "src/index.tsx",
|
|
9
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./lib/typescript/module/src/index.d.ts",
|
|
14
|
+
"default": "./lib/module/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./lib/typescript/commonjs/src/index.d.ts",
|
|
18
|
+
"default": "./lib/commonjs/index.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"src",
|
|
25
|
+
"lib",
|
|
26
|
+
"android",
|
|
27
|
+
"ios",
|
|
28
|
+
"cpp",
|
|
29
|
+
"*.podspec",
|
|
30
|
+
"react-native.config.js",
|
|
31
|
+
"!ios/build",
|
|
32
|
+
"!android/build",
|
|
33
|
+
"!android/gradle",
|
|
34
|
+
"!android/gradlew",
|
|
35
|
+
"!android/gradlew.bat",
|
|
36
|
+
"!android/local.properties",
|
|
37
|
+
"!**/__tests__",
|
|
38
|
+
"!**/__fixtures__",
|
|
39
|
+
"!**/__mocks__",
|
|
40
|
+
"!**/.*"
|
|
41
|
+
],
|
|
42
|
+
"scripts": {
|
|
43
|
+
"preinstall": "node -e \"const [major, minor, patch] = process.versions.node.split('.').map(Number); if (major < 20 || (major === 20 && minor < 19)) { console.error('❌ Node 20.19.0+ required'); process.exit(1); }\"",
|
|
44
|
+
"example": "yarn workspace teads-react-native-example",
|
|
45
|
+
"test": "jest",
|
|
46
|
+
"typecheck": "tsc",
|
|
47
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
48
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
49
|
+
"prepare": "bob build",
|
|
50
|
+
"release": "release-it"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"react-native",
|
|
54
|
+
"ios",
|
|
55
|
+
"android"
|
|
56
|
+
],
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "git+https://github.com/teads"
|
|
60
|
+
},
|
|
61
|
+
"author": "Teads Development Team",
|
|
62
|
+
"license": "Copyright © 2025 Teads. All rights reserved.",
|
|
63
|
+
"bugs": {
|
|
64
|
+
"url": "https://github.com/teads"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://developers.teads.com",
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
72
|
+
"@eslint/compat": "^1.2.7",
|
|
73
|
+
"@eslint/eslintrc": "^3.3.0",
|
|
74
|
+
"@eslint/js": "^9.22.0",
|
|
75
|
+
"@evilmartians/lefthook": "^1.5.0",
|
|
76
|
+
"@react-native-community/cli": "15.0.1",
|
|
77
|
+
"@react-native/eslint-config": "^0.78.0",
|
|
78
|
+
"@release-it/conventional-changelog": "^9.0.2",
|
|
79
|
+
"@types/jest": "^29.5.5",
|
|
80
|
+
"@types/react": "^19.0.0",
|
|
81
|
+
"commitlint": "^19.6.1",
|
|
82
|
+
"del-cli": "^5.1.0",
|
|
83
|
+
"eslint": "^9.22.0",
|
|
84
|
+
"eslint-config-prettier": "^10.1.1",
|
|
85
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
86
|
+
"jest": "^29.7.0",
|
|
87
|
+
"prettier": "^3.0.3",
|
|
88
|
+
"react": "19.0.0",
|
|
89
|
+
"react-native": "0.78.2",
|
|
90
|
+
"react-native-builder-bob": "^0.40.12",
|
|
91
|
+
"react-native-codegen": "^0.70.7",
|
|
92
|
+
"react-native-safe-area-context": "^5.4.0",
|
|
93
|
+
"release-it": "^17.10.0",
|
|
94
|
+
"turbo": "^1.10.7",
|
|
95
|
+
"typescript": "^5.2.2"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"react": "*",
|
|
99
|
+
"react-native": "*",
|
|
100
|
+
"react-native-safe-area-context": ">=4.0.0"
|
|
101
|
+
},
|
|
102
|
+
"workspaces": [
|
|
103
|
+
"example"
|
|
104
|
+
],
|
|
105
|
+
"packageManager": "yarn@3.6.1",
|
|
106
|
+
"jest": {
|
|
107
|
+
"preset": "react-native",
|
|
108
|
+
"modulePathIgnorePatterns": [
|
|
109
|
+
"<rootDir>/example/node_modules",
|
|
110
|
+
"<rootDir>/lib/"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"commitlint": {
|
|
114
|
+
"extends": [
|
|
115
|
+
"@commitlint/config-conventional"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"release-it": {
|
|
119
|
+
"git": {
|
|
120
|
+
"commitMessage": "chore: release ${version}",
|
|
121
|
+
"tagName": "v${version}"
|
|
122
|
+
},
|
|
123
|
+
"npm": {
|
|
124
|
+
"publish": true
|
|
125
|
+
},
|
|
126
|
+
"github": {
|
|
127
|
+
"release": true
|
|
128
|
+
},
|
|
129
|
+
"plugins": {
|
|
130
|
+
"@release-it/conventional-changelog": {
|
|
131
|
+
"preset": {
|
|
132
|
+
"name": "angular"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"eslintConfig": {
|
|
138
|
+
"root": true,
|
|
139
|
+
"extends": [
|
|
140
|
+
"@react-native",
|
|
141
|
+
"prettier"
|
|
142
|
+
],
|
|
143
|
+
"rules": {
|
|
144
|
+
"react/react-in-jsx-scope": "off",
|
|
145
|
+
"prettier/prettier": [
|
|
146
|
+
"error",
|
|
147
|
+
{
|
|
148
|
+
"quoteProps": "consistent",
|
|
149
|
+
"singleQuote": true,
|
|
150
|
+
"tabWidth": 2,
|
|
151
|
+
"trailingComma": "es5",
|
|
152
|
+
"useTabs": false
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"eslintIgnore": [
|
|
158
|
+
"node_modules/",
|
|
159
|
+
"lib/"
|
|
160
|
+
],
|
|
161
|
+
"prettier": {
|
|
162
|
+
"quoteProps": "consistent",
|
|
163
|
+
"singleQuote": true,
|
|
164
|
+
"tabWidth": 2,
|
|
165
|
+
"trailingComma": "es5",
|
|
166
|
+
"useTabs": false
|
|
167
|
+
},
|
|
168
|
+
"react-native-builder-bob": {
|
|
169
|
+
"source": "src",
|
|
170
|
+
"output": "lib",
|
|
171
|
+
"targets": [
|
|
172
|
+
"codegen",
|
|
173
|
+
[
|
|
174
|
+
"commonjs",
|
|
175
|
+
{
|
|
176
|
+
"esm": true
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
[
|
|
180
|
+
"module",
|
|
181
|
+
{
|
|
182
|
+
"esm": true
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
[
|
|
186
|
+
"typescript",
|
|
187
|
+
{
|
|
188
|
+
"project": "tsconfig.build.json"
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"engines": {
|
|
194
|
+
"node": ">=20.19.0"
|
|
195
|
+
},
|
|
196
|
+
"codegenConfig": {
|
|
197
|
+
"name": "RNTeadsReactNativeViewSpec",
|
|
198
|
+
"type": "all",
|
|
199
|
+
"jsSrcsDir": "src",
|
|
200
|
+
"outputDir": {
|
|
201
|
+
"ios": "ios/generated",
|
|
202
|
+
"android": "android/generated"
|
|
203
|
+
},
|
|
204
|
+
"android": {
|
|
205
|
+
"javaPackageName": "tv.teads.reactnative"
|
|
206
|
+
},
|
|
207
|
+
"ios": {
|
|
208
|
+
"componentProvider": {
|
|
209
|
+
"TeadsAdPlacementFeed": "RCTTeadsAdPlacementFeed",
|
|
210
|
+
"TeadsAdPlacementMedia": "RCTTeadsAdPlacementMedia"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"includesGeneratedCode": true
|
|
214
|
+
},
|
|
215
|
+
"create-react-native-library": {
|
|
216
|
+
"languages": "kotlin-objc",
|
|
217
|
+
"type": "fabric-view",
|
|
218
|
+
"version": "0.49.8"
|
|
219
|
+
},
|
|
220
|
+
"dependencies": {
|
|
221
|
+
"@react-native/gradle-plugin": "0.78.2",
|
|
222
|
+
"@react-navigation/native": "^7.1.6",
|
|
223
|
+
"@react-navigation/stack": "^7.2.10",
|
|
224
|
+
"react-native-gesture-handler": "^2.29.1",
|
|
225
|
+
"react-native-inappbrowser-reborn": "^3.7.0"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TeadsAdPlacementHandler } from './types';
|
|
2
|
+
import { TeadsInAppBrowser } from './TeadsInAppBrowser';
|
|
3
|
+
|
|
4
|
+
const DefaultHandler: TeadsAdPlacementHandler = {
|
|
5
|
+
onHeightChange: (_newHeight) => {},
|
|
6
|
+
onRecClick: (url) => {
|
|
7
|
+
console.log('onRecClick', url);
|
|
8
|
+
// no need to open - SDK will open outside of the app
|
|
9
|
+
},
|
|
10
|
+
onOrganicClick: (url) => {
|
|
11
|
+
console.log('onOrganicClick', url);
|
|
12
|
+
TeadsInAppBrowser.open(url);
|
|
13
|
+
},
|
|
14
|
+
onWidgetEvent: (_eventName, _data) => {},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default DefaultHandler;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
NativeModules,
|
|
5
|
+
type ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type {
|
|
8
|
+
TeadsAdPlacementFeedProps,
|
|
9
|
+
TeadsAdPlacementHandler,
|
|
10
|
+
TeadsAdPlacementFeedDefaultProps,
|
|
11
|
+
} from './types';
|
|
12
|
+
import DefaultHandler from './DefaultTeadsWidgetHandler';
|
|
13
|
+
import { packageVersion } from './version';
|
|
14
|
+
import TeadsAdPlacementFeedNative from './WebViewNativeComponent';
|
|
15
|
+
import { requiredPropsNames } from './constants';
|
|
16
|
+
|
|
17
|
+
class TeadsWidgetCls extends React.Component<TeadsAdPlacementFeedProps> {
|
|
18
|
+
static defaultProps = {
|
|
19
|
+
darkMode: false,
|
|
20
|
+
} as TeadsAdPlacementFeedDefaultProps;
|
|
21
|
+
|
|
22
|
+
private widgetRandomId: number;
|
|
23
|
+
private eventEmitter: NativeEventEmitter;
|
|
24
|
+
private handler: TeadsAdPlacementHandler;
|
|
25
|
+
listeners: Array<{ remove: () => void }> = [];
|
|
26
|
+
private _isMounted: boolean = false;
|
|
27
|
+
|
|
28
|
+
state = {
|
|
29
|
+
height: 0,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
constructor(props: TeadsAdPlacementFeedProps) {
|
|
33
|
+
super(props);
|
|
34
|
+
|
|
35
|
+
requiredPropsNames.forEach((propName) => {
|
|
36
|
+
if (props[propName] === undefined || props[propName] === null) {
|
|
37
|
+
throw new Error(`Missing required prop: ${propName}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
this.widgetRandomId = Math.floor(Math.random() * 1000000); // random ID to identify the widget instance
|
|
42
|
+
this.handler = props.handler === undefined ? DefaultHandler : props.handler;
|
|
43
|
+
this.eventEmitter = new NativeEventEmitter(NativeModules.TeadsEventModule);
|
|
44
|
+
|
|
45
|
+
this.handleHeightChange = this.handleHeightChange.bind(this);
|
|
46
|
+
this.handleRecClick = this.handleRecClick.bind(this);
|
|
47
|
+
this.handleOrganicClick = this.handleOrganicClick.bind(this);
|
|
48
|
+
this.handleWidgetEvent = this.handleWidgetEvent.bind(this);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
componentDidMount() {
|
|
52
|
+
this._isMounted = true;
|
|
53
|
+
this.setupEventListeners();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
componentWillUnmount() {
|
|
57
|
+
this._isMounted = false;
|
|
58
|
+
this.listeners.forEach((listener) => listener.remove());
|
|
59
|
+
this.listeners = [];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
setupEventListeners() {
|
|
63
|
+
const events = [
|
|
64
|
+
{ name: 'didChangeHeight', handler: this.handleHeightChange },
|
|
65
|
+
{ name: 'onRecClick', handler: this.handleRecClick },
|
|
66
|
+
{ name: 'onOrganicClick', handler: this.handleOrganicClick },
|
|
67
|
+
{ name: 'onWidgetEvent', handler: this.handleWidgetEvent },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
events.forEach((event) => {
|
|
71
|
+
const listener = this.eventEmitter.addListener(event.name, event.handler);
|
|
72
|
+
this.listeners.push(listener);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
handleHeightChange(event: any) {
|
|
77
|
+
if (event.widgetRandomId !== this.widgetRandomId) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// Guard against setState on unmounted component
|
|
81
|
+
if (!this._isMounted) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.log(`${this.props.widgetId}; onHeightChange: ${event.height} - was: ${this.state.height}`);
|
|
85
|
+
if (event.height != this.state.height) {
|
|
86
|
+
this.setState({ height: event.height });
|
|
87
|
+
console.log(`${this.props.widgetId}; onHeightChange: ${event.height}`);
|
|
88
|
+
this.handler.onHeightChange?.(event.height);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleRecClick(event: any) {
|
|
93
|
+
if (event.widgetRandomId !== this.widgetRandomId || !this._isMounted) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(`${this.props.widgetId}; onRecClick`);
|
|
98
|
+
this.handler.onRecClick?.(event.url);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
handleOrganicClick(event: any) {
|
|
102
|
+
if (event.widgetRandomId !== this.widgetRandomId || !this._isMounted) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log(`${this.props.widgetId}; onOrganicClick`);
|
|
107
|
+
this.handler.onOrganicClick?.(event.url);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
handleWidgetEvent(event: any) {
|
|
111
|
+
if (event.widgetRandomId !== this.widgetRandomId || !this._isMounted) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
console.log(`${this.props.widgetId}; onWidgetEvent: ${event.eventName}`);
|
|
116
|
+
this.handler.onWidgetEvent?.(event.eventName, event.additionalData);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
render() {
|
|
120
|
+
return (
|
|
121
|
+
<TeadsAdPlacementFeedNative
|
|
122
|
+
style={{ height: this.state.height } as ViewStyle}
|
|
123
|
+
widgetId={this.props.widgetId}
|
|
124
|
+
widgetRandomId={this.widgetRandomId}
|
|
125
|
+
widgetIndex={this.props.widgetIndex}
|
|
126
|
+
url={this.props.articleUrl}
|
|
127
|
+
installationKey={this.props.partnerKey}
|
|
128
|
+
packageVersion={packageVersion}
|
|
129
|
+
extId={this.props.extId}
|
|
130
|
+
extSecondaryId={this.props.extSecondaryId}
|
|
131
|
+
userId={this.props.userId}
|
|
132
|
+
pubImpId={this.props.pubImpId}
|
|
133
|
+
darkMode={this.props.darkMode}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// This is a workaround to be able to export the class-based component
|
|
140
|
+
export function TeadsAdPlacementFeed(props: TeadsAdPlacementFeedProps) {
|
|
141
|
+
return <TeadsWidgetCls {...props} />;
|
|
142
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
NativeModules,
|
|
5
|
+
type ViewStyle,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import type {
|
|
8
|
+
TeadsAdPlacementHandler,
|
|
9
|
+
TeadsAdPlacementFeedDefaultProps,
|
|
10
|
+
TeadsAdPlacementMediaProps,
|
|
11
|
+
} from './types';
|
|
12
|
+
import DefaultHandler from './DefaultTeadsWidgetHandler';
|
|
13
|
+
import { packageVersion } from './version';
|
|
14
|
+
import TeadsAdPlacementMediaNativeComponent from './TeadsMediaNativeComponent';
|
|
15
|
+
import { teadsRequiredPropsNames } from './constants';
|
|
16
|
+
|
|
17
|
+
class TeadsAdPlacementMediaCls extends React.Component<TeadsAdPlacementMediaProps> {
|
|
18
|
+
static defaultProps = {
|
|
19
|
+
darkMode: false,
|
|
20
|
+
} as TeadsAdPlacementFeedDefaultProps;
|
|
21
|
+
|
|
22
|
+
private widgetRandomId: number;
|
|
23
|
+
private eventEmitter: NativeEventEmitter;
|
|
24
|
+
private handler: TeadsAdPlacementHandler;
|
|
25
|
+
listeners: Array<{ remove: () => void }> = [];
|
|
26
|
+
private _isMounted: boolean = false;
|
|
27
|
+
|
|
28
|
+
state = {
|
|
29
|
+
height: 0,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
constructor(props: TeadsAdPlacementMediaProps) {
|
|
33
|
+
super(props);
|
|
34
|
+
|
|
35
|
+
teadsRequiredPropsNames.forEach((propName) => {
|
|
36
|
+
if (props[propName] === undefined || props[propName] === null) {
|
|
37
|
+
throw new Error(`Missing required prop: ${propName}`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
this.widgetRandomId = Math.floor(Math.random() * 1000000); // random ID to identify the widget instance
|
|
42
|
+
this.handler = props.handler === undefined ? DefaultHandler : props.handler;
|
|
43
|
+
this.eventEmitter = new NativeEventEmitter(NativeModules.TeadsEventModule);
|
|
44
|
+
|
|
45
|
+
this.handleHeightChange = this.handleHeightChange.bind(this);
|
|
46
|
+
this.handleRecClick = this.handleRecClick.bind(this);
|
|
47
|
+
this.handleWidgetEvent = this.handleWidgetEvent.bind(this);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
componentDidMount() {
|
|
51
|
+
this._isMounted = true;
|
|
52
|
+
this.setupEventListeners();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
componentWillUnmount() {
|
|
56
|
+
this._isMounted = false;
|
|
57
|
+
this.listeners.forEach((listener) => listener.remove());
|
|
58
|
+
this.listeners = [];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
setupEventListeners() {
|
|
62
|
+
const events = [
|
|
63
|
+
{ name: 'didChangeHeight', handler: this.handleHeightChange },
|
|
64
|
+
{ name: 'onRecClick', handler: this.handleRecClick },
|
|
65
|
+
{ name: 'onWidgetEvent', handler: this.handleWidgetEvent },
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
events.forEach((event) => {
|
|
69
|
+
const listener = this.eventEmitter.addListener(event.name, event.handler);
|
|
70
|
+
this.listeners.push(listener);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
handleHeightChange(event: any) {
|
|
75
|
+
if (event.widgetRandomId !== this.widgetRandomId) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Guard against setState on unmounted component
|
|
79
|
+
if (!this._isMounted) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (event.height !== this.state.height) {
|
|
84
|
+
this.setState({ height: event.height });
|
|
85
|
+
console.log(`TeadsAdPlacementMediaCls: pid: ${this.props.pid}; onHeightChange: ${event.height}`);
|
|
86
|
+
this.handler.onHeightChange?.(event.height);
|
|
87
|
+
} else {
|
|
88
|
+
console.log(`TeadsAdPlacementMediaCls: pid: ${this.props.pid}; onHeightChange: ${event.height} (no change)`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
handleRecClick(event: any) {
|
|
93
|
+
if (event.widgetRandomId !== this.widgetRandomId || !this._isMounted) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
console.log(`TeadsWidget: pid: ${this.props.pid}; onRecClick`);
|
|
98
|
+
this.handler.onRecClick?.(event.url);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
handleWidgetEvent(event: any) {
|
|
102
|
+
if (event.widgetRandomId !== this.widgetRandomId || !this._isMounted) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log(`TeadsWidget: pid: ${this.props.pid}; onWidgetEvent: ${event.eventName}`);
|
|
107
|
+
this.handler.onWidgetEvent?.(event.eventName, event.additionalData);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
render() {
|
|
111
|
+
return (
|
|
112
|
+
<TeadsAdPlacementMediaNativeComponent
|
|
113
|
+
style={{ height: this.state.height } as ViewStyle}
|
|
114
|
+
widgetRandomId={this.widgetRandomId}
|
|
115
|
+
url={this.props.url}
|
|
116
|
+
pid={this.props.pid}
|
|
117
|
+
packageVersion={packageVersion}
|
|
118
|
+
installationKey={this.props.installationKey}
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// This is a workaround to be able to export the class-based component
|
|
125
|
+
export function TeadsAdPlacementMedia(props: TeadsAdPlacementMediaProps) {
|
|
126
|
+
return <TeadsAdPlacementMediaCls {...props} />;
|
|
127
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Linking } from 'react-native';
|
|
2
|
+
import { InAppBrowser } from 'react-native-inappbrowser-reborn';
|
|
3
|
+
|
|
4
|
+
export const TeadsInAppBrowser = Object.freeze({
|
|
5
|
+
open: async function (url: string) {
|
|
6
|
+
try {
|
|
7
|
+
if (InAppBrowser?.isAvailable && (await InAppBrowser.isAvailable())) {
|
|
8
|
+
await InAppBrowser.open(url, {
|
|
9
|
+
// iOS Properties
|
|
10
|
+
readerMode: false,
|
|
11
|
+
animated: true,
|
|
12
|
+
modalPresentationStyle: 'fullScreen',
|
|
13
|
+
modalTransitionStyle: 'coverVertical',
|
|
14
|
+
modalEnabled: true,
|
|
15
|
+
enableBarCollapsing: false,
|
|
16
|
+
// Android Properties
|
|
17
|
+
showTitle: true,
|
|
18
|
+
enableUrlBarHiding: true,
|
|
19
|
+
enableDefaultShare: true,
|
|
20
|
+
forceCloseOnRedirection: false,
|
|
21
|
+
// Specify full animation resource identifier(package:anim/name)
|
|
22
|
+
// or only resource name(in case of animation bundled with app).
|
|
23
|
+
animations: {
|
|
24
|
+
startEnter: 'slide_in_right',
|
|
25
|
+
startExit: 'slide_out_left',
|
|
26
|
+
endEnter: 'slide_in_left',
|
|
27
|
+
endExit: 'slide_out_right',
|
|
28
|
+
},
|
|
29
|
+
headers: {
|
|
30
|
+
'my-custom-header': 'my custom header value',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
await Linking.openURL(url);
|
|
35
|
+
}
|
|
36
|
+
} catch (error) {
|
|
37
|
+
console.log('Error opening URL:', error);
|
|
38
|
+
// Fallback to Linking.openURL if InAppBrowser fails
|
|
39
|
+
await Linking.openURL(url);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface NativeProps extends ViewProps {
|
|
6
|
+
pid: string;
|
|
7
|
+
widgetRandomId: Int32;
|
|
8
|
+
url: string;
|
|
9
|
+
packageVersion: string;
|
|
10
|
+
installationKey?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default codegenNativeComponent<NativeProps>(
|
|
14
|
+
'TeadsAdPlacementMedia'
|
|
15
|
+
) as HostComponent<NativeProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
3
|
+
import type { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
|
|
4
|
+
|
|
5
|
+
export interface NativeProps extends ViewProps {
|
|
6
|
+
widgetId: string;
|
|
7
|
+
widgetRandomId: Int32;
|
|
8
|
+
widgetIndex: Int32;
|
|
9
|
+
url: string;
|
|
10
|
+
installationKey: string;
|
|
11
|
+
packageVersion: string;
|
|
12
|
+
extId?: string;
|
|
13
|
+
extSecondaryId?: string;
|
|
14
|
+
userId?: string;
|
|
15
|
+
pubImpId?: string;
|
|
16
|
+
darkMode?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default codegenNativeComponent<NativeProps>(
|
|
20
|
+
'TeadsAdPlacementFeed'
|
|
21
|
+
) as HostComponent<NativeProps>;
|
package/src/constants.ts
ADDED
package/src/index.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { TeadsAdPlacementFeed } from './TeadsAdPlacementFeed';
|
|
2
|
+
export { TeadsAdPlacementMedia } from './TeadsAdPlacementMedia';
|
|
3
|
+
export type {
|
|
4
|
+
TeadsAdPlacementHandler,
|
|
5
|
+
TeadsAdPlacementFeedProps,
|
|
6
|
+
TeadsAdPlacementFeedDefaultProps,
|
|
7
|
+
TeadsAdPlacementMediaProps,
|
|
8
|
+
NativeComponentProps,
|
|
9
|
+
} from './types';
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface TeadsAdPlacementHandler {
|
|
2
|
+
onHeightChange?: (newHeight: number) => void;
|
|
3
|
+
onRecClick?: (url: string) => void;
|
|
4
|
+
onOrganicClick?: (url: string) => void;
|
|
5
|
+
onWidgetEvent?: (eventName: string, data: { [key: string]: any }) => void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface TeadsAdPlacementFeedProps {
|
|
9
|
+
widgetId: string;
|
|
10
|
+
widgetIndex: number;
|
|
11
|
+
articleUrl: string;
|
|
12
|
+
partnerKey: string;
|
|
13
|
+
extId?: string;
|
|
14
|
+
extSecondaryId?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
pubImpId?: string;
|
|
17
|
+
darkMode?: boolean;
|
|
18
|
+
handler?: TeadsAdPlacementHandler;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface TeadsAdPlacementMediaProps {
|
|
22
|
+
pid: string;
|
|
23
|
+
url: string;
|
|
24
|
+
installationKey?: string;
|
|
25
|
+
handler?: TeadsAdPlacementHandler;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type TeadsAdPlacementFeedDefaultProps = {
|
|
29
|
+
darkMode: boolean;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type NativeComponentProps = React.ComponentProps<typeof View>;
|
package/src/version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const packageVersion = '6.0.2';
|