tapjoy-react-native-sdk 14.4.0 → 14.6.0

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.
Files changed (54) hide show
  1. package/android/build.gradle +8 -15
  2. package/android/gradle.properties +3 -3
  3. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeView.kt +2 -2
  4. package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +21 -16
  5. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +130 -87
  6. package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkPackage.kt +29 -5
  7. package/example/android/app/build.gradle +1 -1
  8. package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +2 -8
  9. package/example/android/build.gradle +4 -4
  10. package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  11. package/example/android/gradle.properties +5 -0
  12. package/example/ios/Podfile +2 -1
  13. package/example/ios/TapjoyReactNativeSdkExample/Info.plist +3 -1
  14. package/example/ios/TapjoyReactNativeSdkExample.xcodeproj/project.pbxproj +0 -45
  15. package/example/metro.config.js +9 -15
  16. package/example/package.json +19 -16
  17. package/example/scripts/set-arch.sh +25 -0
  18. package/example/src/App.tsx +1 -2
  19. package/example/src/MainScreen.tsx +76 -60
  20. package/example/src/OfferwallDiscoverScreen.tsx +105 -91
  21. package/example/src/OfferwallScreen.tsx +170 -156
  22. package/example/src/Styles.ts +3 -2
  23. package/example/src/UserProperties.tsx +170 -136
  24. package/ios/TJOfferwallDiscoverNativeViewManager.m +11 -1
  25. package/ios/TJOfferwallDiscoverNativeViewManager.swift +2 -2
  26. package/ios/TapjoyReactNativeSdk.m +36 -15
  27. package/ios/TapjoyReactNativeSdk.swift +24 -4
  28. package/lib/commonjs/NativeTapjoyReactNativeSdk.js +2 -0
  29. package/lib/commonjs/TJOfferwallDiscoverView.js +43 -16
  30. package/lib/commonjs/TJOfferwallDiscoverViewNativeComponent.js +6 -0
  31. package/lib/commonjs/TJPlacement.js +17 -13
  32. package/lib/commonjs/TJPrivacyPolicy.js +81 -11
  33. package/lib/commonjs/TJVersion.js +1 -1
  34. package/lib/commonjs/Tapjoy.js +16 -10
  35. package/lib/commonjs/index.js +2 -1
  36. package/lib/commonjs/utils/ArchitectureDetection.js +7 -0
  37. package/lib/typescript/NativeTapjoyReactNativeSdk.d.ts +53 -0
  38. package/lib/typescript/TJOfferwallDiscoverView.d.ts +3 -12
  39. package/lib/typescript/TJOfferwallDiscoverViewNativeComponent.d.ts +21 -0
  40. package/lib/typescript/TJPrivacyPolicy.d.ts +29 -1
  41. package/lib/typescript/Tapjoy.d.ts +1 -1
  42. package/lib/typescript/index.d.ts +5 -3
  43. package/lib/typescript/utils/ArchitectureDetection.d.ts +5 -0
  44. package/package.json +14 -16
  45. package/src/NativeTapjoyReactNativeSdk.ts +117 -0
  46. package/src/TJOfferwallDiscoverView.tsx +56 -39
  47. package/src/TJOfferwallDiscoverViewNativeComponent.ts +37 -0
  48. package/src/TJPlacement.ts +17 -13
  49. package/src/TJPrivacyPolicy.ts +84 -12
  50. package/src/TJVersion.ts +1 -1
  51. package/src/Tapjoy.ts +20 -13
  52. package/src/index.ts +13 -3
  53. package/src/utils/ArchitectureDetection.ts +14 -0
  54. package/tapjoy-react-native-sdk.podspec +1 -1
@@ -1,8 +1,12 @@
1
1
  import { NativeEventEmitter, NativeModules } from 'react-native';
2
2
  import { EventEmitter } from 'eventemitter3';
3
3
  import TJEntryPoint from './TJEntryPoint';
