apps-sdk 1.1.63 → 1.1.65

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
@@ -13,6 +13,7 @@ export var ENDPOINTS = {
13
13
  AUDIENCES: "https://backend.ailandsapp.com",
14
14
  CONTENTS: "https://backend.ailandsapp.com",
15
15
  EVENTS: "https://ap0404.gways.org",
16
+ GET_LEGAL_TEXT: "https://backend.ailandsapp.com/content/andromeda/get-legal-text",
16
17
  }
17
18
 
18
19
  export var EVENTS = {}
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook} from "./src/libraries";
1
+ import {NotificationsPush, Networking, Storage, Session, Utils, PayWallLogic, Rating, AdJust, TrackingTransparency, Voice, MixPanel, Adapty, HomeActions, Facebook, Legal} from "./src/libraries";
2
2
  import PayWall from "./src/components/PayWall";
3
3
 
4
4
  class AppsSDK {
@@ -61,4 +61,5 @@ export default {
61
61
  adapty: Adapty,
62
62
  homeActions: HomeActions,
63
63
  facebook: Facebook,
64
+ legal: Legal,
64
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.1.63",
3
+ "version": "1.1.65",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,43 @@
1
+ import * as config from '../../config';
2
+ import Networking from './Networking';
3
+
4
+ class Legal {
5
+ constructor() {}
6
+
7
+ /**
8
+ * Obtiene textos legales desde el backend
9
+ * @param {string} webId - ID del proyecto web
10
+ * @param {'tc' | 'privacy' | 'cookies'} type - Tipo de texto legal
11
+ * @param {string} language - Código de idioma (por defecto 'es')
12
+ * @returns {Promise<any>} Respuesta con el texto legal
13
+ */
14
+ async getLegalText(webId, type, language = 'es') {
15
+ config.DEBUG_MODE && console.debug("getLegalText", { webId, type, language });
16
+
17
+ if (!webId) {
18
+ console.error('getLegalText: webId es requerido');
19
+ throw new Error('webId es requerido');
20
+ }
21
+
22
+ if (!['tc', 'privacy', 'cookies'].includes(type)) {
23
+ console.error('getLegalText: tipo inválido. Debe ser tc, privacy o cookies');
24
+ throw new Error('Tipo inválido. Debe ser tc, privacy o cookies');
25
+ }
26
+
27
+ try {
28
+ const response = await Networking.request(config.ENDPOINTS.GET_LEGAL_TEXT, {
29
+ webId,
30
+ type,
31
+ language
32
+ });
33
+
34
+ config.DEBUG_MODE && console.debug("getLegalText response", response);
35
+ return response;
36
+ } catch (error) {
37
+ console.error(`Failed to fetch legal text (${type}) for webId ${webId}:`, error);
38
+ throw error;
39
+ }
40
+ }
41
+ }
42
+
43
+ export default new Legal();
@@ -231,6 +231,10 @@ class Session {
231
231
  getDeviceLanguageAndRegion = () => {
232
232
  return Localization.getLocales()[0].languageCode + '-' + Localization.getLocales()[0].regionCode;
233
233
  }
234
+
235
+ getAppVersion = () => {
236
+ return this.sessionData.app.shortVersion || '';
237
+ }
234
238
  }
235
239
 
236
240
  export default new Session();
@@ -12,3 +12,4 @@ export { default as Voice } from './Voice';
12
12
  export { default as Adapty } from './Adapty';
13
13
  export { default as HomeActions } from './QuickActions';
14
14
  export { default as Facebook } from './Facebook';
15
+ export { default as Legal } from './Legal';
package/types/index.d.ts CHANGED
@@ -65,6 +65,7 @@ declare module 'apps-sdk' {
65
65
  isForcedUpdate(): boolean;
66
66
  getDeviceLanguage(): string;
67
67
  getDeviceLanguageAndRegion(): string;
68
+ getAppVersion(): string;
68
69
  }
69
70
 
70
71
  export class Networking {
@@ -267,6 +268,10 @@ declare module 'apps-sdk' {
267
268
  getApplicationId(): string | null;
268
269
  }
269
270
 
271
+ export class Legal {
272
+ getLegalText(webId: string, type: 'tc' | 'privacy' | 'cookies', language?: string): Promise<any>;
273
+ }
274
+
270
275
  export class AppsSDK {
271
276
  initializePushNotifications(): Promise<string>;
272
277
  }
@@ -289,6 +294,7 @@ declare module 'apps-sdk' {
289
294
  adapty : Adapty;
290
295
  homeActions : HomeActions;
291
296
  facebook : Facebook;
297
+ legal : Legal;
292
298
  }
293
299
 
294
300
  const Core: AppsSDK;