@webority-technologies/mobile-core 0.0.1 → 0.0.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/README.md +22 -1
- package/lib/commonjs/api/baseUrl.js +34 -0
- package/lib/commonjs/api/curl.js +109 -0
- package/lib/commonjs/api/publicClient.js +11 -20
- package/lib/commonjs/api/retry.js +75 -0
- package/lib/commonjs/api/userClient.js +46 -22
- package/lib/commonjs/auth/authStore.js +101 -33
- package/lib/commonjs/auth/jwt.js +32 -8
- package/lib/commonjs/config/index.js +2 -1
- package/lib/commonjs/deepLink/index.js +286 -0
- package/lib/commonjs/download/adapters/expoFs.js +100 -0
- package/lib/commonjs/download/adapters/shared.js +13 -0
- package/lib/commonjs/download/index.js +272 -0
- package/lib/commonjs/formatters/date.js +1 -1
- package/lib/commonjs/formatters/index.js +6 -0
- package/lib/commonjs/formatters/phone.js +103 -15
- package/lib/commonjs/geolocation/adapters/expoLocation.js +126 -0
- package/lib/commonjs/geolocation/index.js +339 -0
- package/lib/commonjs/index.js +133 -48
- package/lib/commonjs/initSDK.js +23 -2
- package/lib/commonjs/initUserAuth.js +2 -1
- package/lib/commonjs/logger/index.js +159 -5
- package/lib/commonjs/network/index.js +6 -0
- package/lib/commonjs/network/networkStatus.js +50 -15
- package/lib/commonjs/permissions/index.js +24 -1
- package/lib/commonjs/sqlite/adapters/expo.js +53 -0
- package/lib/commonjs/sqlite/adapters/op.js +43 -0
- package/lib/commonjs/sqlite/adapters/rows.js +33 -0
- package/lib/commonjs/sqlite/adapters/storage.js +50 -0
- package/lib/commonjs/sqlite/adapters/sync.js +45 -0
- package/lib/commonjs/sqlite/index.js +610 -0
- package/lib/commonjs/sqlite/nitro.js +17 -0
- package/lib/commonjs/sqlite/op.js +18 -0
- package/lib/commonjs/sqlite/quick.js +14 -0
- package/lib/commonjs/sqlite/storage.js +14 -0
- package/lib/commonjs/storage/index.js +40 -19
- package/lib/commonjs/types/globals.d.js +6 -0
- package/lib/commonjs/utils/imageCompression.js +51 -14
- package/lib/commonjs/utils/index.js +6 -0
- package/lib/commonjs/versionCheck/index.js +28 -4
- package/lib/module/api/baseUrl.js +30 -0
- package/lib/module/api/curl.js +104 -0
- package/lib/module/api/publicClient.js +11 -20
- package/lib/module/api/retry.js +69 -0
- package/lib/module/api/userClient.js +45 -21
- package/lib/module/auth/authStore.js +99 -32
- package/lib/module/auth/jwt.js +32 -8
- package/lib/module/config/index.js +2 -1
- package/lib/module/deepLink/index.js +280 -0
- package/lib/module/download/adapters/expoFs.js +95 -0
- package/lib/module/download/adapters/shared.js +8 -0
- package/lib/module/download/index.js +264 -0
- package/lib/module/formatters/date.js +1 -1
- package/lib/module/formatters/index.js +1 -1
- package/lib/module/formatters/phone.js +99 -13
- package/lib/module/geolocation/adapters/expoLocation.js +121 -0
- package/lib/module/geolocation/index.js +332 -0
- package/lib/module/index.js +28 -11
- package/lib/module/initSDK.js +23 -2
- package/lib/module/initUserAuth.js +2 -1
- package/lib/module/logger/index.js +156 -4
- package/lib/module/network/index.js +1 -1
- package/lib/module/network/networkStatus.js +47 -14
- package/lib/module/permissions/index.js +22 -0
- package/lib/module/sqlite/adapters/expo.js +48 -0
- package/lib/module/sqlite/adapters/op.js +38 -0
- package/lib/module/sqlite/adapters/rows.js +28 -0
- package/lib/module/sqlite/adapters/storage.js +46 -0
- package/lib/module/sqlite/adapters/sync.js +41 -0
- package/lib/module/sqlite/index.js +600 -0
- package/lib/module/sqlite/nitro.js +12 -0
- package/lib/module/sqlite/op.js +13 -0
- package/lib/module/sqlite/quick.js +9 -0
- package/lib/module/sqlite/storage.js +9 -0
- package/lib/module/storage/index.js +37 -18
- package/lib/module/types/globals.d.js +10 -0
- package/lib/module/utils/imageCompression.js +49 -13
- package/lib/module/utils/index.js +1 -1
- package/lib/module/versionCheck/index.js +27 -4
- package/lib/typescript/commonjs/api/baseUrl.d.ts +20 -0
- package/lib/typescript/commonjs/api/curl.d.ts +18 -0
- package/lib/typescript/commonjs/api/retry.d.ts +27 -0
- package/lib/typescript/commonjs/api/userClient.d.ts +11 -0
- package/lib/typescript/commonjs/auth/authStore.d.ts +29 -6
- package/lib/typescript/commonjs/config/index.d.ts +6 -0
- package/lib/typescript/commonjs/deepLink/index.d.ts +54 -0
- package/lib/typescript/commonjs/download/adapters/expoFs.d.ts +45 -0
- package/lib/typescript/commonjs/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/commonjs/download/index.d.ts +76 -0
- package/lib/typescript/commonjs/formatters/index.d.ts +2 -1
- package/lib/typescript/commonjs/formatters/phone.d.ts +16 -1
- package/lib/typescript/commonjs/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/commonjs/geolocation/index.d.ts +89 -0
- package/lib/typescript/commonjs/index.d.ts +30 -13
- package/lib/typescript/commonjs/initSDK.d.ts +32 -0
- package/lib/typescript/commonjs/logger/index.d.ts +39 -0
- package/lib/typescript/commonjs/network/index.d.ts +2 -2
- package/lib/typescript/commonjs/network/networkStatus.d.ts +16 -0
- package/lib/typescript/commonjs/permissions/index.d.ts +35 -0
- package/lib/typescript/commonjs/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/commonjs/sqlite/adapters/op.d.ts +27 -0
- package/lib/typescript/commonjs/sqlite/adapters/rows.d.ts +7 -0
- package/lib/typescript/commonjs/sqlite/adapters/storage.d.ts +30 -0
- package/lib/typescript/commonjs/sqlite/adapters/sync.d.ts +31 -0
- package/lib/typescript/commonjs/sqlite/index.d.ts +121 -0
- package/lib/typescript/commonjs/sqlite/nitro.d.ts +7 -0
- package/lib/typescript/commonjs/sqlite/op.d.ts +8 -0
- package/lib/typescript/commonjs/sqlite/quick.d.ts +4 -0
- package/lib/typescript/commonjs/sqlite/storage.d.ts +4 -0
- package/lib/typescript/commonjs/storage/index.d.ts +24 -2
- package/lib/typescript/commonjs/utils/imageCompression.d.ts +17 -0
- package/lib/typescript/commonjs/utils/index.d.ts +2 -2
- package/lib/typescript/module/api/baseUrl.d.ts +20 -0
- package/lib/typescript/module/api/curl.d.ts +18 -0
- package/lib/typescript/module/api/retry.d.ts +27 -0
- package/lib/typescript/module/api/userClient.d.ts +11 -0
- package/lib/typescript/module/auth/authStore.d.ts +29 -6
- package/lib/typescript/module/config/index.d.ts +6 -0
- package/lib/typescript/module/deepLink/index.d.ts +54 -0
- package/lib/typescript/module/download/adapters/expoFs.d.ts +45 -0
- package/lib/typescript/module/download/adapters/shared.d.ts +3 -0
- package/lib/typescript/module/download/index.d.ts +76 -0
- package/lib/typescript/module/formatters/index.d.ts +2 -1
- package/lib/typescript/module/formatters/phone.d.ts +16 -1
- package/lib/typescript/module/geolocation/adapters/expoLocation.d.ts +42 -0
- package/lib/typescript/module/geolocation/index.d.ts +89 -0
- package/lib/typescript/module/index.d.ts +30 -13
- package/lib/typescript/module/initSDK.d.ts +32 -0
- package/lib/typescript/module/logger/index.d.ts +39 -0
- package/lib/typescript/module/network/index.d.ts +2 -2
- package/lib/typescript/module/network/networkStatus.d.ts +16 -0
- package/lib/typescript/module/permissions/index.d.ts +35 -0
- package/lib/typescript/module/sqlite/adapters/expo.d.ts +30 -0
- package/lib/typescript/module/sqlite/adapters/op.d.ts +27 -0
- package/lib/typescript/module/sqlite/adapters/rows.d.ts +7 -0
- package/lib/typescript/module/sqlite/adapters/storage.d.ts +30 -0
- package/lib/typescript/module/sqlite/adapters/sync.d.ts +31 -0
- package/lib/typescript/module/sqlite/index.d.ts +121 -0
- package/lib/typescript/module/sqlite/nitro.d.ts +7 -0
- package/lib/typescript/module/sqlite/op.d.ts +8 -0
- package/lib/typescript/module/sqlite/quick.d.ts +4 -0
- package/lib/typescript/module/sqlite/storage.d.ts +4 -0
- package/lib/typescript/module/storage/index.d.ts +24 -2
- package/lib/typescript/module/utils/imageCompression.d.ts +17 -0
- package/lib/typescript/module/utils/index.d.ts +2 -2
- package/package.json +102 -14
package/lib/commonjs/index.js
CHANGED
|
@@ -3,16 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "ACCESS_TOKEN_KEY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _authStore.ACCESS_TOKEN_KEY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "DeepLink", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _index2.DeepLink;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
6
18
|
Object.defineProperty(exports, "Logger", {
|
|
7
19
|
enumerable: true,
|
|
8
20
|
get: function () {
|
|
9
|
-
return
|
|
21
|
+
return _index4.Logger;
|
|
10
22
|
}
|
|
11
23
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "REFRESH_TOKEN_KEY", {
|
|
13
25
|
enumerable: true,
|
|
14
26
|
get: function () {
|
|
15
|
-
return
|
|
27
|
+
return _authStore.REFRESH_TOKEN_KEY;
|
|
16
28
|
}
|
|
17
29
|
});
|
|
18
30
|
Object.defineProperty(exports, "RequestOfflineError", {
|
|
@@ -36,19 +48,31 @@ Object.defineProperty(exports, "Storage", {
|
|
|
36
48
|
Object.defineProperty(exports, "VersionCheck", {
|
|
37
49
|
enumerable: true,
|
|
38
50
|
get: function () {
|
|
39
|
-
return
|
|
51
|
+
return _index8.VersionCheck;
|
|
40
52
|
}
|
|
41
53
|
});
|
|
42
54
|
Object.defineProperty(exports, "addNetworkStatusListener", {
|
|
43
55
|
enumerable: true,
|
|
44
56
|
get: function () {
|
|
45
|
-
return
|
|
57
|
+
return _index5.addNetworkStatusListener;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "attachRetry", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _retry.attachRetry;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "buildCurl", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _curl.buildCurl;
|
|
46
70
|
}
|
|
47
71
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "configureLogger", {
|
|
49
73
|
enumerable: true,
|
|
50
74
|
get: function () {
|
|
51
|
-
return
|
|
75
|
+
return _index4.configureLogger;
|
|
52
76
|
}
|
|
53
77
|
});
|
|
54
78
|
Object.defineProperty(exports, "decodeJWT", {
|
|
@@ -57,58 +81,64 @@ Object.defineProperty(exports, "decodeJWT", {
|
|
|
57
81
|
return _jwt.decodeJWT;
|
|
58
82
|
}
|
|
59
83
|
});
|
|
84
|
+
Object.defineProperty(exports, "detectPhoneCountry", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _index3.detectPhoneCountry;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
60
90
|
Object.defineProperty(exports, "formatCompactNumber", {
|
|
61
91
|
enumerable: true,
|
|
62
92
|
get: function () {
|
|
63
|
-
return
|
|
93
|
+
return _index3.formatCompactNumber;
|
|
64
94
|
}
|
|
65
95
|
});
|
|
66
96
|
Object.defineProperty(exports, "formatCurrency", {
|
|
67
97
|
enumerable: true,
|
|
68
98
|
get: function () {
|
|
69
|
-
return
|
|
99
|
+
return _index3.formatCurrency;
|
|
70
100
|
}
|
|
71
101
|
});
|
|
72
102
|
Object.defineProperty(exports, "formatDate", {
|
|
73
103
|
enumerable: true,
|
|
74
104
|
get: function () {
|
|
75
|
-
return
|
|
105
|
+
return _index3.formatDate;
|
|
76
106
|
}
|
|
77
107
|
});
|
|
78
108
|
Object.defineProperty(exports, "formatDateTime", {
|
|
79
109
|
enumerable: true,
|
|
80
110
|
get: function () {
|
|
81
|
-
return
|
|
111
|
+
return _index3.formatDateTime;
|
|
82
112
|
}
|
|
83
113
|
});
|
|
84
114
|
Object.defineProperty(exports, "formatNumber", {
|
|
85
115
|
enumerable: true,
|
|
86
116
|
get: function () {
|
|
87
|
-
return
|
|
117
|
+
return _index3.formatNumber;
|
|
88
118
|
}
|
|
89
119
|
});
|
|
90
120
|
Object.defineProperty(exports, "formatPercent", {
|
|
91
121
|
enumerable: true,
|
|
92
122
|
get: function () {
|
|
93
|
-
return
|
|
123
|
+
return _index3.formatPercent;
|
|
94
124
|
}
|
|
95
125
|
});
|
|
96
126
|
Object.defineProperty(exports, "formatPhone", {
|
|
97
127
|
enumerable: true,
|
|
98
128
|
get: function () {
|
|
99
|
-
return
|
|
129
|
+
return _index3.formatPhone;
|
|
100
130
|
}
|
|
101
131
|
});
|
|
102
132
|
Object.defineProperty(exports, "formatRelativeTime", {
|
|
103
133
|
enumerable: true,
|
|
104
134
|
get: function () {
|
|
105
|
-
return
|
|
135
|
+
return _index3.formatRelativeTime;
|
|
106
136
|
}
|
|
107
137
|
});
|
|
108
138
|
Object.defineProperty(exports, "formatTime", {
|
|
109
139
|
enumerable: true,
|
|
110
140
|
get: function () {
|
|
111
|
-
return
|
|
141
|
+
return _index3.formatTime;
|
|
112
142
|
}
|
|
113
143
|
});
|
|
114
144
|
Object.defineProperty(exports, "getConfig", {
|
|
@@ -123,10 +153,16 @@ Object.defineProperty(exports, "getConfigValue", {
|
|
|
123
153
|
return _index.getConfigValue;
|
|
124
154
|
}
|
|
125
155
|
});
|
|
156
|
+
Object.defineProperty(exports, "getDeviceContext", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _index4.getDeviceContext;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
126
162
|
Object.defineProperty(exports, "getInitials", {
|
|
127
163
|
enumerable: true,
|
|
128
164
|
get: function () {
|
|
129
|
-
return
|
|
165
|
+
return _index3.getInitials;
|
|
130
166
|
}
|
|
131
167
|
});
|
|
132
168
|
Object.defineProperty(exports, "getJWTExpiry", {
|
|
@@ -138,7 +174,7 @@ Object.defineProperty(exports, "getJWTExpiry", {
|
|
|
138
174
|
Object.defineProperty(exports, "getNetworkStatus", {
|
|
139
175
|
enumerable: true,
|
|
140
176
|
get: function () {
|
|
141
|
-
return
|
|
177
|
+
return _index5.getNetworkStatus;
|
|
142
178
|
}
|
|
143
179
|
});
|
|
144
180
|
Object.defineProperty(exports, "getToken", {
|
|
@@ -174,61 +210,61 @@ Object.defineProperty(exports, "injectStore", {
|
|
|
174
210
|
Object.defineProperty(exports, "isAadhaar", {
|
|
175
211
|
enumerable: true,
|
|
176
212
|
get: function () {
|
|
177
|
-
return
|
|
213
|
+
return _index7.isAadhaar;
|
|
178
214
|
}
|
|
179
215
|
});
|
|
180
216
|
Object.defineProperty(exports, "isAlphanumeric", {
|
|
181
217
|
enumerable: true,
|
|
182
218
|
get: function () {
|
|
183
|
-
return
|
|
219
|
+
return _index7.isAlphanumeric;
|
|
184
220
|
}
|
|
185
221
|
});
|
|
186
222
|
Object.defineProperty(exports, "isBetween", {
|
|
187
223
|
enumerable: true,
|
|
188
224
|
get: function () {
|
|
189
|
-
return
|
|
225
|
+
return _index7.isBetween;
|
|
190
226
|
}
|
|
191
227
|
});
|
|
192
228
|
Object.defineProperty(exports, "isEmail", {
|
|
193
229
|
enumerable: true,
|
|
194
230
|
get: function () {
|
|
195
|
-
return
|
|
231
|
+
return _index7.isEmail;
|
|
196
232
|
}
|
|
197
233
|
});
|
|
198
234
|
Object.defineProperty(exports, "isGstin", {
|
|
199
235
|
enumerable: true,
|
|
200
236
|
get: function () {
|
|
201
|
-
return
|
|
237
|
+
return _index7.isGstin;
|
|
202
238
|
}
|
|
203
239
|
});
|
|
204
240
|
Object.defineProperty(exports, "isHexColor", {
|
|
205
241
|
enumerable: true,
|
|
206
242
|
get: function () {
|
|
207
|
-
return
|
|
243
|
+
return _index7.isHexColor;
|
|
208
244
|
}
|
|
209
245
|
});
|
|
210
246
|
Object.defineProperty(exports, "isIfsc", {
|
|
211
247
|
enumerable: true,
|
|
212
248
|
get: function () {
|
|
213
|
-
return
|
|
249
|
+
return _index7.isIfsc;
|
|
214
250
|
}
|
|
215
251
|
});
|
|
216
252
|
Object.defineProperty(exports, "isIndianMobile", {
|
|
217
253
|
enumerable: true,
|
|
218
254
|
get: function () {
|
|
219
|
-
return
|
|
255
|
+
return _index7.isIndianMobile;
|
|
220
256
|
}
|
|
221
257
|
});
|
|
222
258
|
Object.defineProperty(exports, "isIndianPincode", {
|
|
223
259
|
enumerable: true,
|
|
224
260
|
get: function () {
|
|
225
|
-
return
|
|
261
|
+
return _index7.isIndianPincode;
|
|
226
262
|
}
|
|
227
263
|
});
|
|
228
264
|
Object.defineProperty(exports, "isInteger", {
|
|
229
265
|
enumerable: true,
|
|
230
266
|
get: function () {
|
|
231
|
-
return
|
|
267
|
+
return _index7.isInteger;
|
|
232
268
|
}
|
|
233
269
|
});
|
|
234
270
|
Object.defineProperty(exports, "isJWTExpired", {
|
|
@@ -240,55 +276,79 @@ Object.defineProperty(exports, "isJWTExpired", {
|
|
|
240
276
|
Object.defineProperty(exports, "isNonEmpty", {
|
|
241
277
|
enumerable: true,
|
|
242
278
|
get: function () {
|
|
243
|
-
return
|
|
279
|
+
return _index7.isNonEmpty;
|
|
244
280
|
}
|
|
245
281
|
});
|
|
246
282
|
Object.defineProperty(exports, "isNumeric", {
|
|
247
283
|
enumerable: true,
|
|
248
284
|
get: function () {
|
|
249
|
-
return
|
|
285
|
+
return _index7.isNumeric;
|
|
250
286
|
}
|
|
251
287
|
});
|
|
252
288
|
Object.defineProperty(exports, "isPan", {
|
|
253
289
|
enumerable: true,
|
|
254
290
|
get: function () {
|
|
255
|
-
return
|
|
291
|
+
return _index7.isPan;
|
|
256
292
|
}
|
|
257
293
|
});
|
|
258
294
|
Object.defineProperty(exports, "isPhone", {
|
|
259
295
|
enumerable: true,
|
|
260
296
|
get: function () {
|
|
261
|
-
return
|
|
297
|
+
return _index7.isPhone;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
Object.defineProperty(exports, "isRetryableStatus", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _retry.isRetryableStatus;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "isStorageAvailable", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () {
|
|
309
|
+
return _index6.isStorageAvailable;
|
|
262
310
|
}
|
|
263
311
|
});
|
|
264
312
|
Object.defineProperty(exports, "isStrongPassword", {
|
|
265
313
|
enumerable: true,
|
|
266
314
|
get: function () {
|
|
267
|
-
return
|
|
315
|
+
return _index7.isStrongPassword;
|
|
268
316
|
}
|
|
269
317
|
});
|
|
270
318
|
Object.defineProperty(exports, "isUrl", {
|
|
271
319
|
enumerable: true,
|
|
272
320
|
get: function () {
|
|
273
|
-
return
|
|
321
|
+
return _index7.isUrl;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(exports, "logCurl", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () {
|
|
327
|
+
return _curl.logCurl;
|
|
274
328
|
}
|
|
275
329
|
});
|
|
276
330
|
Object.defineProperty(exports, "maxLength", {
|
|
277
331
|
enumerable: true,
|
|
278
332
|
get: function () {
|
|
279
|
-
return
|
|
333
|
+
return _index7.maxLength;
|
|
280
334
|
}
|
|
281
335
|
});
|
|
282
336
|
Object.defineProperty(exports, "minLength", {
|
|
283
337
|
enumerable: true,
|
|
284
338
|
get: function () {
|
|
285
|
-
return
|
|
339
|
+
return _index7.minLength;
|
|
286
340
|
}
|
|
287
341
|
});
|
|
288
342
|
Object.defineProperty(exports, "normalizePhone", {
|
|
289
343
|
enumerable: true,
|
|
290
344
|
get: function () {
|
|
291
|
-
return
|
|
345
|
+
return _index3.normalizePhone;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(exports, "parseDeepLink", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () {
|
|
351
|
+
return _index2.parseDeepLink;
|
|
292
352
|
}
|
|
293
353
|
});
|
|
294
354
|
Object.defineProperty(exports, "publicClient", {
|
|
@@ -309,16 +369,28 @@ Object.defineProperty(exports, "resetConfig", {
|
|
|
309
369
|
return _index.resetConfig;
|
|
310
370
|
}
|
|
311
371
|
});
|
|
372
|
+
Object.defineProperty(exports, "resetRefreshState", {
|
|
373
|
+
enumerable: true,
|
|
374
|
+
get: function () {
|
|
375
|
+
return _userClient.resetRefreshState;
|
|
376
|
+
}
|
|
377
|
+
});
|
|
312
378
|
Object.defineProperty(exports, "setConfig", {
|
|
313
379
|
enumerable: true,
|
|
314
380
|
get: function () {
|
|
315
381
|
return _index.setConfig;
|
|
316
382
|
}
|
|
317
383
|
});
|
|
384
|
+
Object.defineProperty(exports, "setDeviceContext", {
|
|
385
|
+
enumerable: true,
|
|
386
|
+
get: function () {
|
|
387
|
+
return _index4.setDeviceContext;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
318
390
|
Object.defineProperty(exports, "setDeviceInfoImplementation", {
|
|
319
391
|
enumerable: true,
|
|
320
392
|
get: function () {
|
|
321
|
-
return
|
|
393
|
+
return _index8.setDeviceInfoImplementation;
|
|
322
394
|
}
|
|
323
395
|
});
|
|
324
396
|
Object.defineProperty(exports, "setKeychainImplementation", {
|
|
@@ -327,10 +399,16 @@ Object.defineProperty(exports, "setKeychainImplementation", {
|
|
|
327
399
|
return _authStore.setKeychainImplementation;
|
|
328
400
|
}
|
|
329
401
|
});
|
|
402
|
+
Object.defineProperty(exports, "setNetworkStatusImplementation", {
|
|
403
|
+
enumerable: true,
|
|
404
|
+
get: function () {
|
|
405
|
+
return _index5.setNetworkStatusImplementation;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
330
408
|
Object.defineProperty(exports, "setRemoteLogger", {
|
|
331
409
|
enumerable: true,
|
|
332
410
|
get: function () {
|
|
333
|
-
return
|
|
411
|
+
return _index4.setRemoteLogger;
|
|
334
412
|
}
|
|
335
413
|
});
|
|
336
414
|
Object.defineProperty(exports, "setStorageImplementation", {
|
|
@@ -345,16 +423,22 @@ Object.defineProperty(exports, "storeToken", {
|
|
|
345
423
|
return _authStore.storeToken;
|
|
346
424
|
}
|
|
347
425
|
});
|
|
426
|
+
Object.defineProperty(exports, "useDeepLink", {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
get: function () {
|
|
429
|
+
return _index2.useDeepLink;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
348
432
|
Object.defineProperty(exports, "useNetworkStatus", {
|
|
349
433
|
enumerable: true,
|
|
350
434
|
get: function () {
|
|
351
|
-
return
|
|
435
|
+
return _index5.useNetworkStatus;
|
|
352
436
|
}
|
|
353
437
|
});
|
|
354
438
|
Object.defineProperty(exports, "useVersionCheck", {
|
|
355
439
|
enumerable: true,
|
|
356
440
|
get: function () {
|
|
357
|
-
return
|
|
441
|
+
return _index8.useVersionCheck;
|
|
358
442
|
}
|
|
359
443
|
});
|
|
360
444
|
Object.defineProperty(exports, "userClient", {
|
|
@@ -363,21 +447,22 @@ Object.defineProperty(exports, "userClient", {
|
|
|
363
447
|
return _userClient.default;
|
|
364
448
|
}
|
|
365
449
|
});
|
|
450
|
+
var _curl = require("./api/curl.js");
|
|
366
451
|
var _publicClient = _interopRequireDefault(require("./api/publicClient.js"));
|
|
452
|
+
var _retry = require("./api/retry.js");
|
|
367
453
|
var _userClient = _interopRequireWildcard(require("./api/userClient.js"));
|
|
368
454
|
var _authStore = require("./auth/authStore.js");
|
|
369
455
|
var _jwt = require("./auth/jwt.js");
|
|
370
456
|
var _index = require("./config/index.js");
|
|
371
|
-
var _index2 = require("./
|
|
457
|
+
var _index2 = require("./deepLink/index.js");
|
|
458
|
+
var _index3 = require("./formatters/index.js");
|
|
372
459
|
var _initSDK = require("./initSDK.js");
|
|
373
460
|
var _initUserAuth = require("./initUserAuth.js");
|
|
374
|
-
var
|
|
375
|
-
var
|
|
376
|
-
var _index5 = require("./permissions/index.js");
|
|
461
|
+
var _index4 = require("./logger/index.js");
|
|
462
|
+
var _index5 = require("./network/index.js");
|
|
377
463
|
var _index6 = require("./storage/index.js");
|
|
378
|
-
var _index7 = require("./
|
|
379
|
-
var _index8 = require("./
|
|
380
|
-
var _index9 = require("./versionCheck/index.js");
|
|
464
|
+
var _index7 = require("./validators/index.js");
|
|
465
|
+
var _index8 = require("./versionCheck/index.js");
|
|
381
466
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
382
467
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
383
468
|
//# sourceMappingURL=index.js.map
|
package/lib/commonjs/initSDK.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.initWebority = void 0;
|
|
7
|
+
var _authStore = require("./auth/authStore.js");
|
|
7
8
|
var _index = require("./config/index.js");
|
|
9
|
+
var _index2 = require("./logger/index.js");
|
|
10
|
+
var _networkStatus = require("./network/networkStatus.js");
|
|
11
|
+
var _index3 = require("./storage/index.js");
|
|
8
12
|
/**
|
|
9
13
|
* Simple initialization API for Webority packages
|
|
10
14
|
* One function to configure everything needed
|
|
@@ -37,9 +41,26 @@ const initWebority = config => {
|
|
|
37
41
|
loggingEnabled: config.loggingEnabled ?? true,
|
|
38
42
|
logLevel: config.logLevel || 'info',
|
|
39
43
|
environment: config.environment || 'Development',
|
|
40
|
-
country: (config.country || 'in').toLowerCase()
|
|
44
|
+
country: (config.country || 'in').toLowerCase(),
|
|
45
|
+
appId: config.appId ?? null,
|
|
46
|
+
appVersion: config.appVersion ?? null,
|
|
47
|
+
logCurl: config.logCurl ?? false
|
|
41
48
|
});
|
|
42
|
-
|
|
49
|
+
|
|
50
|
+
// Only what the caller actually passed is wired. Calling a setter with
|
|
51
|
+
// `undefined` would reset a backend an app had already injected by hand,
|
|
52
|
+
// which is why each is guarded rather than passed straight through.
|
|
53
|
+
const backends = config.backends;
|
|
54
|
+
if (backends?.storage) {
|
|
55
|
+
(0, _index3.setStorageImplementation)(backends.storage);
|
|
56
|
+
}
|
|
57
|
+
if (backends?.keychain) {
|
|
58
|
+
(0, _authStore.setKeychainImplementation)(backends.keychain);
|
|
59
|
+
}
|
|
60
|
+
if (backends?.network) {
|
|
61
|
+
(0, _networkStatus.setNetworkStatusImplementation)(backends.network);
|
|
62
|
+
}
|
|
63
|
+
_index2.Logger.info('[@webority-technologies/mobile-core] initialized');
|
|
43
64
|
};
|
|
44
65
|
exports.initWebority = initWebority;
|
|
45
66
|
//# sourceMappingURL=initSDK.js.map
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.initUserAuth = void 0;
|
|
7
7
|
var _userClient = require("./api/userClient.js");
|
|
8
|
+
var _index = require("./logger/index.js");
|
|
8
9
|
/**
|
|
9
10
|
* Simple initialization API for Webority User package
|
|
10
11
|
* Easy setup for Redux integration
|
|
@@ -32,7 +33,7 @@ const initUserAuth = (store, authActions) => {
|
|
|
32
33
|
}
|
|
33
34
|
(0, _userClient.injectStore)(store);
|
|
34
35
|
(0, _userClient.injectAuthActions)(authActions);
|
|
35
|
-
|
|
36
|
+
_index.Logger.info('[@webority-technologies/mobile-core] user auth wired to the store');
|
|
36
37
|
};
|
|
37
38
|
exports.initUserAuth = initUserAuth;
|
|
38
39
|
//# sourceMappingURL=initUserAuth.js.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.setRemoteLogger = exports.Logger = void 0;
|
|
6
|
+
exports.setRemoteLogger = exports.setDeviceContext = exports.getDeviceContext = exports.configureLogger = exports.Logger = void 0;
|
|
7
7
|
var _index = require("../config/index.js");
|
|
8
8
|
// ANSI color codes
|
|
9
9
|
const Colors = {
|
|
@@ -76,6 +76,139 @@ const toErrorObject = input => {
|
|
|
76
76
|
return new Error(String(input));
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Device / app context attached once at boot (platform, OS version, app version,
|
|
82
|
+
* build number, device model, etc). Merged into every `recordError` context so
|
|
83
|
+
* every crash carries it without every call site repeating it.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
let deviceContext = null;
|
|
87
|
+
const normalizeAttributeValue = value => {
|
|
88
|
+
if (value === null || value === undefined) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
return String(value);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Set (or clear, with `null`) the device/app context merged into every
|
|
99
|
+
* `recordError` call. Each key is also forwarded to `remote.setAttribute`
|
|
100
|
+
* once, at the moment it is set.
|
|
101
|
+
*/
|
|
102
|
+
const setDeviceContext = context => {
|
|
103
|
+
deviceContext = context;
|
|
104
|
+
if (context) {
|
|
105
|
+
for (const [key, value] of Object.entries(context)) {
|
|
106
|
+
safe(() => remote?.setAttribute?.(key, normalizeAttributeValue(value)));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
exports.setDeviceContext = setDeviceContext;
|
|
111
|
+
const getDeviceContext = () => deviceContext;
|
|
112
|
+
|
|
113
|
+
/** Tuning knobs for screen history and duplicate-error suppression. */
|
|
114
|
+
exports.getDeviceContext = getDeviceContext;
|
|
115
|
+
const DEFAULT_LOGGER_OPTIONS = {
|
|
116
|
+
dedupeWindowMs: 5000,
|
|
117
|
+
dedupeMaxPerWindow: 1,
|
|
118
|
+
screenHistoryLimit: 20
|
|
119
|
+
};
|
|
120
|
+
let loggerOptions = {
|
|
121
|
+
...DEFAULT_LOGGER_OPTIONS
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Configure dedupe window/threshold and screen history size. Merges with current options. */
|
|
125
|
+
const configureLogger = options => {
|
|
126
|
+
loggerOptions = {
|
|
127
|
+
...loggerOptions,
|
|
128
|
+
...options
|
|
129
|
+
};
|
|
130
|
+
if (screenHistory.length > loggerOptions.screenHistoryLimit) {
|
|
131
|
+
screenHistory = screenHistory.slice(screenHistory.length - loggerOptions.screenHistoryLimit);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
exports.configureLogger = configureLogger;
|
|
135
|
+
let currentScreen = null;
|
|
136
|
+
let screenHistory = [];
|
|
137
|
+
const dedupeMap = new Map();
|
|
138
|
+
const MAX_DEDUPE_ENTRIES = 200;
|
|
139
|
+
const dedupeKeyFor = err => {
|
|
140
|
+
const firstFrame = err.stack?.split('\n')[1]?.trim();
|
|
141
|
+
return firstFrame ? `${err.message}::${firstFrame}` : err.message;
|
|
142
|
+
};
|
|
143
|
+
const capDedupeMap = () => {
|
|
144
|
+
while (dedupeMap.size > MAX_DEDUPE_ENTRIES) {
|
|
145
|
+
const oldestKey = dedupeMap.keys().next().value;
|
|
146
|
+
if (oldestKey === undefined) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
dedupeMap.delete(oldestKey);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const shouldForward = key => {
|
|
153
|
+
if (loggerOptions.dedupeWindowMs <= 0) {
|
|
154
|
+
return {
|
|
155
|
+
forward: true
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
const now = Date.now();
|
|
159
|
+
const entry = dedupeMap.get(key);
|
|
160
|
+
if (!entry || now - entry.windowStart >= loggerOptions.dedupeWindowMs) {
|
|
161
|
+
const suppressedCount = entry?.suppressedCount ?? 0;
|
|
162
|
+
dedupeMap.set(key, {
|
|
163
|
+
windowStart: now,
|
|
164
|
+
count: 1,
|
|
165
|
+
suppressedCount: 0
|
|
166
|
+
});
|
|
167
|
+
capDedupeMap();
|
|
168
|
+
return suppressedCount > 0 ? {
|
|
169
|
+
forward: true,
|
|
170
|
+
suppressedCount
|
|
171
|
+
} : {
|
|
172
|
+
forward: true
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
entry.count += 1;
|
|
176
|
+
if (entry.count > loggerOptions.dedupeMaxPerWindow) {
|
|
177
|
+
entry.suppressedCount += 1;
|
|
178
|
+
return {
|
|
179
|
+
forward: false
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
forward: true
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const buildErrorContext = (context, suppressedCount) => {
|
|
187
|
+
const merged = {
|
|
188
|
+
...deviceContext
|
|
189
|
+
};
|
|
190
|
+
if (currentScreen !== null) {
|
|
191
|
+
merged.screen = currentScreen;
|
|
192
|
+
}
|
|
193
|
+
if (suppressedCount) {
|
|
194
|
+
merged.suppressedCount = suppressedCount;
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
...merged,
|
|
198
|
+
...context
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
const forwardErrorToRemote = (err, context) => {
|
|
202
|
+
const key = dedupeKeyFor(err);
|
|
203
|
+
const {
|
|
204
|
+
forward,
|
|
205
|
+
suppressedCount
|
|
206
|
+
} = shouldForward(key);
|
|
207
|
+
if (!forward) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
safe(() => remote?.recordError?.(err, buildErrorContext(context, suppressedCount)));
|
|
211
|
+
};
|
|
79
212
|
const logInfo = (message, ...optionalParams) => {
|
|
80
213
|
if (!isEnabled() || !isLogLevelAllowed(LogLevels.INFO.level)) {
|
|
81
214
|
return;
|
|
@@ -100,10 +233,10 @@ const logError = (message, ...optionalParams) => {
|
|
|
100
233
|
// First optional param is treated as the underlying error if it looks like one.
|
|
101
234
|
const candidate = optionalParams[0];
|
|
102
235
|
if (candidate !== undefined) {
|
|
103
|
-
|
|
236
|
+
forwardErrorToRemote(toErrorObject(candidate), {
|
|
104
237
|
source: 'Logger.error',
|
|
105
238
|
message
|
|
106
|
-
})
|
|
239
|
+
});
|
|
107
240
|
}
|
|
108
241
|
};
|
|
109
242
|
const breadcrumb = (message, data) => {
|
|
@@ -117,7 +250,7 @@ const recordError = (error, context) => {
|
|
|
117
250
|
if (isEnabled() && isLogLevelAllowed('error')) {
|
|
118
251
|
console.error(`${Colors.RED_BOLD}[RECORDED]: ${err.message}${Colors.RESET}`, context ?? '');
|
|
119
252
|
}
|
|
120
|
-
|
|
253
|
+
forwardErrorToRemote(err, context);
|
|
121
254
|
};
|
|
122
255
|
const setUser = (id, attrs) => {
|
|
123
256
|
safe(() => remote?.setUser?.(id, attrs));
|
|
@@ -125,6 +258,24 @@ const setUser = (id, attrs) => {
|
|
|
125
258
|
const setAttribute = (key, value) => {
|
|
126
259
|
safe(() => remote?.setAttribute?.(key, value));
|
|
127
260
|
};
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Record the active screen as a breadcrumb and remember it for subsequent
|
|
264
|
+
* `recordError` context. Re-tracking the same screen name is a no-op.
|
|
265
|
+
*/
|
|
266
|
+
const trackScreen = (name, params) => {
|
|
267
|
+
if (name === currentScreen) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
currentScreen = name;
|
|
271
|
+
screenHistory.push(name);
|
|
272
|
+
if (screenHistory.length > loggerOptions.screenHistoryLimit) {
|
|
273
|
+
screenHistory = screenHistory.slice(screenHistory.length - loggerOptions.screenHistoryLimit);
|
|
274
|
+
}
|
|
275
|
+
breadcrumb(`Screen: ${name}`, params);
|
|
276
|
+
};
|
|
277
|
+
const getCurrentScreen = () => currentScreen;
|
|
278
|
+
const getScreenHistory = () => [...screenHistory];
|
|
128
279
|
const Logger = exports.Logger = {
|
|
129
280
|
info: logInfo,
|
|
130
281
|
warn: logWarning,
|
|
@@ -132,6 +283,9 @@ const Logger = exports.Logger = {
|
|
|
132
283
|
breadcrumb,
|
|
133
284
|
recordError,
|
|
134
285
|
setUser,
|
|
135
|
-
setAttribute
|
|
286
|
+
setAttribute,
|
|
287
|
+
trackScreen,
|
|
288
|
+
getCurrentScreen,
|
|
289
|
+
getScreenHistory
|
|
136
290
|
};
|
|
137
291
|
//# sourceMappingURL=index.js.map
|