apps-sdk 1.1.35 → 1.1.38

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
@@ -73,4 +73,17 @@ export var CONFIG_EXTRA = {};
73
73
 
74
74
  export var QUICK_ACTIONS = {};
75
75
 
76
+ export const FACEBOOK = {
77
+ APP_ID: 'your_facebook_app_id',
78
+ CLIENT_TOKEN: 'your_client_token',
79
+ DEBUG: true,
80
+ }
81
+
82
+ export var EVENTS_FACEBOOK = {
83
+ 'picture_upload': 'custom_picture_upload',
84
+ 'write_prompt': 'custom_write_prompt',
85
+ 'picture_generated': 'custom_picture_generated',
86
+ 'paywall_view': 'custom_paywall_view'
87
+ }
88
+
76
89
  export const DEBUG_MODE = false;
package/index.js CHANGED
@@ -60,4 +60,5 @@ export default {
60
60
  voice: Voice,
61
61
  adapty: Adapty,
62
62
  homeActions: HomeActions,
63
+ facebook: Facebook,
63
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.1.35",
3
+ "version": "1.1.38",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -9,35 +9,38 @@
9
9
  "author": "ASD",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
- "@expo/config-plugins": "~9.0.0",
13
- "@react-native-async-storage/async-storage": "1.23.1",
12
+ "@react-native-async-storage/async-storage": "2.2.0",
14
13
  "@react-native-community/netinfo": "11.4.1",
15
14
  "@react-native-voice/voice": "^3.2.4",
16
- "apps-sdk": "^1.0.120",
17
- "expo": "~52.0.38",
18
- "expo-constants": "~17.0.5",
19
- "expo-device": "~7.0.2",
20
- "expo-file-system": "~18.0.7",
21
- "expo-image-manipulator": "^13.0.6",
22
- "expo-image-picker": "~16.0.6",
23
- "expo-linking": "~7.0.5",
24
- "expo-localization": "~16.0.1",
25
- "expo-media-library": "~17.0.6",
26
- "expo-notifications": "~0.29.14",
15
+ "expo": "^54.0.10",
16
+ "expo-constants": "~18.0.9",
17
+ "expo-device": "~8.0.8",
18
+ "expo-file-system": "~19.0.15",
19
+ "expo-image-manipulator": "~14.0.7",
20
+ "expo-image-picker": "~17.0.8",
21
+ "expo-linking": "~8.0.8",
22
+ "expo-localization": "~17.0.7",
23
+ "expo-media-library": "~18.2.0",
24
+ "expo-notifications": "~0.32.11",
27
25
  "expo-quick-actions": "^4.0.2",
28
- "expo-sharing": "~13.0.1",
29
- "expo-speech": "~13.0.1",
30
- "expo-store-review": "~8.0.1",
31
- "expo-tracking-transparency": "~5.1.1",
26
+ "expo-sharing": "~14.0.7",
27
+ "expo-speech": "~14.0.7",
28
+ "expo-store-review": "~9.0.7",
29
+ "expo-tracking-transparency": "~6.0.7",
32
30
  "franc-min": "^6.2.0",
33
31
  "mixpanel-react-native": "^3.0.9",
34
- "react-native": "0.76.7",
32
+ "react": "19.1.0",
33
+ "react-native": "0.81.4",
35
34
  "react-native-adapty": "^3.11.1",
36
35
  "react-native-adjust": "^5.0.2",
37
36
  "react-native-btr": "^2.2.1",
37
+ "react-native-fbsdk-next": "^13.4.1",
38
38
  "react-native-iap": "^12.13.0",
39
- "react-native-webview": "13.12.5",
39
+ "react-native-webview": "13.15.0",
40
40
  "semver": "^7.6.0"
41
41
  },
42
- "types": "./types/index.d.ts"
42
+ "types": "./types/index.d.ts",
43
+ "overrides": {
44
+ "@react-native-async-storage/async-storage": "2.2.0"
45
+ }
43
46
  }