4
- const Tapjoy = NativeModules.TapjoyReactNativeSdk;
5
- const TapjoyEmitter = new NativeEventEmitter(Tapjoy);
4
+ import NativeTapjoyReactNativeSdk from './NativeTapjoyReactNativeSdk';
5
+ import { isTurboModuleEnabled } from './utils/ArchitectureDetection';
6
+ const TapjoyNative = isTurboModuleEnabled()
7
+ ? NativeTapjoyReactNativeSdk
8
+ : NativeModules.TapjoyReactNativeSdk;
9
+ const TapjoyEmitter = new NativeEventEmitter(TapjoyNative);
6
10
  const TapjoyEventType = 'TapjoyPlacement';
7
11
  class TJPlacement extends EventEmitter {
8
12
  static REQUEST_DID_SUCCEED = 'requestDidSucceed';
@@ -37,7 +41,7 @@ class TJPlacement extends EventEmitter {
37
41
  super();
38
42
  this.name = name;
39
43
  this.error = undefined;
40
- Tapjoy.createPlacement(this.name);
44
+ TapjoyNative.createPlacement(this.name);
41
45
  }
42
46
  /**
43
47
  * Request placement content.
@@ -63,7 +67,7 @@ class TJPlacement extends EventEmitter {
63
67
  this.emit(TJPlacement.CONTENT_IS_READY, this);
64
68
  }
65
69
  });
66
- Tapjoy.requestPlacement(this.name);
70
+ TapjoyNative.requestPlacement(this.name);
67
71
  }
68
72
  /**
69
73
  * Displays the content associated with the placement.
@@ -79,7 +83,7 @@ class TJPlacement extends EventEmitter {
79
83
  this.emit(TJPlacement.CONTENT_DID_DISAPPEAR, this);
80
84
  }
81
85
  });
82
- Tapjoy.showPlacement(this.name);
86
+ TapjoyNative.showPlacement(this.name);
83
87
  }
84
88
  /**
85
89
  * Checks whether the content is ready for use.
@@ -87,7 +91,7 @@ class TJPlacement extends EventEmitter {
87
91
  * @returns {boolean} True if the content is ready; otherwise, false.
88
92
  */
89
93
  isContentReady() {
90
- return Tapjoy.isContentReady(this.name);
94
+ return TapjoyNative.isContentReady(this.name);
91
95
  }
92
96
  /**
93
97
  * Checks whether the content is available for use.
@@ -95,7 +99,7 @@ class TJPlacement extends EventEmitter {
95
99
  * @returns {boolean} True if the content is available; otherwise, false.
96
100
  */
97
101
  isContentAvailable() {
98
- return Tapjoy.isContentAvailable(this.name);
102
+ return TapjoyNative.isContentAvailable(this.name);
99
103
  }
100
104
  /**
101
105
  * Sets the currency balance for given currency id.
@@ -104,7 +108,7 @@ class TJPlacement extends EventEmitter {
104
108
  * @param {Number} currencyBalance - The amount of the currency to set. Must be greater than or equal to 0.
105
109
  */
106
110
  async setCurrencyBalance(currencyId, currencyBalance) {
107
- await Tapjoy.setCurrencyBalance(currencyBalance, currencyId, this.name);
111
+ await TapjoyNative.setCurrencyBalance(currencyBalance, currencyId, this.name);
108
112
  }
109
113
  /**
110
114
  * Gets the currency balance for given currency id.
@@ -113,7 +117,7 @@ class TJPlacement extends EventEmitter {
113
117
  * @return {Number} currencyBalance - The amount of the currency.
114
118
  */
115
119
  async getCurrencyBalance(currencyId) {
116
- return await Tapjoy.getPlacementCurrencyBalance(currencyId, this.name);
120
+ return await TapjoyNative.getPlacementCurrencyBalance(currencyId, this.name);
117
121
  }
118
122
  /**
119
123
  * Sets the currency amount required
@@ -122,7 +126,7 @@ class TJPlacement extends EventEmitter {
122
126
  * @param {String} currencyId The identifier of the currency.
123
127
  */
124
128
  async setRequiredAmount(amount, currencyId) {
125
- await Tapjoy.setRequiredAmount(amount, currencyId, this.name);
129
+ await TapjoyNative.setRequiredAmount(amount, currencyId, this.name);
126
130
  }
127
131
  /**
128
132
  * Gets the currency amount required.
@@ -131,7 +135,7 @@ class TJPlacement extends EventEmitter {
131
135
  * @return {Number} The amount of currency the user needs. -1 if not available.
132
136
  */
133
137
  async getRequiredAmount(currencyId) {
134
- return await Tapjoy.getRequiredAmount(currencyId, this.name);
138
+ return await TapjoyNative.getRequiredAmount(currencyId, this.name);
135
139
  }
136
140
  /**
137
141
  * Sets the entry point for this placement instance.
@@ -140,7 +144,7 @@ class TJPlacement extends EventEmitter {
140
144
  * @see TJEntryPoint
141
145
  */
142
146
  setEntryPoint(entryPoint) {
143
- Tapjoy.setEntryPoint(this.name, Object.values(TJEntryPoint).indexOf(entryPoint));
147
+ TapjoyNative.setEntryPoint(this.name, Object.values(TJEntryPoint).indexOf(entryPoint));
144
148
  }
145
149
  /**
146
150
  * Gets the entry point for this placement instance.
@@ -149,7 +153,7 @@ class TJPlacement extends EventEmitter {
149
153
  * @see TJEntryPoint
150
154
  */
151
155
  async getEntryPoint() {
152
- const entryPointValue = Object.values(TJEntryPoint)[await Tapjoy.getEntryPoint(this.name)];
156
+ const entryPointValue = Object.values(TJEntryPoint)[await TapjoyNative.getEntryPoint(this.name)];
153
157
  return entryPointValue;
154
158
  }
155
159
  }
