webs-sdk 0.3.9 → 0.4.0

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.
@@ -1,294 +1,294 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Networking = void 0;
7
- const storage_1 = __importDefault(require("./storage"));
8
- const config_1 = __importDefault(require("../config"));
9
- class Networking {
10
- constructor() {
11
- this.PENDING_EVENTS = [];
12
- this.storage = new storage_1.default();
13
- this.decryptData = async (data) => {
14
- if (data && data.data) {
15
- try {
16
- const encoder = new TextEncoder();
17
- const dataBuffer = encoder.encode(data.data);
18
- const hashBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);
19
- const hashArray = Array.from(new Uint8Array(hashBuffer));
20
- const hashBase64 = btoa(String.fromCharCode.apply(null, hashArray));
21
- return JSON.parse(atob(hashBase64));
22
- }
23
- catch (error) {
24
- console.error(error);
25
- return null;
26
- }
27
- }
28
- return data;
29
- };
30
- this.createSubscription = async (data) => {
31
- console.debug("createSubscription", data);
32
- return this.request(config_1.default.endpoints.SUB_NEW, data);
33
- };
34
- this.checkSubscription = async () => {
35
- let subsID = await this.storage.getData('subscriptionID');
36
- const sessionData = this.getSessionData();
37
- let subStatus = await this.request(config_1.default.endpoints.SUB_STATUS, Object.assign(Object.assign({}, sessionData), { subs_id: subsID }));
38
- console.log('checkSubscription', subStatus);
39
- if (subStatus && subStatus.success === 1) {
40
- const currentSubscriptionStatus = await this.storage.getData('isSubscribed');
41
- if (currentSubscriptionStatus === false && !subStatus.data.subscription_active === true) {
42
- }
43
- return true;
44
- }
45
- return false;
46
- };
47
- this.setForcedUpdate = (data) => {
48
- const currentVersion = '1.0.0';
49
- const updateNeeded = (data.update_state === 'force' && this.compareVersions(currentVersion, data.release) < 0);
50
- console.log('update_state: ' + data.update_state + ', currentVersion: ' + currentVersion + ', initVersion: ' + data.release + ', updateNeeded: ' + updateNeeded);
51
- config_1.default.FORCED_UPDATE = updateNeeded;
52
- return updateNeeded;
53
- };
54
- this.setConfigExtra = (data) => {
55
- config_1.default.CONFIG_EXTRA = data;
56
- };
57
- this.getConfigExtra = () => {
58
- return config_1.default.CONFIG_EXTRA;
59
- };
60
- this.setQuickActions = (quickActions) => {
61
- config_1.default.QUICK_ACTIONS = quickActions;
62
- };
63
- this.getQuickActions = () => {
64
- return config_1.default.QUICK_ACTIONS;
65
- };
66
- this.sendEvent = async (eventType, eventKeyword, eventData = {}, forceSend = false) => {
67
- let finalKeyword = eventKeyword;
68
- if (config_1.default.EVENTS[finalKeyword]) {
69
- if (this.isSpecialEvent(finalKeyword)) {
70
- finalKeyword = 'first_' + eventKeyword;
71
- if (config_1.default.EVENTS[finalKeyword]) {
72
- const alreadySent = await this.storage.getData(finalKeyword);
73
- console.log("Already sent: " + finalKeyword + " " + JSON.stringify(alreadySent));
74
- if (!alreadySent) {
75
- console.log("Storing event: " + finalKeyword);
76
- this.storage.storeData(finalKeyword, true);
77
- }
78
- else {
79
- finalKeyword = eventKeyword;
80
- }
81
- }
82
- }
83
- }
84
- console.debug("sendEvent", eventType, finalKeyword, eventData);
85
- try {
86
- const sessionData = this.getSessionData();
87
- let eventResponse = await this.request(config_1.default.endpoints.EVENTS_PUSH, Object.assign({ event_name: finalKeyword, event_type: eventType, appevent: finalKeyword, payload: eventData }, sessionData));
88
- if (eventResponse) {
89
- console.debug("eventResponse", eventResponse);
90
- return eventResponse;
91
- }
92
- return null;
93
- }
94
- catch (error) {
95
- console.log('Error al enviar evento', error);
96
- }
97
- };
98
- }
99
- async executeInit() {
100
- console.debug("executeInit");
101
- try {
102
- let initData = await this.request(config_1.default.endpoints.CONFIG);
103
- if (initData) {
104
- console.debug("initData", JSON.stringify(initData));
105
- this.sendEvent('other', 'DEBUG_INIT_initData', JSON.stringify(initData));
106
- config_1.default.TRACKING_ANSWERED = await this.storage.getData('TRACKING_PERMISSION_ANSWERED');
107
- this.setEndpoints(initData.data.domains);
108
- this.setEvents(initData.data.attribution);
109
- this.setEventsMixPanel(initData.data.tracking);
110
- this.setPayWallData(initData);
111
- await this.checkSubscription();
112
- this.setForcedUpdate(initData.data);
113
- this.setConfigExtra(initData.data.config || {});
114
- this.setQuickActions(initData.data.quick_actions);
115
- if (initData.data.image) {
116
- this.setImageCompression(initData.data.image);
117
- }
118
- }
119
- }
120
- catch (error) {
121
- console.error(error);
122
- return null;
123
- }
124
- }
125
- async getUserID() {
126
- console.debug("getUserID");
127
- try {
128
- let userIDData = await this.request(config_1.default.endpoints.USER_CREATE_ID);
129
- if (userIDData && userIDData.success === 1) {
130
- console.debug("new userID", userIDData.data.external_id);
131
- return userIDData.data.external_id;
132
- }
133
- return null;
134
- }
135
- catch (error) {
136
- console.error(error);
137
- return null;
138
- }
139
- }
140
- async setToken(token) {
141
- try {
142
- const installID = await this.storage.getData('install_id');
143
- const result = this.request(config_1.default.endpoints.NOTIFICATION_SET_TOKEN, { expo_id: token });
144
- return result;
145
- }
146
- catch (error) {
147
- console.error(error);
148
- return null;
149
- }
150
- }
151
- async checkConnection() {
152
- try {
153
- return navigator.onLine;
154
- }
155
- catch (error) {
156
- console.error(error);
157
- return false;
158
- }
159
- }
160
- async request(url, data = {}) {
161
- const startTime = performance.now();
162
- let headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
163
- const isFormData = data instanceof FormData;
164
- if (isFormData) {
165
- const payloadString = data.get('payload');
166
- const payload = payloadString ? JSON.parse(payloadString) : {};
167
- const sessionData = this.getSessionData();
168
- const mergedPayload = Object.assign(Object.assign({}, sessionData), payload);
169
- data.delete('payload');
170
- data.append('payload', JSON.stringify(mergedPayload));
171
- headers = { 'Content-Type': 'multipart/form-data' };
172
- }
173
- else {
174
- const sessionData = this.getSessionData();
175
- data = JSON.stringify(Object.assign(Object.assign({}, sessionData), data));
176
- }
177
- let dataConsoleLog = isFormData ? data : JSON.parse(data);
178
- if (dataConsoleLog && dataConsoleLog.img) {
179
- dataConsoleLog.img = dataConsoleLog.img.substring(0, 50) + '...';
180
- }
181
- console.debug("request data: ", url, dataConsoleLog);
182
- console.debug("request headers: ", headers);
183
- try {
184
- const response = await fetch(url, {
185
- method: 'POST',
186
- headers: headers,
187
- body: data
188
- });
189
- const result = await response.json();
190
- const endTime = performance.now();
191
- const duration = ((endTime - startTime) / 1000).toFixed(3);
192
- console.log(`Request to ${url} completed in ${duration} segs`);
193
- return result;
194
- }
195
- catch (error) {
196
- const endTime = performance.now();
197
- const duration = ((endTime - startTime) / 1000).toFixed(3);
198
- console.error(`Request to ${url} failed in ${duration} segs:`, error);
199
- throw error;
200
- }
201
- }
202
- getSessionData() {
203
- return {};
204
- }
205
- setEndpoints(domains) {
206
- for (let key in domains) {
207
- if (domains.hasOwnProperty(key)) {
208
- config_1.default.endpoints[key.toUpperCase()] = domains[key];
209
- }
210
- }
211
- this.storage.storeData("ENDPOINTS", config_1.default.endpoints);
212
- }
213
- setImageCompression(compression) {
214
- config_1.default.IMAGE_COMPRESSION.COMPRESSION = compression.compress;
215
- config_1.default.IMAGE_COMPRESSION.WIDTH = compression.width;
216
- config_1.default.IMAGE_COMPRESSION.ACTIVE = Boolean(compression.active);
217
- this.storage.storeData("IMAGE_COMPRESSION", config_1.default.IMAGE_COMPRESSION);
218
- }
219
- getEndpoints() {
220
- return this.storage.getData("ENDPOINTS");
221
- }
222
- compareVersions(version1, version2) {
223
- const v1parts = version1.split('.').map(Number);
224
- const v2parts = version2.split('.').map(Number);
225
- for (let i = 0; i < Math.max(v1parts.length, v2parts.length); i++) {
226
- const v1part = v1parts[i] || 0;
227
- const v2part = v2parts[i] || 0;
228
- if (v1part < v2part)
229
- return -1;
230
- if (v1part > v2part)
231
- return 1;
232
- }
233
- return 0;
234
- }
235
- setEvents(events) {
236
- events && (config_1.default.EVENTS = events);
237
- }
238
- setEventsMixPanel(events) {
239
- events && (config_1.default.EVENTS_MIXPANEL = events);
240
- }
241
- setPayWallData(data) {
242
- let result = {
243
- actions: {},
244
- scenes: {},
245
- others: {}
246
- };
247
- if (data && data.data && data.data.purchase) {
248
- if (data.data.purchase.actions) {
249
- data.data.purchase.actions.forEach((action) => {
250
- result.actions[action.identifier] = action;
251
- });
252
- }
253
- if (data.data.purchase.scenes) {
254
- data.data.purchase.scenes.forEach((scene) => {
255
- result.scenes[scene.identifier] = scene;
256
- });
257
- }
258
- if (data.data.purchase.others) {
259
- data.data.purchase.others.forEach((other) => {
260
- result.others[other.identifier] = other;
261
- });
262
- }
263
- }
264
- result.products = data.data.product_ids;
265
- if (result) {
266
- config_1.default.PAYWALL_DATA = result;
267
- console.log('PAYWALL_DATA', config_1.default.PAYWALL_DATA);
268
- }
269
- }
270
- getPayWallData() {
271
- return config_1.default.PAYWALL_DATA;
272
- }
273
- isSpecialEvent(eventKeyword) {
274
- return config_1.default.SPECIAL_EVENTS.includes(eventKeyword);
275
- }
276
- addPendingEvent(event) {
277
- console.log('addPendingEvent', event);
278
- this.PENDING_EVENTS.push(event);
279
- }
280
- clearPendingEvents() {
281
- console.log('clearPendingEvents');
282
- this.PENDING_EVENTS = [];
283
- }
284
- async sendPendingEvents() {
285
- this.PENDING_EVENTS.forEach(async (event) => {
286
- console.log('sendPendingEvents', event);
287
- await this.sendEvent(event.eventType, event.eventKeyword, event.eventData);
288
- });
289
- this.clearPendingEvents();
290
- }
291
- }
292
- exports.Networking = Networking;
293
- exports.default = Networking;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Networking = void 0;
7
+ const storage_1 = __importDefault(require("./storage"));
8
+ const config_1 = __importDefault(require("../config"));
9
+ class Networking {
10
+ constructor() {
11
+ this.PENDING_EVENTS = [];
12
+ this.storage = new storage_1.default();
13
+ this.decryptData = async (data) => {
14
+ if (data && data.data) {
15
+ try {
16
+ const encoder = new TextEncoder();
17
+ const dataBuffer = encoder.encode(data.data);
18
+ const hashBuffer = await crypto.subtle.digest('SHA-256', dataBuffer);
19
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
20
+ const hashBase64 = btoa(String.fromCharCode.apply(null, hashArray));
21
+ return JSON.parse(atob(hashBase64));
22
+ }
23
+ catch (error) {
24
+ console.error(error);
25
+ return null;
26
+ }
27
+ }
28
+ return data;
29
+ };
30
+ this.createSubscription = async (data) => {
31
+ console.debug("createSubscription", data);
32
+ return this.request(config_1.default.endpoints.SUB_NEW, data);
33
+ };
34
+ this.checkSubscription = async () => {
35
+ let subsID = await this.storage.getData('subscriptionID');
36
+ const sessionData = this.getSessionData();
37
+ let subStatus = await this.request(config_1.default.endpoints.SUB_STATUS, Object.assign(Object.assign({}, sessionData), { subs_id: subsID }));
38
+ console.log('checkSubscription', subStatus);
39
+ if (subStatus && subStatus.success === 1) {
40
+ const currentSubscriptionStatus = await this.storage.getData('isSubscribed');
41
+ if (currentSubscriptionStatus === false && !subStatus.data.subscription_active === true) {
42
+ }
43
+ return true;
44
+ }
45
+ return false;
46
+ };
47
+ this.setForcedUpdate = (data) => {
48
+ const currentVersion = '1.0.0';
49
+ const updateNeeded = (data.update_state === 'force' && this.compareVersions(currentVersion, data.release) < 0);
50
+ console.log('update_state: ' + data.update_state + ', currentVersion: ' + currentVersion + ', initVersion: ' + data.release + ', updateNeeded: ' + updateNeeded);
51
+ config_1.default.FORCED_UPDATE = updateNeeded;
52
+ return updateNeeded;
53
+ };
54
+ this.setConfigExtra = (data) => {
55
+ config_1.default.CONFIG_EXTRA = data;
56
+ };
57
+ this.getConfigExtra = () => {
58
+ return config_1.default.CONFIG_EXTRA;
59
+ };
60
+ this.setQuickActions = (quickActions) => {
61
+ config_1.default.QUICK_ACTIONS = quickActions;
62
+ };
63
+ this.getQuickActions = () => {
64
+ return config_1.default.QUICK_ACTIONS;
65
+ };
66
+ this.sendEvent = async (eventType, eventKeyword, eventData = {}, forceSend = false) => {
67
+ let finalKeyword = eventKeyword;
68
+ if (config_1.default.EVENTS[finalKeyword]) {
69
+ if (this.isSpecialEvent(finalKeyword)) {
70
+ finalKeyword = 'first_' + eventKeyword;
71
+ if (config_1.default.EVENTS[finalKeyword]) {
72
+ const alreadySent = await this.storage.getData(finalKeyword);
73
+ console.log("Already sent: " + finalKeyword + " " + JSON.stringify(alreadySent));
74
+ if (!alreadySent) {
75
+ console.log("Storing event: " + finalKeyword);
76
+ this.storage.storeData(finalKeyword, true);
77
+ }
78
+ else {
79
+ finalKeyword = eventKeyword;
80
+ }
81
+ }
82
+ }
83
+ }
84
+ console.debug("sendEvent", eventType, finalKeyword, eventData);
85
+ try {
86
+ const sessionData = this.getSessionData();
87
+ let eventResponse = await this.request(config_1.default.endpoints.EVENTS_PUSH, Object.assign({ event_name: finalKeyword, event_type: eventType, appevent: finalKeyword, payload: eventData }, sessionData));
88
+ if (eventResponse) {
89
+ console.debug("eventResponse", eventResponse);
90
+ return eventResponse;
91
+ }
92
+ return null;
93
+ }
94
+ catch (error) {
95
+ console.log('Error al enviar evento', error);
96
+ }
97
+ };
98
+ }
99
+ async executeInit() {
100
+ console.debug("executeInit");
101
+ try {
102
+ let initData = await this.request(config_1.default.endpoints.CONFIG);
103
+ if (initData) {
104
+ console.debug("initData", JSON.stringify(initData));
105
+ this.sendEvent('other', 'DEBUG_INIT_initData', JSON.stringify(initData));
106
+ config_1.default.TRACKING_ANSWERED = await this.storage.getData('TRACKING_PERMISSION_ANSWERED');
107
+ this.setEndpoints(initData.data.domains);
108
+ this.setEvents(initData.data.attribution);
109
+ this.setEventsMixPanel(initData.data.tracking);
110
+ this.setPayWallData(initData);
111
+ await this.checkSubscription();
112
+ this.setForcedUpdate(initData.data);
113
+ this.setConfigExtra(initData.data.config || {});
114
+ this.setQuickActions(initData.data.quick_actions);
115
+ if (initData.data.image) {
116
+ this.setImageCompression(initData.data.image);
117
+ }
118
+ }
119
+ }
120
+ catch (error) {
121
+ console.error(error);
122
+ return null;
123
+ }
124
+ }
125
+ async getUserID() {
126
+ console.debug("getUserID");
127
+ try {
128
+ let userIDData = await this.request(config_1.default.endpoints.USER_CREATE_ID);
129
+ if (userIDData && userIDData.success === 1) {
130
+ console.debug("new userID", userIDData.data.external_id);
131
+ return userIDData.data.external_id;
132
+ }
133
+ return null;
134
+ }
135
+ catch (error) {
136
+ console.error(error);
137
+ return null;
138
+ }
139
+ }
140
+ async setToken(token) {
141
+ try {
142
+ const installID = await this.storage.getData('install_id');
143
+ const result = this.request(config_1.default.endpoints.NOTIFICATION_SET_TOKEN, { expo_id: token });
144
+ return result;
145
+ }
146
+ catch (error) {
147
+ console.error(error);
148
+ return null;
149
+ }
150
+ }
151
+ async checkConnection() {
152
+ try {
153
+ return navigator.onLine;
154
+ }
155
+ catch (error) {
156
+ console.error(error);
157
+ return false;
158
+ }
159
+ }
160
+ async request(url, data = {}) {
161
+ const startTime = performance.now();
162
+ let headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' };
163
+ const isFormData = data instanceof FormData;
164
+ if (isFormData) {
165
+ const payloadString = data.get('payload');
166
+ const payload = payloadString ? JSON.parse(payloadString) : {};
167
+ const sessionData = this.getSessionData();
168
+ const mergedPayload = Object.assign(Object.assign({}, sessionData), payload);
169
+ data.delete('payload');
170
+ data.append('payload', JSON.stringify(mergedPayload));
171
+ headers = { 'Content-Type': 'multipart/form-data' };
172
+ }
173
+ else {
174
+ const sessionData = this.getSessionData();
175
+ data = JSON.stringify(Object.assign(Object.assign({}, sessionData), data));
176
+ }
177
+ let dataConsoleLog = isFormData ? data : JSON.parse(data);
178
+ if (dataConsoleLog && dataConsoleLog.img) {
179
+ dataConsoleLog.img = dataConsoleLog.img.substring(0, 50) + '...';
180
+ }
181
+ console.debug("request data: ", url, dataConsoleLog);
182
+ console.debug("request headers: ", headers);
183
+ try {
184
+ const response = await fetch(url, {
185
+ method: 'POST',
186
+ headers: headers,
187
+ body: data
188
+ });
189
+ const result = await response.json();
190
+ const endTime = performance.now();
191
+ const duration = ((endTime - startTime) / 1000).toFixed(3);
192
+ console.log(`Request to ${url} completed in ${duration} segs`);
193
+ return result;
194
+ }
195
+ catch (error) {
196
+ const endTime = performance.now();
197
+ const duration = ((endTime - startTime) / 1000).toFixed(3);
198
+ console.error(`Request to ${url} failed in ${duration} segs:`, error);
199
+ throw error;
200
+ }
201
+ }
202
+ getSessionData() {
203
+ return {};
204
+ }
205
+ setEndpoints(domains) {
206
+ for (let key in domains) {
207
+ if (domains.hasOwnProperty(key)) {
208
+ config_1.default.endpoints[key.toUpperCase()] = domains[key];
209
+ }
210
+ }
211
+ this.storage.storeData("ENDPOINTS", config_1.default.endpoints);
212
+ }
213
+ setImageCompression(compression) {
214
+ config_1.default.IMAGE_COMPRESSION.COMPRESSION = compression.compress;
215
+ config_1.default.IMAGE_COMPRESSION.WIDTH = compression.width;
216
+ config_1.default.IMAGE_COMPRESSION.ACTIVE = Boolean(compression.active);
217
+ this.storage.storeData("IMAGE_COMPRESSION", config_1.default.IMAGE_COMPRESSION);
218
+ }
219
+ getEndpoints() {
220
+ return this.storage.getData("ENDPOINTS");
221
+ }
222
+ compareVersions(version1, version2) {
223
+ const v1parts = version1.split('.').map(Number);
224
+ const v2parts = version2.split('.').map(Number);
225
+ for (let i = 0; i < Math.max(v1parts.length, v2parts.length); i++) {
226
+ const v1part = v1parts[i] || 0;
227
+ const v2part = v2parts[i] || 0;
228
+ if (v1part < v2part)
229
+ return -1;
230
+ if (v1part > v2part)
231
+ return 1;
232
+ }
233
+ return 0;
234
+ }
235
+ setEvents(events) {
236
+ events && (config_1.default.EVENTS = events);
237
+ }
238
+ setEventsMixPanel(events) {
239
+ events && (config_1.default.EVENTS_MIXPANEL = events);
240
+ }
241
+ setPayWallData(data) {
242
+ let result = {
243
+ actions: {},
244
+ scenes: {},
245
+ others: {}
246
+ };
247
+ if (data && data.data && data.data.purchase) {
248
+ if (data.data.purchase.actions) {
249
+ data.data.purchase.actions.forEach((action) => {
250
+ result.actions[action.identifier] = action;
251
+ });
252
+ }
253
+ if (data.data.purchase.scenes) {
254
+ data.data.purchase.scenes.forEach((scene) => {
255
+ result.scenes[scene.identifier] = scene;
256
+ });
257
+ }
258
+ if (data.data.purchase.others) {
259
+ data.data.purchase.others.forEach((other) => {
260
+ result.others[other.identifier] = other;
261
+ });
262
+ }
263
+ }
264
+ result.products = data.data.product_ids;
265
+ if (result) {
266
+ config_1.default.PAYWALL_DATA = result;
267
+ console.log('PAYWALL_DATA', config_1.default.PAYWALL_DATA);
268
+ }
269
+ }
270
+ getPayWallData() {
271
+ return config_1.default.PAYWALL_DATA;
272
+ }
273
+ isSpecialEvent(eventKeyword) {
274
+ return config_1.default.SPECIAL_EVENTS.includes(eventKeyword);
275
+ }
276
+ addPendingEvent(event) {
277
+ console.log('addPendingEvent', event);
278
+ this.PENDING_EVENTS.push(event);
279
+ }
280
+ clearPendingEvents() {
281
+ console.log('clearPendingEvents');
282
+ this.PENDING_EVENTS = [];
283
+ }
284
+ async sendPendingEvents() {
285
+ this.PENDING_EVENTS.forEach(async (event) => {
286
+ console.log('sendPendingEvents', event);
287
+ await this.sendEvent(event.eventType, event.eventKeyword, event.eventData);
288
+ });
289
+ this.clearPendingEvents();
290
+ }
291
+ }
292
+ exports.Networking = Networking;
293
+ exports.default = Networking;
294
294
  //# sourceMappingURL=networking.js.map
