apps-sdk 1.1.50 → 1.1.51

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions} from "./src/libraries";
1
+ import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook} from "./src/libraries";
2
2
  import PayWall from "./src/components/PayWall";
3
3
 
4
4
  class AppsSDK {
@@ -60,5 +60,5 @@ export default {
60
60
  voice: Voice,
61
61
  adapty: Adapty,
62
62
  homeActions: HomeActions,
63
- // facebook: Facebook,
63
+ facebook: Facebook,
64
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.1.50",
3
+ "version": "1.1.51",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,6 +35,7 @@
35
35
  "react-native-adapty": "^3.11.1",
36
36
  "react-native-adjust": "^5.0.2",
37
37
  "react-native-btr": "^2.2.1",
38
+ "react-native-fbsdk-next": "^13.4.1",
38
39
  "react-native-iap": "12.14.0",
39
40
  "react-native-webview": "13.12.5",
40
41
  "semver": "^7.6.0"
@@ -1,128 +1,128 @@
1
- // import { AppEventsLogger, Settings } from 'react-native-fbsdk-next';
2
- // import * as config from '../../config';
3
- // import Networking from "./Networking";
1
+ import { AppEventsLogger, Settings } from 'react-native-fbsdk-next';
2
+ import * as config from '../../config';
3
+ import Networking from "./Networking";
4
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
- // */
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
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
- // }
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
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;
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
26
 
27
- // console.log('Initializing Facebook with appId: ' + this.appId);
27
+ console.log('Initializing Facebook with appId: ' + this.appId);
28
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
- // }
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
35
 
36
- // // Configure Facebook SDK
37
- // Settings.setAppID(this.appId);
38
- // Settings.setClientToken(this.clientToken);
39
- // Settings.setAutoLogAppEventsEnabled(true);
36
+ // Configure Facebook SDK
37
+ Settings.setAppID(this.appId);
38
+ Settings.setClientToken(this.clientToken);
39
+ Settings.setAutoLogAppEventsEnabled(true);
40
40
 
41
- // if (debugMode || config.FACEBOOK.DEBUG) {
42
- // Settings.setAdvertiserIDCollectionEnabled(true);
43
- // Settings.setAutoInitEnabled(true);
44
- // }
41
+ if (debugMode || config.FACEBOOK.DEBUG) {
42
+ Settings.setAdvertiserIDCollectionEnabled(true);
43
+ Settings.setAutoInitEnabled(true);
44
+ }
45
45
 
46
- // await Settings.initializeSDK();
46
+ await Settings.initializeSDK();
47
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
- // }
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
56
 
57
- // async trackEvent(eventName, properties = {}) {
58
- // if (!this.isInitialized) {
59
- // console.log('Facebook is not initialized');
60
- // return;
61
- // }
57
+ async trackEvent(eventName, properties = {}) {
58
+ if (!this.isInitialized) {
59
+ console.log('Facebook is not initialized');
60
+ return;
61
+ }
62
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
- // }
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
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
- // }
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
82
 
83
- // async trackPurchase(valueToSum, currency, parameters = {}) {
84
- // if (!this.isInitialized) {
85
- // console.log('Facebook is not initialized');
86
- // return;
87
- // }
83
+ async trackPurchase(valueToSum, currency, parameters = {}) {
84
+ if (!this.isInitialized) {
85
+ console.log('Facebook is not initialized');
86
+ return;
87
+ }
88
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
- // }
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
100
 
101
- // async trackPushNotificationOpen(payload = {}) {
102
- // if (!this.isInitialized) {
103
- // console.log('Facebook is not initialized');
104
- // return;
105
- // }
101
+ async trackPushNotificationOpen(payload = {}) {
102
+ if (!this.isInitialized) {
103
+ console.log('Facebook is not initialized');
104
+ return;
105
+ }
106
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
- // }
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
118
 
119
- // isFacebookInitialized() {
120
- // return this.isInitialized;
121
- // }
119
+ isFacebookInitialized() {
120
+ return this.isInitialized;
121
+ }
122
122
 
123
- // getApplicationId() {
124
- // return this.appId;
125
- // }
126
- // }
123
+ getApplicationId() {
124
+ return this.appId;
125
+ }
126
+ }
127
127
 
128
- // export default new Facebook();
128
+ export default new Facebook();
@@ -11,4 +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';
14
+ export { default as Facebook } from './Facebook';
package/types/index.d.ts CHANGED
@@ -238,15 +238,15 @@ declare module 'apps-sdk' {
238
238
  itemCallback(itemCallbackFunction: any): Promise<void>;
239
239
  }
240
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
- // }
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
250
 
251
251
  export class AppsSDK {
252
252
  initializePushNotifications(): Promise<string>;
@@ -269,7 +269,7 @@ declare module 'apps-sdk' {
269
269
  voice : Voice;
270
270
  adapty : Adapty;
271
271
  homeActions : HomeActions;
272
- // facebook : Facebook;
272
+ facebook : Facebook;
273
273
  }
274
274
 
275
275
  const Core: AppsSDK;