@@ -1,9 +1,24 @@
1
1
  import { NativeModules, Platform } from 'react-native';
2
- const Tapjoy = NativeModules.TapjoyReactNativeSdk;
2
+ import NativeTapjoyReactNativeSdk from './NativeTapjoyReactNativeSdk';
3
+ import { isTurboModuleEnabled } from './utils/ArchitectureDetection';
4
+ import TJStatus from './TJStatus';
5
+ const LINKING_ERROR = `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
6
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
7
+ '- You rebuilt the app after installing the package\n' +
8
+ '- You are not using Expo Go\n';
9
+ const TapjoyAPI = isTurboModuleEnabled()
10
+ ? NativeTapjoyReactNativeSdk
11
+ : NativeModules.TapjoyReactNativeSdk
12
+ ? NativeModules.TapjoyReactNativeSdk
13
+ : new Proxy({}, {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ });
3
18
  class TJPrivacyPolicy {
4
19
  async getBelowConsentAge() {
5
20
  try {
6
- let isBelowConsentAge = await Tapjoy.getBelowConsentAge();
21
+ let isBelowConsentAge = await TapjoyAPI.getBelowConsentAge();
7
22
  return isBelowConsentAge;
8
23
  }
9
24
  catch (err) {
@@ -13,7 +28,7 @@ class TJPrivacyPolicy {
13
28
  }
14
29
  async getSubjectToGDPR() {
15
30
  try {
16
- let isSubjectToGDPR = await Tapjoy.getSubjectToGDPR();
31
+ let isSubjectToGDPR = await TapjoyAPI.getSubjectToGDPR();
17
32
  return isSubjectToGDPR;
18
33
  }
19
34
  catch (err) {
@@ -22,11 +37,11 @@ class TJPrivacyPolicy {
22
37
  }
23
38
  }
24
39
  setUSPrivacy(usPrivacy) {
25
- Tapjoy.setUSPrivacy(usPrivacy);
40
+ TapjoyAPI.setUSPrivacy(usPrivacy);
26
41
  }
27
42
  async getUSPrivacy() {
28
43
  try {
29
- let usPrivacy = await Tapjoy.getUSPrivacy();
44
+ let usPrivacy = await TapjoyAPI.getUSPrivacy();
30
45
  return usPrivacy;
31
46
  }
32
47
  catch (err) {
@@ -36,7 +51,7 @@ class TJPrivacyPolicy {
36
51
  }
37
52
  async getUserConsent() {
38
53
  try {
39
- let userConsent = await Tapjoy.getUserConsent();
54
+ let userConsent = await TapjoyAPI.getUserConsent();
40
55
  return userConsent;
41
56
  }
42
57
  catch (err) {
@@ -44,18 +59,73 @@ class TJPrivacyPolicy {
44
59
  throw err;
45
60
  }
46
61
  }
62
+ /**
63
+ * WARNING: EXPERIMENTAL API - DO NOT USE IT
64
+ *
65
+ * Android only.
66
+ *
67
+ * This method is experimental and intended for internal purposes only.
68
+ *
69
+ * Returns the user's consent status for accessing Android's Usage Stats API.
70
+ *
71
+ * @return TJStatus.True if the user agrees, TJStatus.False otherwise
72
+ */
73
+ async getUsageStatsConsent() {
74
+ if (Platform.OS === 'android') {
75
+ try {
76
+ return await TapjoyAPI.getUsageStatsConsent();
77
+ }
78
+ catch (err) {
79
+ console.error(err);
80
+ throw err;
81
+ }
82
+ }
83
+ else {
84
+ console.warn('getUsageStatsConsent is only supported on Android.');
85
+ return Promise.resolve(TJStatus.Unknown);
86
+ }
87
+ }
47
88
  setBelowConsentAgeStatus(isBelowConsentAgeStatus) {
48
- Tapjoy.setBelowConsentAgeStatus(isBelowConsentAgeStatus);
89
+ TapjoyAPI.setBelowConsentAgeStatus(isBelowConsentAgeStatus);
49
90
  }
50
91
  setSubjectToGDPRStatus(isSubjectToGDPRStatus) {
51
- Tapjoy.setSubjectToGDPRStatus(isSubjectToGDPRStatus);
92
+ TapjoyAPI.setSubjectToGDPRStatus(isSubjectToGDPRStatus);
52
93
  }
53
94
  setUserConsentStatus(userConsentStatus) {
54
- Tapjoy.setUserConsentStatus(userConsentStatus);
95
+ TapjoyAPI.setUserConsentStatus(userConsentStatus);
96
+ }
97
+ /**
98
+ * WARNING: EXPERIMENTAL API - DO NOT USE IT
99
+ *
100
+ * Android only.
101
+ *
102
+ * This method is experimental and intended for internal purposes only.
103
+ *
104
+ * Sets the user's consent status for accessing Android's Usage Stats API.
105
+ * The Android Usage Stats API (UsageStatsManager) allows apps to access
106
+ * data about app usage on the device.
107
+ *
108
+ * @param usageStatsConsent TJStatus.True if the user has granted permission
109
+ * to access their usage statistics, TJStatus.False
110
+ * if they have denied or not yet granted permission.
111
+ */
112
+ setUsageStatsConsent(usageStatsConsent) {
113
+ if (Platform.OS === 'android') {
114
+ try {
115
+ TapjoyAPI.setUsageStatsConsent(usageStatsConsent);
116
+ }
117
+ catch (err) {
118
+ console.error(err);
119
+ throw err;
120
+ }
121
+ }
122
+ else {
123
+ console.warn('setUsageStatsConsent is only supported on Android.');
124
+ }
55
125
  }
56
126
  optOutAdvertisingID(optOut) {
57
127
  if (Platform.OS === 'android') {
58
- Tapjoy.optOutAdvertisingID(optOut);
128
+ TapjoyAPI.optOutAdvertisingID(optOut);
59
129
  }
60
130
  else {
61
131
  console.warn('optOutAdvertisingID is only supported on Android.');
@@ -63,7 +133,7 @@ class TJPrivacyPolicy {
63
133
  }
64
134
  getOptOutAdvertisingID() {
65
135
  if (Platform.OS === 'android') {
66
- return Tapjoy.getOptOutAdvertisingID();
136
+ return TapjoyAPI.getOptOutAdvertisingID();
67
137
  }
68
138
  else {
69
139
  console.warn('getOptOutAdvertisingID is only supported on Android.');
@@ -1,4 +1,4 @@
1
- const REACT_LIBRARY_VERSION = '14.4.0';
1
+ const REACT_LIBRARY_VERSION = '14.6.0';
2
2
  const REACT_LIBRARY_VERSION_SUFFIX = '';
3
3
  export class TJVersion {
4
4
  // Returns the version of the plugin - eg: 1.0.0-alpha-rc1
@@ -1,17 +1,24 @@
1
1
  import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
2
2
  import TJConnect from './TJConnect';
3
3
  import TJLoggingLevel from './TJLoggingLevel';
4
+ import NativeTapjoyReactNativeSdk from './NativeTapjoyReactNativeSdk';
5
+ import { isTurboModuleEnabled } from './utils/ArchitectureDetection';
4
6
  const LINKING_ERROR = `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