@@ -72,6 +72,7 @@ class Adapty {
72
72
  onRenderingFailed: eventHandlers.onRenderingFailed || (() => { return true; }),
73
73
  onLoadingProductsFailed: eventHandlers.onLoadingProductsFailed || (() => { paywallView.dismiss(); return true; }),
74
74
  onUrlPress: eventHandlers.onUrlPress || (() => { return true; }),
75
+ onCustomAction: eventHandlers.onCustomAction || (() => { }),
75
76
  });
76
77
  await paywallView.present();
77
78
  } else {
@@ -134,6 +135,7 @@ class Adapty {
134
135
  onRenderingFailed: eventHandlers.onRenderingFailed || (() => { return true; }),
135
136
  onLoadingProductsFailed: eventHandlers.onLoadingProductsFailed || (() => { paywallView.dismiss(); return true; }),
136
137
  onUrlPress: eventHandlers.onUrlPress || (() => { return true; }),
138
+ onCustomAction: eventHandlers.onCustomAction || (() => { }),
137
139
  });
138
140
  await paywallView.present();
139
141
  } else {
@@ -0,0 +1,128 @@
1
+ import { AppEventsLogger, Settings } from 'react-native-fbsdk-next';
2
+ import * as config from '../../config';
3
+ import Networking from "./Networking";
4
+
5
+ /**
6
+ * "react-native-fbsdk-next" events coding:
7
+ * https://github.com/thebergamo/react-native-fbsdk-next/blob/master/src/FBAppEventsLogger.ts
8
+ *
9
+ * Facebook Standard and Custom events:
10
+ * https://developers.facebook.com/docs/marketing-api/app-event-api/
11
+ */
12
+
13
+ class Facebook {
14
+ constructor() {
15
+ this.facebook = null;
16
+ this.isInitialized = false;
17
+ this.appId = null;
18
+ this.clientToken = null;
19
+ this.devMode = false;
20
+ }
21
+
22
+ async initialize(appId = null, clientToken = null, debugMode = false, devMode = false) {
23
+ this.devMode = devMode;
24
+ this.appId = appId || config.FACEBOOK.APP_ID;
25
+ this.clientToken = clientToken || config.FACEBOOK.CLIENT_TOKEN;
26
+
27
+ console.log('Initializing Facebook with appId: ' + this.appId);
28
+
29
+ try {
30
+ if (!this.appId || !this.clientToken) {
31
+ console.error('Facebook initialize - Missing appId or clientToken');
32
+ Networking.sendEvent('other', 'facebook_init_ko');
33
+ return;
34
+ }
35
+
36
+ // Configure Facebook SDK
37
+ Settings.setAppID(this.appId);
38
+ Settings.setClientToken(this.clientToken);
39
+ Settings.setAutoLogAppEventsEnabled(true);
40
+
41
+ if (debugMode || config.FACEBOOK.DEBUG) {
42
+ Settings.setAdvertiserIDCollectionEnabled(true);
43
+ Settings.setAutoInitEnabled(true);
44
+ }
45
+
46
+ await Settings.initializeSDK();
47
+
48
+ this.isInitialized = true;
49
+ config.DEBUG_MODE && console.log('Facebook initialized: OK');
50
+ Networking.sendEvent('other', 'facebook_init_ok');
51
+ } catch (error) {
52
+ console.error('Error initializing Facebook:', error);
53
+ Networking.sendEvent('other', 'facebook_init_ko');
54
+ }
55
+ }
56
+
57
+ async trackEvent(eventName, properties = {}) {
58
+ if (!this.isInitialized) {
59
+ console.log('Facebook is not initialized');
60
+ return;
61
+ }
62
+
63
+ try {
64
+ if (!this.devMode) {
65
+ await AppEventsLogger.logEvent(eventName, properties);
66
+ config.DEBUG_MODE && console.log(`Facebook Event tracked: ${eventName} with properties:`, properties);
67
+ } else {
68
+ config.DEBUG_MODE && console.log(`Facebook Event tracked but not send (DEV_MODE ON): ${eventName} with properties:`, properties);
69
+ }
70
+ } catch (error) {
71
+ console.error('Error tracking event:', error);
72
+ }
73
+ }
74
+
75
+ async trackEventIfExist(eventKeyword, eventData = {}) {
76
+ if (config.EVENTS_FACEBOOK[eventKeyword]) {
77
+ this.trackEvent(config.EVENTS_FACEBOOK[eventKeyword], eventData);
78
+ } else {
79
+ console.log("Event not found in Facebook, not sent: " + eventKeyword);
80
+ }
81
+ }
82
+
83
+ async trackPurchase(valueToSum, currency, parameters = {}) {
84
+ if (!this.isInitialized) {
85
+ console.log('Facebook is not initialized');
86
+ return;
87
+ }
88
+
89
+ try {
90
+ if (!this.devMode) {
91
+ await AppEventsLogger.logPurchase(valueToSum, currency, parameters);
92
+ config.DEBUG_MODE && console.log(`Facebook Purchase tracked: ${valueToSum} ${currency} with parameters:`, parameters);
93
+ } else {
94
+ config.DEBUG_MODE && console.log(`Facebook Purchase tracked but not send (DEV_MODE ON): ${valueToSum} ${currency} with parameters:`, parameters);
95
+ }
96
+ } catch (error) {
97
+ console.error('Error tracking purchase:', error);
98
+ }
99
+ }
100
+
101
+ async trackPushNotificationOpen(payload = {}) {
102
+ if (!this.isInitialized) {
103
+ console.log('Facebook is not initialized');
104
+ return;
105
+ }
106
+
107
+ try {
108
+ if (!this.devMode) {
109
+ await AppEventsLogger.logPushNotificationOpen(payload);
110
+ config.DEBUG_MODE && console.log('Facebook Push Notification Open tracked with payload:', payload);
111
+ } else {
112
+ config.DEBUG_MODE && console.log('Facebook Push Notification Open tracked but not send (DEV_MODE ON) with payload:', payload);
113
+ }
114
+ } catch (error) {
115
+ console.error('Error tracking push notification open:', error);
116
+ }
117
+ }
118
+
119
+ isFacebookInitialized() {
120
+ return this.isInitialized;
121
+ }
122
+
123
+ getApplicationId() {
124
+ return this.appId;
125
+ }
126
+ }
127
+
128
+ export default new Facebook();
@@ -11,3 +11,4 @@ export { default as PayWallLogic } from './PayWallLogic';
11
11
  export { default as Voice } from './Voice';
12
12
  export { default as Adapty } from './Adapty';
13
13
  export { default as HomeActions } from './QuickActions';
14
+ export { default as Facebook } from './Facebook';
package/types/index.d.ts CHANGED
@@ -208,6 +208,7 @@ declare module 'apps-sdk' {
208
208
  onRenderingFailed?: (error: any) => void;
209
209
  onLoadingProductsFailed?: (error: any) => void;
210
210
  onUrlPress?: (url: string) => void;
211
+ onCustomAction?: (action: string, data: any) => void;
211
212
  };
212
213
 
213
214
  export class Adapty {
@@ -237,6 +238,16 @@ declare module 'apps-sdk' {
237
238
  itemCallback(itemCallbackFunction: any): Promise<void>;
238
239
  }
239
240
 
241
+ export class Facebook {
242
+ initialize(appId?: string, clientToken?: string, debugMode?: boolean, devMode?: boolean): Promise<void>;
243
+ trackEvent(eventName: string, properties?: object): Promise<void>;
244
+ trackEventIfExist(eventKeyword: string, eventData?: object): Promise<void>;
245
+ trackPurchase(valueToSum: number, currency: string, parameters?: object): Promise<void>;
246
+ trackPushNotificationOpen(payload?: object): Promise<void>;
247
+ isFacebookInitialized(): boolean;
248
+ getApplicationId(): string | null;
249
+ }
250
+
240
251
  export class AppsSDK {
241
252
  initializePushNotifications(): Promise<string>;
242
253
  }
@@ -258,6 +269,7 @@ declare module 'apps-sdk' {
258
269
  voice : Voice;
259
270
  adapty : Adapty;
260
271
  homeActions : HomeActions;
272
+ facebook : Facebook;
261
273
  }
262
274
 
263
275
  const Core: AppsSDK;