tapjoy-react-native-sdk 14.2.1 → 14.3.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.
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/tapjoyreactnativesdk/TJOfferwallDiscoverNativeViewManager.kt +1 -1
- package/android/src/main/java/com/tapjoyreactnativesdk/TapjoyReactNativeSdkModule.kt +22 -1
- package/example/Gemfile +2 -1
- package/example/android/app/build.gradle +1 -1
- package/example/android/app/src/main/java/com/tapjoyreactnativesdkexample/MainApplication.kt +2 -1
- package/example/android/build.gradle +4 -4
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/example/android/gradle.properties +1 -1
- package/example/android/gradlew +4 -1
- package/example/android/gradlew.bat +2 -0
- package/example/package-lock.json +8605 -0
- package/example/package.json +9 -5
- package/example/src/MainScreen.tsx +33 -27
- package/example/src/OfferwallScreen.tsx +67 -4
- package/example/src/Styles.ts +13 -5
- package/example/src/UserProperties.tsx +13 -1
- package/ios/TapjoyReactNativeSdk.swift +1 -3
- package/lib/commonjs/TJConnect.js +5 -0
- package/lib/commonjs/TJEntryPoint.js +14 -0
- package/lib/commonjs/TJOfferwallDiscoverView.js +25 -0
- package/lib/commonjs/TJPlacement.js +156 -0
- package/lib/commonjs/TJPrivacyPolicy.js +74 -0
- package/lib/commonjs/TJPurchase.js +8 -0
- package/lib/commonjs/TJSegment.js +8 -0
- package/lib/commonjs/TJStatus.js +7 -0
- package/lib/commonjs/TJUtil.js +14 -0
- package/lib/commonjs/TJVersion.js +14 -0
- package/lib/commonjs/Tapjoy.js +212 -0
- package/lib/commonjs/TapjoyEvent.js +1 -0
- package/lib/commonjs/index.js +10 -0
- package/lib/typescript/TJConnect.d.ts +4 -0
- package/lib/typescript/TJEntryPoint.d.ts +13 -0
- package/lib/typescript/TJOfferwallDiscoverView.d.ts +17 -0
- package/lib/typescript/TJPlacement.d.ts +96 -0
- package/lib/typescript/TJPrivacyPolicy.d.ts +14 -0
- package/lib/typescript/TJPurchase.d.ts +4 -0
- package/lib/typescript/TJSegment.d.ts +7 -0
- package/lib/typescript/TJStatus.d.ts +6 -0
- package/lib/typescript/TJUtil.d.ts +4 -0
- package/lib/typescript/TJVersion.d.ts +4 -0
- package/lib/typescript/Tapjoy.d.ts +148 -0
- package/lib/typescript/TapjoyEvent.d.ts +5 -0
- package/lib/typescript/index.d.ts +10 -0
- package/package.json +5 -4
- package/src/TJOfferwallDiscoverView.tsx +3 -2
- package/src/TJPlacement.ts +25 -3
- package/src/TJPrivacyPolicy.ts +9 -0
- package/src/TJVersion.ts +1 -1
- package/src/Tapjoy.ts +240 -0
- package/src/TapjoyEvent.ts +5 -0
- package/src/index.ts +1 -19
- package/tapjoy-react-native-sdk.podspec +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var TJSegment;
|
|
2
|
+
(function (TJSegment) {
|
|
3
|
+
TJSegment[TJSegment["NonPayer"] = 0] = "NonPayer";
|
|
4
|
+
TJSegment[TJSegment["Payer"] = 1] = "Payer";
|
|
5
|
+
TJSegment[TJSegment["VIP"] = 2] = "VIP";
|
|
6
|
+
TJSegment[TJSegment["Unknown"] = -1] = "Unknown";
|
|
7
|
+
})(TJSegment || (TJSegment = {}));
|
|
8
|
+
export default TJSegment;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class TJUtil {
|
|
2
|
+
static isValidDimensionValue(value) {
|
|
3
|
+
if (typeof value !== 'number' && /[0-9]+%|auto/.test(value)) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof value === 'number' && !isNaN(value)) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
static isValidNumber(value) {
|
|
12
|
+
return typeof value === 'number' && !isNaN(value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const REACT_LIBRARY_VERSION = '14.3.0';
|
|
2
|
+
const REACT_LIBRARY_VERSION_SUFFIX = '';
|
|
3
|
+
export class TJVersion {
|
|
4
|
+
// Returns the version of the plugin - eg: 1.0.0-alpha-rc1
|
|
5
|
+
static getPluginVersion() {
|
|
6
|
+
if (REACT_LIBRARY_VERSION_SUFFIX) {
|
|
7
|
+
return REACT_LIBRARY_VERSION + '-' + REACT_LIBRARY_VERSION_SUFFIX;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return REACT_LIBRARY_VERSION;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export default TJVersion;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { NativeModules, Platform, NativeEventEmitter } from 'react-native';
|
|
2
|
+
import TJConnect from './TJConnect';
|
|
3
|
+
const LINKING_ERROR = `The package 'tapjoy-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
|
|
4
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
5
|
+
'- You rebuilt the app after installing the package\n' +
|
|
6
|
+
'- You are not using Expo Go\n';
|
|
7
|
+
const TapjoyAPI = NativeModules.TapjoyReactNativeSdk
|
|
8
|
+
? NativeModules.TapjoyReactNativeSdk
|
|
9
|
+
: new Proxy({}, {
|
|
10
|
+
get() {
|
|
11
|
+
throw new Error(LINKING_ERROR);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
class Tapjoy {
|
|
15
|
+
/**
|
|
16
|
+
* Connects to the Tapjoy Server.
|
|
17
|
+
*
|
|
18
|
+
* @param sdkKey Your Tapjoy SDK Key.
|
|
19
|
+
* @param flags Special connect flags.
|
|
20
|
+
* @param onWarning Callback for connection warning.
|
|
21
|
+
*
|
|
22
|
+
* @return true if successful or error message if failed.
|
|
23
|
+
*/
|
|
24
|
+
static async connect(sdkKey, flags, onWarning) {
|
|
25
|
+
const TJ = NativeModules.TapjoyReactNativeSdk;
|
|
26
|
+
const TapjoyEmitter = new NativeEventEmitter(TJ);
|
|
27
|
+
const TapjoyEventType = 'Tapjoy';
|
|
28
|
+
const subscription = TapjoyEmitter.addListener(TapjoyEventType, (event) => {
|
|
29
|
+
if (event.name === TJConnect.TJC_CONNECT_WARNING) {
|
|
30
|
+
onWarning?.(event);
|
|
31
|
+
subscription.remove();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return await TapjoyAPI.connect(sdkKey, flags);
|
|
35
|
+
}
|
|
36
|
+
;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to check if SDK is initialized
|
|
39
|
+
*
|
|
40
|
+
* @return true if successful
|
|
41
|
+
*/
|
|
42
|
+
static isConnected() {
|
|
43
|
+
return TapjoyAPI.isConnected();
|
|
44
|
+
}
|
|
45
|
+
;
|
|
46
|
+
/**
|
|
47
|
+
* Gets the virtual currency data from the server for this device.
|
|
48
|
+
*
|
|
49
|
+
* @returns a map with "currencyName" and "amount" or error message if failed.
|
|
50
|
+
*/
|
|
51
|
+
static async getCurrencyBalance() {
|
|
52
|
+
return await TapjoyAPI.getCurrencyBalance();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Spends virtual currency. This can only be used for currency managed by
|
|
56
|
+
* Tapjoy.
|
|
57
|
+
*
|
|
58
|
+
* @param amount the amount of currency
|
|
59
|
+
* @return a map with "currencyName" and "amount" or error message if failed.
|
|
60
|
+
*/
|
|
61
|
+
static async spendCurrency(amount) {
|
|
62
|
+
return await TapjoyAPI.spendCurrency(amount);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Awards virtual currency. This can only be used for currency managed by
|
|
66
|
+
* Tapjoy.
|
|
67
|
+
*
|
|
68
|
+
* @param amount the amount of currency
|
|
69
|
+
* @return a map with "currencyName" and "amount" or error message if failed.
|
|
70
|
+
*/
|
|
71
|
+
static async awardCurrency(amount) {
|
|
72
|
+
return await TapjoyAPI.awardCurrency(amount);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Tracks a purchase
|
|
76
|
+
*
|
|
77
|
+
* @param currencyCode
|
|
78
|
+
* the currency code of price as an alphabetic currency code
|
|
79
|
+
* specified in ISO 4217, i.e. "USD", "KRW"
|
|
80
|
+
* @param price
|
|
81
|
+
* the price of product
|
|
82
|
+
*/
|
|
83
|
+
static trackPurchase(currencyCode, price) {
|
|
84
|
+
TapjoyAPI.trackPurchase(currencyCode, price);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Enables or disables Tapjoy logging
|
|
88
|
+
*
|
|
89
|
+
* @param enable
|
|
90
|
+
* set to true if logging should be enabled, false to disable
|
|
91
|
+
* logging
|
|
92
|
+
*/
|
|
93
|
+
static setDebugEnabled(enable) {
|
|
94
|
+
TapjoyAPI.setDebugEnabled(enable);
|
|
95
|
+
}
|
|
96
|
+
;
|
|
97
|
+
/**
|
|
98
|
+
* Assigns a user ID for this user/device. This is used to identify the user
|
|
99
|
+
* in your application.
|
|
100
|
+
*
|
|
101
|
+
* This is REQUIRED for NON-MANAGED currency apps.
|
|
102
|
+
*
|
|
103
|
+
* @param userID
|
|
104
|
+
* user ID you wish to assign to this device
|
|
105
|
+
* @return the user ID if successful or error message if failed.
|
|
106
|
+
*/
|
|
107
|
+
static async setUserId(userID) {
|
|
108
|
+
return await TapjoyAPI.setUserId(userID);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Gets the ID of the user.
|
|
112
|
+
*
|
|
113
|
+
* @return the id of the user.
|
|
114
|
+
*/
|
|
115
|
+
static async getUserId() {
|
|
116
|
+
return await TapjoyAPI.getUserId();
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Sets the level of the user.
|
|
120
|
+
*
|
|
121
|
+
* @param userLevel
|
|
122
|
+
* the level of the user
|
|
123
|
+
*/
|
|
124
|
+
static setUserLevel(userLevel) {
|
|
125
|
+
TapjoyAPI.setUserLevel(userLevel);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Gets the level of the user.
|
|
129
|
+
*
|
|
130
|
+
* @return the level of the user.
|
|
131
|
+
*/
|
|
132
|
+
static async getUserLevel() {
|
|
133
|
+
return await TapjoyAPI.getUserLevel();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sets the maximum level of the user.
|
|
137
|
+
*
|
|
138
|
+
* @param maxUserLevel
|
|
139
|
+
* the maximum level
|
|
140
|
+
*/
|
|
141
|
+
static setMaxLevel(maxUserLevel) {
|
|
142
|
+
TapjoyAPI.setMaxLevel(maxUserLevel);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Gets the maximum level of the user.
|
|
146
|
+
*
|
|
147
|
+
* @return the maximum level
|
|
148
|
+
*/
|
|
149
|
+
static async getMaxLevel() {
|
|
150
|
+
return await TapjoyAPI.getMaxLevel();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Sets the segment of the user
|
|
154
|
+
*
|
|
155
|
+
* @param segment NON_PAYER (0), PAYER (1), VIP (2)
|
|
156
|
+
*
|
|
157
|
+
*/
|
|
158
|
+
static setUserSegment(segment) {
|
|
159
|
+
TapjoyAPI.setUserSegment(segment);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets the segment of the user
|
|
163
|
+
*
|
|
164
|
+
* @return userSegment NON_PAYER (0), PAYER (1), VIP (2)
|
|
165
|
+
*
|
|
166
|
+
*/
|
|
167
|
+
static async getUserSegment() {
|
|
168
|
+
return await TapjoyAPI.getUserSegment();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Sets tags for the user.
|
|
172
|
+
*
|
|
173
|
+
* @param tags
|
|
174
|
+
* the tags to be set
|
|
175
|
+
*/
|
|
176
|
+
static setUserTags(tags) {
|
|
177
|
+
TapjoyAPI.setUserTags(tags);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Returns a String set which contains tags on the user.
|
|
181
|
+
*
|
|
182
|
+
* @return list of user tags
|
|
183
|
+
*/
|
|
184
|
+
static async getUserTags() {
|
|
185
|
+
return TapjoyAPI.getUserTags();
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Removes all tags from the user.
|
|
189
|
+
*/
|
|
190
|
+
static clearUserTags() {
|
|
191
|
+
TapjoyAPI.clearUserTags();
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Adds the given tag to the user if it is not already present.
|
|
195
|
+
*
|
|
196
|
+
* @param tag
|
|
197
|
+
* the tag to be added
|
|
198
|
+
*/
|
|
199
|
+
static addUserTag(tag) {
|
|
200
|
+
TapjoyAPI.addUserTag(tag);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Removes the given tag from the user if it is present.
|
|
204
|
+
*
|
|
205
|
+
* @param tag
|
|
206
|
+
* the tag to be removed
|
|
207
|
+
*/
|
|
208
|
+
static removeUserTag(tag) {
|
|
209
|
+
TapjoyAPI.removeUserTag(tag);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
export default Tapjoy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TJPlacement from './TJPlacement';
|
|
2
|
+
import TJPrivacyPolicy from './TJPrivacyPolicy';
|
|
3
|
+
import TJVersion from './TJVersion';
|
|
4
|
+
import TJStatus from './TJStatus';
|
|
5
|
+
import TJSegment from './TJSegment';
|
|
6
|
+
import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
|
|
7
|
+
import TJPurchase from './TJPurchase';
|
|
8
|
+
import Tapjoy from './Tapjoy';
|
|
9
|
+
export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, };
|
|
10
|
+
export default Tapjoy;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare enum TJEntryPoint {
|
|
2
|
+
TJEntryPointUnknown = "",
|
|
3
|
+
TJEntryPointOther = "other",
|
|
4
|
+
TJEntryPointMainMenu = "main_manu",
|
|
5
|
+
TJEntryPointHud = "hud",
|
|
6
|
+
TJEntryPointExit = "exit",
|
|
7
|
+
TJEntryPointFail = "fail",
|
|
8
|
+
TJEntryPointComplete = "complete",
|
|
9
|
+
TJEntryPointInbox = "inbox",
|
|
10
|
+
TJEntryPointInit = "initialisation",
|
|
11
|
+
TJEntryPointStore = "store"
|
|
12
|
+
}
|
|
13
|
+
export default TJEntryPoint;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
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);
|
|
13
|
+
render(): React.JSX.Element;
|
|
14
|
+
requestContent(placement: string): void;
|
|
15
|
+
clearContent(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EventEmitter } from 'eventemitter3';
|
|
2
|
+
import TJEntryPoint from './TJEntryPoint';
|
|
3
|
+
declare class TJPlacement extends EventEmitter {
|
|
4
|
+
static readonly REQUEST_DID_SUCCEED = "requestDidSucceed";
|
|
5
|
+
static readonly REQUEST_DID_FAIL = "requestDidFail";
|
|
6
|
+
static readonly CONTENT_IS_READY = "contentIsReady";
|
|
7
|
+
static readonly CONTENT_DID_APPEAR = "contentDidAppear";
|
|
8
|
+
static readonly CONTENT_DID_DISAPPEAR = "contentDidDisappear";
|
|
9
|
+
/**
|
|
10
|
+
* Returns the name of this placement. This is the same name passed to the
|
|
11
|
+
* constructor when creating this {@link TJPlacement} object.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a description of the error, if any, that was encountered when processing
|
|
16
|
+
* the placement request. If the request completes successfully, this property remains
|
|
17
|
+
* undefined. You can use this property to determine why a placement request failed by
|
|
18
|
+
* listening to the {@link TJPlacement.REQUEST_DID_FAIL} event.
|
|
19
|
+
*/
|
|
20
|
+
error: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new instance of a Tapjoy placement. Each placement is defined on the Tapjoy dashboard and can be configured
|
|
23
|
+
* to serve different content to your users.
|
|
24
|
+
*
|
|
25
|
+
* @param name - The unique identifier for this placement. It is used to register and
|
|
26
|
+
* retrieve the placement from Tapjoy.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const placement = new TJPlacement('MainMenuPlacement');
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
constructor(name: string);
|
|
33
|
+
/**
|
|
34
|
+
* Request placement content.
|
|
35
|
+
*/
|
|
36
|
+
requestContent(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Displays the content associated with the placement.
|
|
39
|
+
*/
|
|
40
|
+
showContent(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Checks whether the content is ready for use.
|
|
43
|
+
*
|
|
44
|
+
* @returns {boolean} True if the content is ready; otherwise, false.
|
|
45
|
+
*/
|
|
46
|
+
isContentReady(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether the content is available for use.
|
|
49
|
+
*
|
|
50
|
+
* @returns {boolean} True if the content is available; otherwise, false.
|
|
51
|
+
*/
|
|
52
|
+
isContentAvailable(): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the currency balance for given currency id.
|
|
55
|
+
*
|
|
56
|
+
* @param {String} currencyId - The identifier of the currency.
|
|
57
|
+
* @param {Number} currencyBalance - The amount of the currency to set. Must be greater than or equal to 0.
|
|
58
|
+
*/
|
|
59
|
+
setCurrencyBalance(currencyId: String, currencyBalance: Number): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Gets the currency balance for given currency id.
|
|
62
|
+
*
|
|
63
|
+
* @param {String} currencyId - The identifier of the currency.
|
|
64
|
+
* @return {Number} currencyBalance - The amount of the currency.
|
|
65
|
+
*/
|
|
66
|
+
getCurrencyBalance(currencyId: String): Promise<Number>;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the currency amount required
|
|
69
|
+
*
|
|
70
|
+
* @param {Number} amount The amount of currency the user needs. Must be greater than 0.
|
|
71
|
+
* @param {String} currencyId The identifier of the currency.
|
|
72
|
+
*/
|
|
73
|
+
setRequiredAmount(amount: Number, currencyId: String): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Gets the currency amount required.
|
|
76
|
+
*
|
|
77
|
+
* @param {String} currencyId The identifier of the currency.
|
|
78
|
+
* @return {Number} The amount of currency the user needs. -1 if not available.
|
|
79
|
+
*/
|
|
80
|
+
getRequiredAmount(currencyId: String): Promise<Number>;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the entry point for this placement instance.
|
|
83
|
+
*
|
|
84
|
+
* @param {TJEntryPoint} entryPoint - Entry point.
|
|
85
|
+
* @see TJEntryPoint
|
|
86
|
+
*/
|
|
87
|
+
setEntryPoint(entryPoint: TJEntryPoint): void;
|
|
88
|
+
/**
|
|
89
|
+
* Gets the entry point for this placement instance.
|
|
90
|
+
*
|
|
91
|
+
* @returns Entry point.
|
|
92
|
+
* @see TJEntryPoint
|
|
93
|
+
*/
|
|
94
|
+
getEntryPoint(): Promise<TJEntryPoint | undefined>;
|
|
95
|
+
}
|
|
96
|
+
export default TJPlacement;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type TJStatus from './TJStatus';
|
|
2
|
+
declare class TJPrivacyPolicy {
|
|
3
|
+
getBelowConsentAge(): Promise<TJStatus>;
|
|
4
|
+
getSubjectToGDPR(): Promise<TJStatus>;
|
|
5
|
+
setUSPrivacy(usPrivacy: string): void;
|
|
6
|
+
getUSPrivacy(): Promise<string>;
|
|
7
|
+
getUserConsent(): Promise<TJStatus>;
|
|
8
|
+
setBelowConsentAgeStatus(isBelowConsentAgeStatus: TJStatus): void;
|
|
9
|
+
setSubjectToGDPRStatus(isSubjectToGDPRStatus: TJStatus): void;
|
|
10
|
+
setUserConsentStatus(userConsentStatus: TJStatus): void;
|
|
11
|
+
optOutAdvertisingID(optOut: boolean): void;
|
|
12
|
+
getOptOutAdvertisingID(): Promise<boolean>;
|
|
13
|
+
}
|
|
14
|
+
export default TJPrivacyPolicy;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import TJSegment from './TJSegment';
|
|
2
|
+
declare class Tapjoy {
|
|
3
|
+
/**
|
|
4
|
+
* Connects to the Tapjoy Server.
|
|
5
|
+
*
|
|
6
|
+
* @param sdkKey Your Tapjoy SDK Key.
|
|
7
|
+
* @param flags Special connect flags.
|
|
8
|
+
* @param onWarning Callback for connection warning.
|
|
9
|
+
*
|
|
10
|
+
* @return true if successful or error message if failed.
|
|
11
|
+
*/
|
|
12
|
+
static connect(sdkKey: string, flags: object, onWarning?: (message: TapjoyEvent) => void): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Helper function to check if SDK is initialized
|
|
15
|
+
*
|
|
16
|
+
* @return true if successful
|
|
17
|
+
*/
|
|
18
|
+
static isConnected(): any;
|
|
19
|
+
/**
|
|
20
|
+
* Gets the virtual currency data from the server for this device.
|
|
21
|
+
*
|
|
22
|
+
* @returns a map with "currencyName" and "amount" or error message if failed.
|
|
23
|
+
*/
|
|
24
|
+
static getCurrencyBalance(): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* Spends virtual currency. This can only be used for currency managed by
|
|
27
|
+
* Tapjoy.
|
|
28
|
+
*
|
|
29
|
+
* @param amount the amount of currency
|
|
30
|
+
* @return a map with "currencyName" and "amount" or error message if failed.
|
|
31
|
+
*/
|
|
32
|
+
static spendCurrency(amount: number): Promise<any>;
|
|
33
|
+
/**
|
|
34
|
+
* Awards virtual currency. This can only be used for currency managed by
|
|
35
|
+
* Tapjoy.
|
|
36
|
+
*
|
|
37
|
+
* @param amount the amount of currency
|
|
38
|
+
* @return a map with "currencyName" and "amount" or error message if failed.
|
|
39
|
+
*/
|
|
40
|
+
static awardCurrency(amount: number): Promise<any>;
|
|
41
|
+
/**
|
|
42
|
+
* Tracks a purchase
|
|
43
|
+
*
|
|
44
|
+
* @param currencyCode
|
|
45
|
+
* the currency code of price as an alphabetic currency code
|
|
46
|
+
* specified in ISO 4217, i.e. "USD", "KRW"
|
|
47
|
+
* @param price
|
|
48
|
+
* the price of product
|
|
49
|
+
*/
|
|
50
|
+
static trackPurchase(currencyCode: string, price: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Enables or disables Tapjoy logging
|
|
53
|
+
*
|
|
54
|
+
* @param enable
|
|
55
|
+
* set to true if logging should be enabled, false to disable
|
|
56
|
+
* logging
|
|
57
|
+
*/
|
|
58
|
+
static setDebugEnabled(enable: Boolean): void;
|
|
59
|
+
/**
|
|
60
|
+
* Assigns a user ID for this user/device. This is used to identify the user
|
|
61
|
+
* in your application.
|
|
62
|
+
*
|
|
63
|
+
* This is REQUIRED for NON-MANAGED currency apps.
|
|
64
|
+
*
|
|
65
|
+
* @param userID
|
|
66
|
+
* user ID you wish to assign to this device
|
|
67
|
+
* @return the user ID if successful or error message if failed.
|
|
68
|
+
*/
|
|
69
|
+
static setUserId(userID: string): Promise<any>;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the ID of the user.
|
|
72
|
+
*
|
|
73
|
+
* @return the id of the user.
|
|
74
|
+
*/
|
|
75
|
+
static getUserId(): Promise<any>;
|
|
76
|
+
/**
|
|
77
|
+
* Sets the level of the user.
|
|
78
|
+
*
|
|
79
|
+
* @param userLevel
|
|
80
|
+
* the level of the user
|
|
81
|
+
*/
|
|
82
|
+
static setUserLevel(userLevel: number): void;
|
|
83
|
+
/**
|
|
84
|
+
* Gets the level of the user.
|
|
85
|
+
*
|
|
86
|
+
* @return the level of the user.
|
|
87
|
+
*/
|
|
88
|
+
static getUserLevel(): Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the maximum level of the user.
|
|
91
|
+
*
|
|
92
|
+
* @param maxUserLevel
|
|
93
|
+
* the maximum level
|
|
94
|
+
*/
|
|
95
|
+
static setMaxLevel(maxUserLevel: number): void;
|
|
96
|
+
/**
|
|
97
|
+
* Gets the maximum level of the user.
|
|
98
|
+
*
|
|
99
|
+
* @return the maximum level
|
|
100
|
+
*/
|
|
101
|
+
static getMaxLevel(): Promise<any>;
|
|
102
|
+
/**
|
|
103
|
+
* Sets the segment of the user
|
|
104
|
+
*
|
|
105
|
+
* @param segment NON_PAYER (0), PAYER (1), VIP (2)
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
static setUserSegment(segment: TJSegment): void;
|
|
109
|
+
/**
|
|
110
|
+
* Gets the segment of the user
|
|
111
|
+
*
|
|
112
|
+
* @return userSegment NON_PAYER (0), PAYER (1), VIP (2)
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
static getUserSegment(): Promise<any>;
|
|
116
|
+
/**
|
|
117
|
+
* Sets tags for the user.
|
|
118
|
+
*
|
|
119
|
+
* @param tags
|
|
120
|
+
* the tags to be set
|
|
121
|
+
*/
|
|
122
|
+
static setUserTags(tags: string[]): void;
|
|
123
|
+
/**
|
|
124
|
+
* Returns a String set which contains tags on the user.
|
|
125
|
+
*
|
|
126
|
+
* @return list of user tags
|
|
127
|
+
*/
|
|
128
|
+
static getUserTags(): Promise<any>;
|
|
129
|
+
/**
|
|
130
|
+
* Removes all tags from the user.
|
|
131
|
+
*/
|
|
132
|
+
static clearUserTags(): void;
|
|
133
|
+
/**
|
|
134
|
+
* Adds the given tag to the user if it is not already present.
|
|
135
|
+
*
|
|
136
|
+
* @param tag
|
|
137
|
+
* the tag to be added
|
|
138
|
+
*/
|
|
139
|
+
static addUserTag(tag: string): void;
|
|
140
|
+
/**
|
|
141
|
+
* Removes the given tag from the user if it is present.
|
|
142
|
+
*
|
|
143
|
+
* @param tag
|
|
144
|
+
* the tag to be removed
|
|
145
|
+
*/
|
|
146
|
+
static removeUserTag(tag: string): void;
|
|
147
|
+
}
|
|
148
|
+
export default Tapjoy;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import TJPlacement from './TJPlacement';
|
|
2
|
+
import TJPrivacyPolicy from './TJPrivacyPolicy';
|
|
3
|
+
import TJVersion from './TJVersion';
|
|
4
|
+
import TJStatus from './TJStatus';
|
|
5
|
+
import TJSegment from './TJSegment';
|
|
6
|
+
import TJOfferwallDiscoverView from './TJOfferwallDiscoverView';
|
|
7
|
+
import TJPurchase from './TJPurchase';
|
|
8
|
+
import Tapjoy from './Tapjoy';
|
|
9
|
+
export { Tapjoy, TJPlacement, TJPrivacyPolicy, TJVersion, TJStatus, TJSegment, TJOfferwallDiscoverView, TJPurchase, };
|
|
10
|
+
export default Tapjoy;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tapjoy-react-native-sdk",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.3.0",
|
|
4
4
|
"description": "ReactNative Plugin for Tapjoy SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"CODEOWNERS"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
+
"generate-declarations": "rm -rf lib && npx tsc --outDir lib/commonjs --declarationDir lib/typescript",
|
|
44
45
|
"test": "jest",
|
|
45
46
|
"typecheck": "tsc --noEmit",
|
|
46
47
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"@commitlint/config-conventional": "^19.5.0",
|
|
78
79
|
"@react-native-community/eslint-config": "^3.2.0",
|
|
79
|
-
"@react-native/metro-config": "^0.
|
|
80
|
+
"@react-native/metro-config": "^0.76.6",
|
|
80
81
|
"@types/jest": "^29.5.13",
|
|
81
82
|
"@types/react": "^18.3.10",
|
|
82
83
|
"commitlint": "^19.5.0",
|
|
@@ -88,8 +89,8 @@
|
|
|
88
89
|
"pod-install": "^0.2.2",
|
|
89
90
|
"prettier": "^3.3.3",
|
|
90
91
|
"react": "^18.3.1",
|
|
92
|
+
"react-native": "0.76.1",
|
|
91
93
|
"typedoc": "^0.26.7",
|
|
92
|
-
"react-native": "^0.75.3",
|
|
93
94
|
"typescript": "^5.6.2"
|
|
94
95
|
},
|
|
95
96
|
"resolutions": {
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
"engines": {
|
|
103
104
|
"node": ">= 18"
|
|
104
105
|
},
|
|
105
|
-
"packageManager": "
|
|
106
|
+
"packageManager": "yarn@1.22.19",
|
|
106
107
|
"jest": {
|
|
107
108
|
"preset": "react-native",
|
|
108
109
|
"modulePathIgnorePatterns": [
|