apps-sdk 2.0.1 → 2.0.3

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: true,
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: 'verbose', // 'error', 'warn', 'info', 'verbose'
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: true,
86
+ DEBUG: false,
82
87
  },
83
88
 
84
89
  EVENTS_FACEBOOK: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Apps SDK - Compatible with Expo SDK 54 + React 19",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
@@ -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 ?? 300;
146
+ const delay = this.props.loaderMaskDelay ?? 0;
147
147
 
148
148
  setTimeout(() => {
149
149
  this.setState({ webViewReady: true });
@@ -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();
@@ -3,6 +3,8 @@ import { ExpoSpeechRecognitionModule } from 'expo-speech-recognition';
3
3
  import Session from "./Session";
4
4
  import * as Speech from 'expo-speech';
5
5
  import { franc } from 'franc-min';
6
+ import Networking from './Networking';
7
+ import MixPanel from './MixPanel';
6
8
 
7
9
  class VoiceService {
8
10
  constructor() {
@@ -15,9 +17,18 @@ class VoiceService {
15
17
  try {
16
18
  const { status } = await ExpoSpeechRecognitionModule.requestPermissionsAsync();
17
19
  if (status !== 'granted') {
20
+ Networking.sendEvent('other', 'speech_permission_denied');
21
+ MixPanel.trackEvent('speech_permission_denied');
22
+ Networking.sendEvent('other', 'microphone_permission_denied');
23
+ MixPanel.trackEvent('microphone_permission_denied');
18
24
  throw new Error('Speech recognition permission not granted');
19
25
  }
20
26
 
27
+ Networking.sendEvent('other', 'speech_permission_granted');
28
+ MixPanel.trackEvent('speech_permission_granted');
29
+ Networking.sendEvent('other', 'microphone_permission_granted');
30
+ MixPanel.trackEvent('microphone_permission_granted');
31
+
21
32
  let language = Session.getDeviceLanguageAndRegion();
22
33
  language = this.normalizeLocale(language);
23
34