apps-sdk 1.1.64 → 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 +1 -0
- package/index.js +2 -1
- package/package.json +1 -1
- package/src/libraries/Legal.js +43 -0
- package/src/libraries/index.js +1 -0
- package/types/index.d.ts +5 -0
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
|
@@ -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();
|
package/src/libraries/index.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -268,6 +268,10 @@ declare module 'apps-sdk' {
|
|
|
268
268
|
getApplicationId(): string | null;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
+
export class Legal {
|
|
272
|
+
getLegalText(webId: string, type: 'tc' | 'privacy' | 'cookies', language?: string): Promise<any>;
|
|
273
|
+
}
|
|
274
|
+
|
|
271
275
|
export class AppsSDK {
|
|
272
276
|
initializePushNotifications(): Promise<string>;
|
|
273
277
|
}
|
|
@@ -290,6 +294,7 @@ declare module 'apps-sdk' {
|
|
|
290
294
|
adapty : Adapty;
|
|
291
295
|
homeActions : HomeActions;
|
|
292
296
|
facebook : Facebook;
|
|
297
|
+
legal : Legal;
|
|
293
298
|
}
|
|
294
299
|
|
|
295
300
|
const Core: AppsSDK;
|