apps-sdk 1.0.3 → 1.0.5

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,6 +1,6 @@
1
1
  import {NotificationsPush, Networking, Storage, Session} from "./src/libraries";
2
2
 
3
- class WebappsSDK {
3
+ class AppsSDK {
4
4
  initializePushNotifications = async() => {
5
5
  await NotificationsPush.initialize();
6
6
 
@@ -11,7 +11,7 @@ class WebappsSDK {
11
11
  }
12
12
  }
13
13
 
14
- const Core = new WebappsSDK();
14
+ const Core = new AppsSDK();
15
15
  export default {
16
16
  initializePushNotifications: Core.initializePushNotifications,
17
17
  networking: Networking,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,6 +14,7 @@ class Session {
14
14
  isDevUser = false;
15
15
 
16
16
  init = async () => {
17
+ config.DEBUG_MODE && console.debug("init");
17
18
  await this.storeSessionStructure();
18
19
  this.sessionID = this.generateSessionID();
19
20
  await this.checkFirstOpen();
@@ -46,6 +47,7 @@ class Session {
46
47
  lang : Localization.getLocales()[0].languageCode || 'en',
47
48
  package : Platform.OS === 'android' ? Constants.expoConfig.android.package : Constants.expoConfig.ios.bundleIdentifier,
48
49
  };
50
+ config.DEBUG_MODE && console.debug("storeSessionStructure - sessionData: ", this.sessionData);
49
51
  }
50
52
 
51
53
  checkFirstOpen = async () => {
package/types/index.d.ts CHANGED
@@ -1,18 +1,30 @@
1
1
  declare module 'apps-sdk' {
2
- export class Networking {
3
- trackEvent(wid: any, event: any, user_id?: any): Promise<void>;
4
- executeInit(): Promise<void>;
5
- setToken(token: any): Promise<boolean | null>;
6
- request(url: string, data?: any): Promise<any>;
7
- }
8
-
9
- export class Storage {
10
- storeData(key: string, value: any): Promise<void>;
11
- getData(key: string): Promise<any>;
2
+ export interface SessionData {
3
+ app: {
4
+ shortVersion: string;
5
+ package: string;
6
+ languageCode: string;
7
+ regionCode: string;
8
+ buildVersionNumber: string;
9
+ };
10
+ device: {
11
+ name: string;
12
+ systemName: string;
13
+ systemVersion: string;
14
+ model: string;
15
+ };
16
+ sandbox: {
17
+ "domains": string;
18
+ };
19
+ adjust: any;
20
+ dev: boolean;
21
+ lowPower: boolean;
22
+ lang: string;
23
+ package: string;
12
24
  }
13
25
 
14
26
  export class Session {
15
- sessionData: any;
27
+ sessionData: SessionData;
16
28
  sessionID: string | null;
17
29
  isFirstOpen: boolean;
18
30
  isSubscribed: boolean;
@@ -21,7 +33,7 @@ declare module 'apps-sdk' {
21
33
  storeSessionStructure(): Promise<void>;
22
34
  checkFirstOpen(): Promise<void>;
23
35
  generateSessionID(): string;
24
- getSessionData(): any;
36
+ getSessionData(): SessionData;
25
37
  getSessionID(): string | null;
26
38
  getIsFirstOpen(): boolean;
27
39
  getIsSubscribed(): boolean;
@@ -30,8 +42,34 @@ declare module 'apps-sdk' {
30
42
  setIsDevUser(isDevUser: boolean): void;
31
43
  }
32
44
 
33
- export function initializePushNotifications(): Promise<string>;
34
- export const networking: Networking;
35
- export const storage: Storage;
36
- export const session: Session;
45
+ export class Networking {
46
+ trackEvent(wid: string, event: string, user_id?: string | null): Promise<void>;
47
+ executeInit(): Promise<void>;
48
+ setToken(token: string): Promise<boolean | null>;
49
+ request(url: string, data?: any): Promise<any>;
50
+ }
51
+
52
+ export class Storage {
53
+ storeData(key: string, value: any): Promise<void>;
54
+ getData(key: string): Promise<any>;
55
+ }
56
+
57
+ export class NotificationsPush {
58
+ initialize(): Promise<void>;
59
+ registerForPushNotificationsAsync(): Promise<string>;
60
+ }
61
+
62
+ export class AppsSDK {
63
+ initializePushNotifications(): Promise<string>;
64
+ }
65
+
66
+ export interface AppsSDK {
67
+ initializePushNotifications(): Promise<string>;
68
+ networking: Networking;
69
+ storage: Storage;
70
+ session: Session;
71
+ }
72
+
73
+ const Core: AppsSDK;
74
+ export default Core;
37
75
  }