5
7
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
8
  '- You rebuilt the app after installing the package\n' +
7
9
  '- You are not using Expo Go\n';
8
- const TapjoyAPI = NativeModules.TapjoyReactNativeSdk
9
- ? NativeModules.TapjoyReactNativeSdk
10
- : new Proxy({}, {
11
- get() {
12
- throw new Error(LINKING_ERROR);
13
- },
14
- });
10
+ const TapjoyAPI = isTurboModuleEnabled()
11
+ ? NativeTapjoyReactNativeSdk
12
+ : NativeModules.TapjoyReactNativeSdk
13
+ ? NativeModules.TapjoyReactNativeSdk
14
+ : new Proxy({}, {
15
+ get() {
16
+ throw new Error(LINKING_ERROR);
17
+ },
18
+ });
19
+ const NativeModuleForEmitter = isTurboModuleEnabled()
20
+ ? NativeTapjoyReactNativeSdk
21
+ : NativeModules.TapjoyReactNativeSdk;
15
22
  class Tapjoy {
16
23
  /**
17
24
  * Connects to the Tapjoy Server.
@@ -23,8 +30,7 @@ class Tapjoy {
23
30
  * @return true if successful or error message if failed.
24
31
  */
25
32
  static async connect(sdkKey, flags, onWarning) {
26
- const TJ = NativeModules.TapjoyReactNativeSdk;
27
- const TapjoyEmitter = new NativeEventEmitter(TJ);
33
+ const TapjoyEmitter = new NativeEventEmitter(NativeModuleForEmitter);
28
34
  const TapjoyEventType = 'Tapjoy';
29
35
  const subscription = TapjoyEmitter.addListener(TapjoyEventType, (event) => {
30
36
  if (event.name === TJConnect.TJC_CONNECT_WARNING) {
@@ -126,7 +132,7 @@ class Tapjoy {
126
132
  *
127
133
  * @param userID
128
134
  * user ID you wish to assign to this device
129
- * @return the user ID if successful or error message if failed.
135
+ * @return the user ID if successful or error message if failed.
130
136
  */
131
137
  static async setUserId(userID) {
132
138
  return await TapjoyAPI.setUserId(userID);
@@ -7,5 +7,6 @@ import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
7
7
  import TJPurchase from './TJPurchase';
8
8
  import TJLoggingLevel from './TJLoggingLevel';
9
9
  import Tapjoy from './Tapjoy';
10
- export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, TJLoggingLevel, };
10
+ import { isTurboModuleEnabled, isFabricEnabled } from './utils/ArchitectureDetection';
11
+ export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, TJLoggingLevel, isTurboModuleEnabled, isFabricEnabled, };
11
12
  export default Tapjoy;
@@ -0,0 +1,7 @@
1
+ import NativeTapjoyReactNativeSdk from '../NativeTapjoyReactNativeSdk';
2
+ export const isTurboModuleEnabled = () => {
3
+ return NativeTapjoyReactNativeSdk != null;
4
+ };
5
+ export const isFabricEnabled = () => {
6
+ return global.nativeFabricUIManager != null;
7
+ };
@@ -0,0 +1,53 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ connect(sdkKey: string, connectFlags: Object): Promise<boolean>;
4
+ isConnected(): boolean;
5
+ setLoggingLevel(loggingLevel: number): void;
6
+ getLoggingLevel(): Promise<number>;
7
+ setUserId(userId?: string): Promise<string>;
8
+ getUserId(): Promise<string>;
9
+ setUserLevel(userLevel: number): void;
10
+ getUserLevel(): Promise<number>;
11
+ setMaxLevel(maxLevel: number): void;
12
+ getMaxLevel(): Promise<number>;
13
+ setUserSegment(userSegment: number): void;
14
+ getUserSegment(): Promise<number>;
15
+ setUserTags(tags: Array<string>): void;
16
+ getUserTags(): Promise<Array<string>>;
17
+ clearUserTags(): void;
18
+ addUserTag(tag: string): void;
19
+ removeUserTag(tag: string): void;
20
+ setCustomParameter(customParameter: string): void;
21
+ getCustomParameter(): Promise<string>;
22
+ getCurrencyBalance(): Promise<Object>;
23
+ spendCurrency(amount: number): Promise<Object>;
24
+ awardCurrency(amount: number): Promise<Object>;
25
+ createPlacement(name: string): void;
26
+ requestPlacement(name: string): void;
27
+ showPlacement(name: string): void;
28
+ isContentReady(name: string): boolean;
29
+ isContentAvailable(name: string): boolean;
30
+ setEntryPoint(name: string, entryPoint: number): void;
31
+ getEntryPoint(name: string): Promise<number>;
32
+ setCurrencyBalance(amount: number, currencyId: string, placementName: string): Promise<Object>;
33
+ getPlacementCurrencyBalance(currencyId: string, placementName: string): Promise<number>;
34
+ setRequiredAmount(requiredAmount: number, currencyId: string, placementName: string): Promise<Object>;
35
+ getRequiredAmount(currencyId: string, placementName: string): Promise<number>;
36
+ trackPurchase(currencyCode: string, price: number): void;
37
+ setSubjectToGDPRStatus(gdprApplicableStatus: number): void;
38
+ getBelowConsentAge(): Promise<number>;
39
+ getSubjectToGDPR(): Promise<number>;
40
+ getUserConsent(): Promise<number>;
41
+ getUSPrivacy(): Promise<string>;
42
+ setBelowConsentAgeStatus(isBelowConsentAgeStatus: number): void;
43
+ setUSPrivacy(privacyValue: string): void;
44
+ setUserConsentStatus(userConsentStatus: number): void;
45
+ getUsageStatsConsent(): Promise<number>;
46
+ setUsageStatsConsent(usageStatsConsent: number): void;
47
+ optOutAdvertisingID(optOut: boolean): void;
48
+ getOptOutAdvertisingID(): Promise<boolean>;
49
+ addListener(eventName: string): void;
50
+ removeListeners(count: number): void;
51
+ }
52
+ declare const _default: Spec | null;
53
+ export default _default;
@@ -1,17 +1,8 @@
1
- import { ViewStyle } from 'react-native';
2
1
  import React from 'react';
3
- interface TJOfferwallDiscoverViewProps {
4
- style?: ViewStyle;
5
- onRequestSuccess?: Function;
6
- onRequestFailure?: Function;
7
- onContentReady?: Function;
8
- onContentError?: Function;
9
- }
10
- export default class TJOfferwallDiscoverView extends React.Component<TJOfferwallDiscoverViewProps> {
11
- nativeCompHandle: number | null;
12
- constructor(props: TJOfferwallDiscoverViewProps);
2
+ import type { TJOfferwallDiscoverViewProps as FabricProps } from './TJOfferwallDiscoverViewNativeComponent';
3
+ export default class TJOfferwallDiscoverView extends React.Component<FabricProps> {
4
+ private viewRef;
13
5
  render(): React.JSX.Element;
14
6
  requestContent(placement: string): void;
15
7
  clearContent(): void;
16
8
  }
17
- export {};
@@ -0,0 +1,21 @@
1
+ import type { ViewProps, HostComponent } from 'react-native';
2
+ import type React from 'react';
3
+ import type { BubblingEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4
+ export interface OfferwallDiscoverEventData {
5
+ result?: string;
6
+ errorCode?: Int32;
7
+ errorMessage?: string;
8
+ }
9
+ export interface TJOfferwallDiscoverViewProps extends ViewProps {
10
+ onRequestSuccess?: BubblingEventHandler<OfferwallDiscoverEventData>;
11
+ onRequestFailure?: BubblingEventHandler<OfferwallDiscoverEventData>;
12
+ onContentReady?: BubblingEventHandler<OfferwallDiscoverEventData>;
13
+ onContentError?: BubblingEventHandler<OfferwallDiscoverEventData>;
14
+ }
15
+ export interface NativeCommands {
16
+ requestContent: (viewRef: React.ElementRef<HostComponent<TJOfferwallDiscoverViewProps>>, placement: string) => void;
17
+ clearContent: (viewRef: React.ElementRef<HostComponent<TJOfferwallDiscoverViewProps>>) => void;
18
+ }
19
+ export declare const Commands: NativeCommands;
20
+ declare const _default: HostComponent<TJOfferwallDiscoverViewProps>;
21
+ export default _default;
@@ -1,13 +1,41 @@
1
- import type TJStatus from './TJStatus';
1
+ import TJStatus from './TJStatus';
2
2
  declare class TJPrivacyPolicy {
3
3
  getBelowConsentAge(): Promise<TJStatus>;
4
4
  getSubjectToGDPR(): Promise<TJStatus>;
5
5
  setUSPrivacy(usPrivacy: string): void;
6
6
  getUSPrivacy(): Promise<string>;
7
7
  getUserConsent(): Promise<TJStatus>;
8
+ /**
9
+ * WARNING: EXPERIMENTAL API - DO NOT USE IT
10
+ *
11
+ * Android only.
12
+ *
13
+ * This method is experimental and intended for internal purposes only.
14
+ *
15
+ * Returns the user's consent status for accessing Android's Usage Stats API.
16
+ *
17
+ * @return TJStatus.True if the user agrees, TJStatus.False otherwise
18
+ */
19
+ getUsageStatsConsent(): Promise<TJStatus>;
8
20
  setBelowConsentAgeStatus(isBelowConsentAgeStatus: TJStatus): void;
9
21
  setSubjectToGDPRStatus(isSubjectToGDPRStatus: TJStatus): void;
10
22
  setUserConsentStatus(userConsentStatus: TJStatus): void;
23
+ /**
24
+ * WARNING: EXPERIMENTAL API - DO NOT USE IT
25
+ *
26
+ * Android only.
27
+ *
28
+ * This method is experimental and intended for internal purposes only.
29
+ *
30
+ * Sets the user's consent status for accessing Android's Usage Stats API.
31
+ * The Android Usage Stats API (UsageStatsManager) allows apps to access
32
+ * data about app usage on the device.
33
+ *
34
+ * @param usageStatsConsent TJStatus.True if the user has granted permission
35
+ * to access their usage statistics, TJStatus.False
36
+ * if they have denied or not yet granted permission.
37
+ */
38
+ setUsageStatsConsent(usageStatsConsent: TJStatus): void;
11
39
  optOutAdvertisingID(optOut: boolean): void;
12
40
  getOptOutAdvertisingID(): Promise<boolean>;
13
41
  }
@@ -83,7 +83,7 @@ declare class Tapjoy {
83
83
  *
84
84
  * @param userID
85
85
  * user ID you wish to assign to this device
86
- * @return the user ID if successful or error message if failed.
86
+ * @return the user ID if successful or error message if failed.
87
87
  */
88
88
  static setUserId(userID: string): Promise<any>;
89
89
  /**
@@ -7,7 +7,9 @@ import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
7
7
  import TJPurchase from './TJPurchase';
8
8
  import TJLoggingLevel from './TJLoggingLevel';
9
9
  import Tapjoy from './Tapjoy';
10
- import { TapjoyEvent } from './TapjoyEvent';
11
- export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, TJLoggingLevel, };
12
- export type { TapjoyEvent };
10
+ import type { TapjoyEvent } from './TapjoyEvent';
11
+ import { isTurboModuleEnabled, isFabricEnabled } from './utils/ArchitectureDetection';
12
+ import type { OfferwallDiscoverEventData, TJOfferwallDiscoverViewProps as TJOfferwallDiscoverViewNativeProps } from './TJOfferwallDiscoverViewNativeComponent';
13
+ export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, TJLoggingLevel, isTurboModuleEnabled, isFabricEnabled, };
14
+ export type { TapjoyEvent, OfferwallDiscoverEventData, TJOfferwallDiscoverViewNativeProps, };
13
15
  export default Tapjoy;
@@ -0,0 +1,5 @@
1
+ declare global {
2
+ var nativeFabricUIManager: any | undefined;
3
+ }
4
+ export declare const isTurboModuleEnabled: () => boolean;
5
+ export declare const isFabricEnabled: () => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tapjoy-react-native-sdk",
3
- "version": "14.4.0",
3
+ "version": "14.6.0",
4
4
  "description": "ReactNative Plugin for Tapjoy SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -41,21 +41,14 @@
41
41
  "CODEOWNERS"
42
42
  ],
43
43
  "scripts": {
44
- "generate-declarations": "rm -rf lib && npx tsc --outDir lib/commonjs --declarationDir lib/typescript",
45
44
  "test": "jest",
46
45
  "typecheck": "tsc --noEmit",
47
46
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
48
47
  "example": "yarn --cwd example",
49
48
  "bootstrap": "yarn example && yarn install && yarn example pods",
50
- "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build temp package",
51
- "prepare-repo": "rm -rf temp package && mkdir temp && cd temp && git clone git@github.com:Tapjoy/react-native-sdk . && rm -rf *",
52
- "prepare-staging-repo": "rm -rf temp package && mkdir temp && cd temp && git clone git@github.com:Tapjoy/react-native-sdk-staging.git . && rm -rf *",
53
- "copy-pack": "npm pack && tar xvzf tapjoy-react-native*.tgz && cp -af ./package/* ./temp && rm tapjoy-react-native*.tgz",
54
- "push": "cd temp && git add . && export VERSION=`node -p \"require('./package.json').version\"` && git commit -m \"Release $VERSION\" && git push",
55
- "publish-npm": "yarn prepare-repo && yarn copy-pack && yarn push && cd temp && npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm pkg fix && npm publish && yarn tag-branch",
56
- "publish-staging-npm": "yarn prepare-staging-repo && yarn copy-pack && yarn push && cd temp && npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN && npm pkg fix && npm publish --dry-run && yarn tag-branch",
49
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build temp package && cd example/android && ./gradlew clean",
57
50
  "doc": "typedoc --entryPointStrategy expand src/*",
58
- "tag-branch": "export VERSION=`node -p \"require('./package.json').version\"` && git tag $VERSION && git push origin $VERSION"
51
+ "postinstall": "echo 'For Android, please ensure your project’s Gradle is configured correctly. Instructions can be found at: https://dev.tapjoy.com/en/reactnative-plugin/Quickstart'"
59
52
  },
60
53
  "keywords": [
61
54
  "react-native",
@@ -77,9 +70,9 @@
77
70
  "devDependencies": {
78
71
  "@commitlint/config-conventional": "^19.5.0",
79
72
  "@react-native-community/eslint-config": "^3.2.0",
80
- "@react-native/metro-config": "^0.79.2",
73
+ "@react-native/metro-config": "^0.81.0",
81
74
  "@types/jest": "^29.5.13",
82
- "@types/react": "^18.3.10",
75
+ "@types/react": "^19.1.0",
83
76
  "commitlint": "^19.5.0",
84
77
  "del-cli": "^5.1.0",
85
78
  "eslint": "^9.11.1",
@@ -88,13 +81,13 @@
88
81
  "jest": "^29.7.0",
89
82
  "pod-install": "^0.2.2",
90
83
  "prettier": "^3.3.3",
91
- "react": "^19.0.0",
92
- "react-native": "0.79.2",
84
+ "react": "^19.1.0",
85
+ "react-native": "0.81.0",
93
86
  "typedoc": "^0.26.7",
94
- "typescript": "^5.6.2"
87
+ "typescript": "^5.8.3"
95
88
  },
96
89
  "resolutions": {
97
- "@types/react": "^18.3.10"
90
+ "@types/react": "^19.1.0"
98
91
  },
99
92
  "peerDependencies": {
100
93
  "react": "*",
@@ -148,5 +141,10 @@
148
141
  },
149
142
  "dependencies": {
150
143
  "eventemitter3": "^5.0.1"
144
+ },
145
+ "codegenConfig": {
146
+ "name": "TapjoyReactNativeSdk",
147
+ "type": "all",
148
+ "jsSrcsDir": "src"
151
149
  }
152
150
  }