apps-sdk 2.1.1 → 2.1.2

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
@@ -1,27 +1,61 @@
1
1
  const config = {
2
- ENDPOINTS: {
3
- CONTENT: "https://backend.ailandsapp.com/content",
4
- PAYMENT_CARD: "https://backend.ailandsapp.com/payment-card",
5
- EVENTS_PUSH: "https://backend.ailandsapp.com/event/push",
6
- ATTRIBUTION_SET_ID: "https://backend.ailandsapp.com/user/set-attribution-data",
7
- ATTRIBUTION_SET_DATA: "https://backend.ailandsapp.com/user/set-adjust-data",
8
- USER_CREATE_ID: "https://backend.ailandsapp.com/user/create-id",
9
- NOTIFICATION_SET_TOKEN: "https://backend.ailandsapp.com/user/notification-token",
10
- CONFIG: "https://backend.ailandsapp.com/core/config",
11
- SUB_NEW: "https://backend.ailandsapp.com/core/sub-new",
12
- SUB_STATUS: "https://backend.ailandsapp.com/core/sub-status",
13
- LOCALIZE: "https://backend.ailandsapp.com",
14
- AUDIENCES: "https://backend.ailandsapp.com",
15
- CONTENTS: "https://backend.ailandsapp.com",
2
+ // ========================================
3
+ // BASE URLS (Dynamic - configurable)
4
+ // ========================================
5
+ BASE_URLS: {
6
+ CORE: "https://backend.ailandsapp.com",// Default, can be overridden from app
16
7
  EVENTS: "https://ap0404.gways.org",
17
- LEGAL_BASE: "https://bc1742.gways.org/legal",
18
- WEBAPP: null, // Will be set from app config
8
+ WEBAPP: "https://bc1742.gways.org", // Default, can be overridden from app
9
+ },
10
+
11
+ // ========================================
12
+ // PATHS -
13
+ // ========================================
14
+ CORE_PATHS: {
15
+ CONTENT: "/content",
16
+ PAYMENT_CARD: "/payment-card",
17
+ EVENTS_PUSH: "/event/push",
18
+ ATTRIBUTION_SET_ID: "/user/set-attribution-data",
19
+ ATTRIBUTION_SET_DATA: "/user/set-adjust-data",
20
+ USER_CREATE_ID: "/user/create-id",
21
+ NOTIFICATION_SET_TOKEN: "/user/notification-token",
22
+ CONFIG: "/core/config",
23
+ SUB_NEW: "/core/sub-new",
24
+ SUB_STATUS: "/core/sub-status",
19
25
  },
20
26
 
21
27
  WEBAPP_PATHS: {
22
28
  GET_CREDITS: "/user/get-credits",
23
29
  },
24
30
 
31
+ LEGAL_PATHS: {
32
+ BASE: "/legal",
33
+ },
34
+
35
+ // ========================================
36
+ // COMPUTED ENDPOINTS (dynamic getter)
37
+ // ========================================
38
+ get ENDPOINTS() {
39
+ return {
40
+ CONTENT: `${this.BASE_URLS.CORE}${this.CORE_PATHS.CONTENT}`,
41
+ PAYMENT_CARD: `${this.BASE_URLS.CORE}${this.CORE_PATHS.PAYMENT_CARD}`,
42
+ EVENTS_PUSH: `${this.BASE_URLS.CORE}${this.CORE_PATHS.EVENTS_PUSH}`,
43
+ ATTRIBUTION_SET_ID: `${this.BASE_URLS.CORE}${this.CORE_PATHS.ATTRIBUTION_SET_ID}`,
44
+ ATTRIBUTION_SET_DATA: `${this.BASE_URLS.CORE}${this.CORE_PATHS.ATTRIBUTION_SET_DATA}`,
45
+ USER_CREATE_ID: `${this.BASE_URLS.CORE}${this.CORE_PATHS.USER_CREATE_ID}`,
46
+ NOTIFICATION_SET_TOKEN: `${this.BASE_URLS.CORE}${this.CORE_PATHS.NOTIFICATION_SET_TOKEN}`,
47
+ CONFIG: `${this.BASE_URLS.CORE}${this.CORE_PATHS.CONFIG}`,
48
+ SUB_NEW: `${this.BASE_URLS.CORE}${this.CORE_PATHS.SUB_NEW}`,
49
+ SUB_STATUS: `${this.BASE_URLS.CORE}${this.CORE_PATHS.SUB_STATUS}`,
50
+ LOCALIZE: this.BASE_URLS.CORE,
51
+ AUDIENCES: this.BASE_URLS.CORE,
52
+ CONTENTS: this.BASE_URLS.CORE,
53
+ EVENTS: this.BASE_URLS.EVENTS,
54
+ LEGAL_BASE: `${this.BASE_URLS.WEBAPP}${this.LEGAL_PATHS.BASE}`, // LEGAL uses WEBAPP base
55
+ WEBAPP: this.BASE_URLS.WEBAPP,
56
+ };
57
+ },
58
+
25
59
  EVENTS: {},
26
60
  EVENTS_MIXPANEL: {},
27
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Apps SDK - Compatible with Expo SDK 54 + React 19 - create User pre url",
5
5
  "main": "index.js",
6
6
  "author": "ASD",
@@ -126,12 +126,23 @@ class Networking {
126
126
  }
127
127
 
128
128
  setEndpoints(domains) {
129
+ // Update BASE_URLS instead of ENDPOINTS directly
129
130
  for (let key in domains) {
130
131
  if (domains.hasOwnProperty(key)) {
131
- config.ENDPOINTS[key.toUpperCase()] = domains[key];
132
+ const upperKey = key.toUpperCase();
133
+ // Map backend domains to BASE_URLS
134
+ if (upperKey === 'CONTENTS') {
135
+ config.BASE_URLS.CORE = domains[key];
136
+ } else if (upperKey === 'EVENTS') {
137
+ config.BASE_URLS.EVENTS = domains[key];
138
+ } else if (upperKey === 'LEGAL') {
139
+ // LEGAL uses WEBAPP, no separate BASE_URL
140
+ config.BASE_URLS.WEBAPP = domains[key];
141
+ }
132
142
  }
133
143
  }
134
- storage.storeData("ENDPOINTS", config.ENDPOINTS);
144
+ // Store updated BASE_URLS
145
+ storage.storeData("BASE_URLS", config.BASE_URLS);
135
146
  }
136
147
 
137
148
  setImageCompression(compression) {
@@ -35,6 +35,11 @@ class Session {
35
35
  config.ENDPOINTS.USER_CREATE_ID = endpoint;
36
36
  }
37
37
 
38
+ setBaseUrl = (baseUrl) => {
39
+ config.DEBUG_MODE && console.debug("setBaseUrl - baseUrl: ", baseUrl);
40
+ config.BASE_URLS.CORE = baseUrl;
41
+ }
42
+
38
43
  initSession = async () => {
39
44
  config.DEBUG_MODE && console.debug("initSession");
40
45
  await Networking.sendEvent(config.EVENT_TYPES.OTHER, 'init_session');