apps-sdk 2.0.2 → 2.0.4
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/config.js
CHANGED
|
@@ -15,6 +15,11 @@ const config = {
|
|
|
15
15
|
CONTENTS: "https://backend.ailandsapp.com",
|
|
16
16
|
EVENTS: "https://ap0404.gways.org",
|
|
17
17
|
LEGAL_BASE: "https://bc1742.gways.org/legal",
|
|
18
|
+
WEBAPP: null, // Will be set from app config
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
WEBAPP_PATHS: {
|
|
22
|
+
GET_CREDITS: "/user/get-credits",
|
|
18
23
|
},
|
|
19
24
|
|
|
20
25
|
EVENTS: {},
|
|
@@ -51,7 +56,7 @@ const config = {
|
|
|
51
56
|
|
|
52
57
|
MIXPANEL: {
|
|
53
58
|
TOKEN: '8893d9ebad697ab26bc63214cf6cc262',
|
|
54
|
-
DEBUG:
|
|
59
|
+
DEBUG: false,
|
|
55
60
|
},
|
|
56
61
|
|
|
57
62
|
IMAGE_COMPRESSION: {
|
|
@@ -62,7 +67,7 @@ const config = {
|
|
|
62
67
|
|
|
63
68
|
ADAPTY: {
|
|
64
69
|
APP_KEY: 'public_live_OtCmXa0x.O3t2KKlHjAjU73jv0u2u',
|
|
65
|
-
LOG_LEVEL: '
|
|
70
|
+
LOG_LEVEL: 'error', // 'error', 'warn', 'info', 'verbose'
|
|
66
71
|
},
|
|
67
72
|
|
|
68
73
|
TRACKING_ACTIVE: false,
|
|
@@ -78,7 +83,7 @@ const config = {
|
|
|
78
83
|
FACEBOOK: {
|
|
79
84
|
APP_ID: 'your_facebook_app_id',
|
|
80
85
|
CLIENT_TOKEN: 'your_client_token',
|
|
81
|
-
DEBUG:
|
|
86
|
+
DEBUG: false,
|
|
82
87
|
},
|
|
83
88
|
|
|
84
89
|
EVENTS_FACEBOOK: {
|
package/package.json
CHANGED
|
@@ -143,7 +143,7 @@ class AdaptyOnboarding extends React.Component {
|
|
|
143
143
|
|
|
144
144
|
handleFinishedLoading = (meta) => {
|
|
145
145
|
// Prop: loaderMaskDelay - Delay before showing onboarding content (default: 300ms)
|
|
146
|
-
const delay = this.props.loaderMaskDelay ??
|
|
146
|
+
const delay = this.props.loaderMaskDelay ?? 0;
|
|
147
147
|
|
|
148
148
|
setTimeout(() => {
|
|
149
149
|
this.setState({ webViewReady: true });
|
package/src/libraries/AdJust.js
CHANGED
|
@@ -112,7 +112,7 @@ class AdJust {
|
|
|
112
112
|
Adjust.trackEvent(adjustEvent);
|
|
113
113
|
console.log("Event sent to AdJust: " + eventKeyword + " with value: " + eventValue + " and keyword: " + eventKeyword + " and event: " + config.EVENTS[eventKeyword]);
|
|
114
114
|
} else {
|
|
115
|
-
console.log("Event not found in AdJust, not sent: " + eventKeyword);
|
|
115
|
+
config.DEBUG_MODE && console.log("Event not found in AdJust, not sent: " + eventKeyword);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -153,7 +153,7 @@ class Networking {
|
|
|
153
153
|
checkSubscription = async () => {
|
|
154
154
|
let subsID = await storage.getData('subscriptionID');
|
|
155
155
|
let subStatus = await this.request(config.ENDPOINTS.SUB_STATUS, {...Session.sessionData, subs_id: subsID});
|
|
156
|
-
console.log('checkSubscription', subStatus);
|
|
156
|
+
config.DEBUG_MODE && console.log('checkSubscription', subStatus);
|
|
157
157
|
if (subStatus && subStatus.success === 1) {
|
|
158
158
|
const currentSubscriptionStatus = await storage.getData('isSubscribed');
|
|
159
159
|
const isActive = subStatus.data.subscription_active;
|
|
@@ -177,7 +177,7 @@ class Networking {
|
|
|
177
177
|
setForcedUpdate = (data) => {
|
|
178
178
|
const currentVersion = Constants.expoConfig.version;
|
|
179
179
|
const updateNeeded = (data.update_state === 'force' && semver.lt(currentVersion, data.release));
|
|
180
|
-
console.log('update_state: ' + data.update_state + ', currentVersion: ' + currentVersion + ', initVersion: ' + data.release + ', updateNeeded: ' + updateNeeded);
|
|
180
|
+
config.DEBUG_MODE && console.log('update_state: ' + data.update_state + ', currentVersion: ' + currentVersion + ', initVersion: ' + data.release + ', updateNeeded: ' + updateNeeded);
|
|
181
181
|
config.FORCED_UPDATE = updateNeeded;
|
|
182
182
|
return updateNeeded;
|
|
183
183
|
}
|
|
@@ -235,7 +235,7 @@ class Networking {
|
|
|
235
235
|
|
|
236
236
|
if (result) {
|
|
237
237
|
config.PAYWALL_DATA = result;
|
|
238
|
-
console.log('PAYWALL_DATA', config.PAYWALL_DATA);
|
|
238
|
+
config.DEBUG_MODE && console.log('PAYWALL_DATA', config.PAYWALL_DATA);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
|
package/src/libraries/Session.js
CHANGED
|
@@ -239,6 +239,41 @@ class Session {
|
|
|
239
239
|
getAppVersion = () => {
|
|
240
240
|
return this.sessionData.app.shortVersion || '';
|
|
241
241
|
}
|
|
242
|
+
|
|
243
|
+
setDebugMode = (debugMode) => {
|
|
244
|
+
config.DEBUG_MODE = debugMode;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
getWebappBasePayload = (websiteId, additionalData = {}) => {
|
|
248
|
+
return {
|
|
249
|
+
user_id: "",
|
|
250
|
+
app_user_id: this.getUserID(),
|
|
251
|
+
website_id: websiteId,
|
|
252
|
+
...additionalData
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
getCredits = async (webappUrl, websiteId) => {
|
|
257
|
+
config.DEBUG_MODE && console.debug("getCredits");
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
const endpoint = `${webappUrl}${config.WEBAPP_PATHS.GET_CREDITS}`;
|
|
261
|
+
const payload = this.getWebappBasePayload(websiteId);
|
|
262
|
+
|
|
263
|
+
const response = await fetch(endpoint, {
|
|
264
|
+
method: 'POST',
|
|
265
|
+
headers: { 'Content-Type': 'application/json' },
|
|
266
|
+
body: JSON.stringify(payload),
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
const data = await response.json();
|
|
270
|
+
config.DEBUG_MODE && console.debug("getCredits - result: ", data);
|
|
271
|
+
return data?.data?.credits || 0;
|
|
272
|
+
} catch (error) {
|
|
273
|
+
console.error('[SDK] getCredits error:', error);
|
|
274
|
+
return 0;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
242
277
|
}
|
|
243
278
|
|
|
244
279
|
export default new Session();
|
package/src/libraries/Storage.js
CHANGED
|
@@ -300,7 +300,7 @@ class Storage {
|
|
|
300
300
|
|
|
301
301
|
async setTrackingPermissionFromStorage() {
|
|
302
302
|
this.getData('TRACKING_PERMISSION').then(value => {
|
|
303
|
-
console.log('Setting tracking permission from storage:', (value === 'granted'));
|
|
303
|
+
config.DEBUG_MODE && console.log('Setting tracking permission from storage:', (value === 'granted'));
|
|
304
304
|
if (value === 'granted') {
|
|
305
305
|
config.TRACKING_ACTIVE = true;
|
|
306
306
|
} else {
|