@getpara/react-native-wallet 2.0.0-alpha.71 → 2.0.0-alpha.73
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/dist/shim.js +35 -0
- package/package.json +5 -5
- package/src/shim.js +44 -0
package/dist/shim.js
CHANGED
|
@@ -268,6 +268,40 @@ const setupTextEncodingPolyfills = () => {
|
|
|
268
268
|
globalThis.TextEncoder = TextEncoder;
|
|
269
269
|
globalThis.TextDecoder = TextDecoder;
|
|
270
270
|
};
|
|
271
|
+
const setupWindowLocationPolyfill = () => {
|
|
272
|
+
const FALLBACK_HOST = 'para.mobile';
|
|
273
|
+
const FALLBACK_ORIGIN = `https://${FALLBACK_HOST}`;
|
|
274
|
+
const globalScope = globalThis;
|
|
275
|
+
if (!globalScope.window || typeof globalScope.window !== 'object') {
|
|
276
|
+
globalScope.window = globalScope;
|
|
277
|
+
}
|
|
278
|
+
const win = globalScope.window;
|
|
279
|
+
const existingLocation = (win && win.location) || globalScope.location;
|
|
280
|
+
const hasOrigin = existingLocation &&
|
|
281
|
+
typeof existingLocation === 'object' &&
|
|
282
|
+
typeof existingLocation.origin === 'string' &&
|
|
283
|
+
typeof existingLocation.host === 'string';
|
|
284
|
+
if (hasOrigin) {
|
|
285
|
+
if (!globalScope.location) {
|
|
286
|
+
globalScope.location = existingLocation;
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const fallbackLocation = {
|
|
291
|
+
href: `${FALLBACK_ORIGIN}/`,
|
|
292
|
+
origin: FALLBACK_ORIGIN,
|
|
293
|
+
protocol: 'https:',
|
|
294
|
+
host: FALLBACK_HOST,
|
|
295
|
+
hostname: FALLBACK_HOST,
|
|
296
|
+
port: '',
|
|
297
|
+
pathname: '/',
|
|
298
|
+
};
|
|
299
|
+
const patchedLocation = typeof existingLocation === 'object' && existingLocation !== null
|
|
300
|
+
? Object.assign({}, fallbackLocation, existingLocation)
|
|
301
|
+
: fallbackLocation;
|
|
302
|
+
win.location = patchedLocation;
|
|
303
|
+
globalScope.location = patchedLocation;
|
|
304
|
+
};
|
|
271
305
|
const setupStructuredClonePolyfill = () => {
|
|
272
306
|
if (typeof globalThis.structuredClone === 'function') {
|
|
273
307
|
return;
|
|
@@ -304,6 +338,7 @@ const setupStructuredClonePolyfill = () => {
|
|
|
304
338
|
setupProcessPolyfill();
|
|
305
339
|
setupBufferPolyfill();
|
|
306
340
|
setupBase64Polyfills();
|
|
341
|
+
setupWindowLocationPolyfill();
|
|
307
342
|
setupCryptoPolyfills();
|
|
308
343
|
setupTextEncodingPolyfills();
|
|
309
344
|
setupStructuredClonePolyfill();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/react-native-wallet",
|
|
3
3
|
"description": "Para Wallet for React Native",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.73",
|
|
5
5
|
"author": "Para Team <hello@getpara.com> (https://getpara.com)",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@getpara/core-sdk": "2.0.0-alpha.
|
|
8
|
-
"@getpara/user-management-client": "2.0.0-alpha.
|
|
9
|
-
"@getpara/web-sdk": "2.0.0-alpha.
|
|
7
|
+
"@getpara/core-sdk": "2.0.0-alpha.73",
|
|
8
|
+
"@getpara/user-management-client": "2.0.0-alpha.73",
|
|
9
|
+
"@getpara/web-sdk": "2.0.0-alpha.73",
|
|
10
10
|
"@peculiar/webcrypto": "^1.5.0",
|
|
11
11
|
"@ungap/structured-clone": "1.3.0",
|
|
12
12
|
"node-forge": "1.3.1",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
]
|
|
94
94
|
}
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "52a9fc31810d56e792e23f68b73e1d4efbf6b96b"
|
|
97
97
|
}
|
package/src/shim.js
CHANGED
|
@@ -306,6 +306,49 @@ const setupTextEncodingPolyfills = () => {
|
|
|
306
306
|
globalThis.TextDecoder = TextDecoder;
|
|
307
307
|
};
|
|
308
308
|
|
|
309
|
+
const setupWindowLocationPolyfill = () => {
|
|
310
|
+
const FALLBACK_HOST = 'para.mobile';
|
|
311
|
+
const FALLBACK_ORIGIN = `https://${FALLBACK_HOST}`;
|
|
312
|
+
|
|
313
|
+
const globalScope = globalThis;
|
|
314
|
+
if (!globalScope.window || typeof globalScope.window !== 'object') {
|
|
315
|
+
globalScope.window = globalScope;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const win = globalScope.window;
|
|
319
|
+
const existingLocation = (win && win.location) || globalScope.location;
|
|
320
|
+
const hasOrigin =
|
|
321
|
+
existingLocation &&
|
|
322
|
+
typeof existingLocation === 'object' &&
|
|
323
|
+
typeof existingLocation.origin === 'string' &&
|
|
324
|
+
typeof existingLocation.host === 'string';
|
|
325
|
+
|
|
326
|
+
if (hasOrigin) {
|
|
327
|
+
if (!globalScope.location) {
|
|
328
|
+
globalScope.location = existingLocation;
|
|
329
|
+
}
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const fallbackLocation = {
|
|
334
|
+
href: `${FALLBACK_ORIGIN}/`,
|
|
335
|
+
origin: FALLBACK_ORIGIN,
|
|
336
|
+
protocol: 'https:',
|
|
337
|
+
host: FALLBACK_HOST,
|
|
338
|
+
hostname: FALLBACK_HOST,
|
|
339
|
+
port: '',
|
|
340
|
+
pathname: '/',
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
const patchedLocation =
|
|
344
|
+
typeof existingLocation === 'object' && existingLocation !== null
|
|
345
|
+
? Object.assign({}, fallbackLocation, existingLocation)
|
|
346
|
+
: fallbackLocation;
|
|
347
|
+
|
|
348
|
+
win.location = patchedLocation;
|
|
349
|
+
globalScope.location = patchedLocation;
|
|
350
|
+
};
|
|
351
|
+
|
|
309
352
|
const setupStructuredClonePolyfill = () => {
|
|
310
353
|
if (typeof globalThis.structuredClone === 'function') {
|
|
311
354
|
return;
|
|
@@ -343,6 +386,7 @@ const setupStructuredClonePolyfill = () => {
|
|
|
343
386
|
setupProcessPolyfill();
|
|
344
387
|
setupBufferPolyfill();
|
|
345
388
|
setupBase64Polyfills();
|
|
389
|
+
setupWindowLocationPolyfill();
|
|
346
390
|
setupCryptoPolyfills();
|
|
347
391
|
setupTextEncodingPolyfills();
|
|
348
392
|
setupStructuredClonePolyfill();
|