@@ -1,23 +1,23 @@
1
- export declare class Storage {
2
- get(key: string): string | null;
3
- set(key: string, value: string): void;
4
- remove(key: string): void;
5
- clear(): void;
6
- has(key: string): boolean;
7
- storeData(key: string, value: any): Promise<void>;
8
- getData(key: string): Promise<any>;
9
- removeData(key: string): Promise<void>;
10
- printAllKeys(): Promise<void>;
11
- removeAllKeys(): Promise<void>;
12
- handleDownloadImage(base64: string, fileName: string): Promise<void>;
13
- handleDownloadImageToCreations(base64Image: string, fileName: string, data: any): Promise<any>;
14
- getCreations(): Promise<any[]>;
15
- deleteCreation(dirName: string): Promise<void>;
16
- deleteAllCreations(): Promise<void>;
17
- setTrackingPermissionGranted(value: boolean): Promise<void>;
18
- setTrackingPermissionFromStorage(): Promise<void>;
19
- handleShareFile(fileName: string): Promise<boolean>;
20
- compressImage(imageUri: string, maxSizeMB?: number): Promise<string | null>;
21
- }
22
- export default Storage;
1
+ export declare class Storage {
2
+ get(key: string): string | null;
3
+ set(key: string, value: string): void;
4
+ remove(key: string): void;
5
+ clear(): void;
6
+ has(key: string): boolean;
7
+ storeData(key: string, value: any): Promise<void>;
8
+ getData(key: string): Promise<any>;
9
+ removeData(key: string): Promise<void>;
10
+ printAllKeys(): Promise<void>;
11
+ removeAllKeys(): Promise<void>;
12
+ handleDownloadImage(base64: string, fileName: string): Promise<void>;
13
+ handleDownloadImageToCreations(base64Image: string, fileName: string, data: any): Promise<any>;
14
+ getCreations(): Promise<any[]>;
15
+ deleteCreation(dirName: string): Promise<void>;
16
+ deleteAllCreations(): Promise<void>;
17
+ setTrackingPermissionGranted(value: boolean): Promise<void>;
18
+ setTrackingPermissionFromStorage(): Promise<void>;
19
+ handleShareFile(fileName: string): Promise<boolean>;
20
+ compressImage(imageUri: string, maxSizeMB?: number): Promise<string | null>;
21
+ }
22
+ export default Storage;
23
23
  //# sourceMappingURL=storage.d.ts.map