@magic-sdk/react-native-bare 14.0.1-903c2bf → 14.2.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,483 @@
1
+ # v14.1.0 (Wed Jan 25 2023)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Bump Version of @magic-sdk/connect to 6.2.0, Again [#441](https://github.com/magiclabs/magic-js/pull/441) ([@Ariflo](https://github.com/Ariflo))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Release RN packages ([@Ariflo](https://github.com/Ariflo))
10
+ - Bumps `react-native-webview` peer dependency Requirement to `>=11.0.0` [#440](https://github.com/magiclabs/magic-js/pull/440) ([@Ariflo](https://github.com/Ariflo))
11
+ - sets react-native-webview peer to >=11.0.0 ([@Ariflo](https://github.com/Ariflo))
12
+ - Prevents Relayer from Overriding Status Bar Color [#436](https://github.com/magiclabs/magic-js/pull/436) ([@Ariflo](https://github.com/Ariflo))
13
+ - Sets autoManageStatusBarEnabled to false ([@Ariflo](https://github.com/Ariflo))
14
+ - Upgrades react-native-webview to latest ([@Ariflo](https://github.com/Ariflo))
15
+ - Add link to RN Demo Apps to READMEs ([@Ariflo](https://github.com/Ariflo))
16
+
17
+ #### 📝 Documentation
18
+
19
+ - Add link to RN Demo Apps to READMEs [#435](https://github.com/magiclabs/magic-js/pull/435) ([@Ariflo](https://github.com/Ariflo))
20
+
21
+ #### Authors: 1
22
+
23
+ - Arian Flores ([@Ariflo](https://github.com/Ariflo))
24
+
25
+ ---
26
+
27
+ # v14.0.0 (Thu Jan 19 2023)
28
+
29
+ #### 💥 Breaking Change
30
+
31
+ - Replaces WebView View wrapper with SafeAreaView [#431](https://github.com/magiclabs/magic-js/pull/431) ([@Ariflo](https://github.com/Ariflo))
32
+
33
+ #### 🐛 Bug Fix
34
+
35
+ - Update Yarn.lock ([@Ariflo](https://github.com/Ariflo))
36
+ - Adds react-native-safe-area-context as peer and updates README ([@Ariflo](https://github.com/Ariflo))
37
+ - Fix tests ([@Ariflo](https://github.com/Ariflo))
38
+ - Replaces WebView wrapper with SafeAreaView ([@Ariflo](https://github.com/Ariflo))
39
+
40
+ #### Authors: 1
41
+
42
+ - Arian Flores ([@Ariflo](https://github.com/Ariflo))
43
+
44
+ ---
45
+
46
+ # v13.1.1 (Wed Jan 18 2023)
47
+
48
+ #### 🐛 Bug Fix
49
+
50
+ - Adds react-native-inappbrowser-reborn as peer to Bare RN OAuth [#432](https://github.com/magiclabs/magic-js/pull/432) ([@Ariflo](https://github.com/Ariflo))
51
+ - README Updates ([@Ariflo](https://github.com/Ariflo))
52
+ - [CHORE] Clean up magic-js Deployment Stages [#429](https://github.com/magiclabs/magic-js/pull/429) ([@kgrubb](https://github.com/kgrubb))
53
+ - sync with master branch ([@kgrubb](https://github.com/kgrubb))
54
+
55
+ #### 🔩 Dependency Updates
56
+
57
+ - Bump qs from 6.5.2 to 6.5.3 [#400](https://github.com/magiclabs/magic-js/pull/400) ([@dependabot[bot]](https://github.com/dependabot[bot]))
58
+ - Bump decode-uri-component from 0.2.0 to 0.2.2 [#399](https://github.com/magiclabs/magic-js/pull/399) ([@dependabot[bot]](https://github.com/dependabot[bot]))
59
+
60
+ #### Authors: 3
61
+
62
+ - [@dependabot[bot]](https://github.com/dependabot[bot])
63
+ - Arian Flores ([@Ariflo](https://github.com/Ariflo))
64
+ - Keli (Madison) Grubb ([@kgrubb](https://github.com/kgrubb))
65
+
66
+ ---
67
+
68
+ # v13.1.0 (Fri Jan 06 2023)
69
+
70
+ #### 🚀 Enhancement
71
+
72
+ - Bare React Native / Expo React Native Package Split [#412](https://github.com/magiclabs/magic-js/pull/412) ([@Ariflo](https://github.com/Ariflo))
73
+
74
+ #### 🐛 Bug Fix
75
+
76
+ - Update core package versions ([@Ariflo](https://github.com/Ariflo))
77
+ - Fix Tests ([@Ariflo](https://github.com/Ariflo))
78
+ - Updates react-native-bare package README ([@Ariflo](https://github.com/Ariflo))
79
+ - Adds version patch to new SDKs ([@Ariflo](https://github.com/Ariflo))
80
+ - Updates @magic-sdk/types SDK ([@Ariflo](https://github.com/Ariflo))
81
+ - Create @magic-sdk/react-native-bare SDK ([@Ariflo](https://github.com/Ariflo))
82
+
83
+ #### Authors: 1
84
+
85
+ - Arian Flores ([@Ariflo](https://github.com/Ariflo))
86
+
87
+ ---
88
+
89
+ # v12.0.0 (Tue Dec 20 2022)
90
+
91
+ #### 🐛 Bug Fix
92
+
93
+ - Merge branch 'master' into mushfichowdhury-sc-61149-implement-event-emitting-in-magic-sdk-based ([@mushfichowdhury-magic](https://github.com/mushfichowdhury-magic))
94
+ - Adds more Context about Expo dependency in `@magic-ext/react-native-oauth` to README [#386](https://github.com/magiclabs/magic-js/pull/386) ([@Ariflo](https://github.com/Ariflo))
95
+
96
+ #### 📝 Documentation
97
+
98
+ - Adds advice for fixing symlink error in RN projects inside of Monorepos to README [#395](https://github.com/magiclabs/magic-js/pull/395) ([@Ariflo](https://github.com/Ariflo))
99
+
100
+ #### Authors: 2
101
+
102
+ - Arian Flores ([@Ariflo](https://github.com/Ariflo))
103
+ - Mushfi Chowdhury ([@mushfichowdhury-magic](https://github.com/mushfichowdhury-magic))
104
+
105
+ ---
106
+
107
+ # v10.0.1 (Fri Sep 09 2022)
108
+
109
+ #### 🐛 Bug Fix
110
+
111
+ - Add RN TypedArray stringify conversion logic [#357](https://github.com/magiclabs/magic-js/pull/357) ([@Ethella](https://github.com/Ethella))
112
+
113
+ #### Authors: 1
114
+
115
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
116
+
117
+ ---
118
+
119
+ # v10.0.0 (Fri Aug 05 2022)
120
+
121
+ #### 💥 Breaking Change
122
+
123
+ - Revert "Revert "Enable bundle Id in Expo"" [#338](https://github.com/magiclabs/magic-js/pull/338) ([@Ethella](https://github.com/Ethella))
124
+ - Enable bundle Id in Expo [#335](https://github.com/magiclabs/magic-js/pull/335) ([@Ethella](https://github.com/Ethella))
125
+
126
+ #### 🐛 Bug Fix
127
+
128
+ - Merge branch 'master' into early-access ([@bcleary06](https://github.com/bcleary06))
129
+ - Update Readme and manual version bump for releases [#339](https://github.com/magiclabs/magic-js/pull/339) ([@Ethella](https://github.com/Ethella))
130
+ - Revert "Enable bundle Id in Expo" [#337](https://github.com/magiclabs/magic-js/pull/337) ([@Ethella](https://github.com/Ethella))
131
+
132
+ #### Authors: 2
133
+
134
+ - Brian Cleary ([@bcleary06](https://github.com/bcleary06))
135
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
136
+
137
+ ---
138
+
139
+ # v8.2.0 (Mon Mar 07 2022)
140
+
141
+ #### 🐛 Bug Fix
142
+
143
+ - Update READMEs with outdated context/hyperlinks ([@smithki](https://github.com/smithki))
144
+ - Merge branch 'master' into smithki/better-build-system-documentation ([@smithki](https://github.com/smithki))
145
+
146
+ #### 🏠 Internal
147
+
148
+ - Internal documentation updates (`BUILD_SYSTEM.md`) [#283](https://github.com/magiclabs/magic-js/pull/283) ([@smithki](https://github.com/smithki))
149
+
150
+ #### Authors: 1
151
+
152
+ - Ian K Smith ([@smithki](https://github.com/smithki))
153
+
154
+ ---
155
+
156
+ # v8.1.0 (Mon Jan 31 2022)
157
+
158
+ #### 🚀 Enhancement
159
+
160
+ - Add special parsing logic to handle typed array in payload [#275](https://github.com/magiclabs/magic-js/pull/275) ([@Ethella](https://github.com/Ethella))
161
+
162
+ #### Authors: 1
163
+
164
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
165
+
166
+ ---
167
+
168
+ # v8.0.0 (Tue Jan 25 2022)
169
+
170
+ #### 💥 Breaking Change
171
+
172
+ - Switch from `microbundle` to `esbuild` [#220](https://github.com/magiclabs/magic-js/pull/220) ([@smithki](https://github.com/smithki))
173
+
174
+ #### 🐛 Bug Fix
175
+
176
+ - Merge with master ([@smithki](https://github.com/smithki))
177
+ - Merge branch 'master' into feat/faster-builds ([@smithki](https://github.com/smithki))
178
+ - Remove comments from README files ([@smithki](https://github.com/smithki))
179
+
180
+ #### Authors: 1
181
+
182
+ - Ian K Smith ([@smithki](https://github.com/smithki))
183
+
184
+ ---
185
+
186
+ # v6.1.4 (Thu Oct 21 2021)
187
+
188
+ #### 🐛 Bug Fix
189
+
190
+ - Revert to `.js` extension for ES module builds targeting webpack/CRA [#232](https://github.com/magiclabs/magic-js/pull/232) ([@smithki](https://github.com/smithki))
191
+
192
+ #### Authors: 1
193
+
194
+ - Ian K Smith ([@smithki](https://github.com/smithki))
195
+
196
+ ---
197
+
198
+ # v6.1.3 (Wed Oct 20 2021)
199
+
200
+ #### ⚠️ Pushed to `master`
201
+
202
+ - Fix dist files glob in package.json ([@smithki](https://github.com/smithki))
203
+ - Merge branch 'master' of github.com:magiclabs/magic-js ([@smithki](https://github.com/smithki))
204
+ - Force re-publish ([@smithki](https://github.com/smithki))
205
+
206
+ #### Authors: 1
207
+
208
+ - Ian K Smith ([@smithki](https://github.com/smithki))
209
+
210
+ ---
211
+
212
+ # v6.1.2 (Wed Oct 20 2021)
213
+
214
+ #### 🐛 Bug Fix
215
+
216
+ - Use '.mjs' extension for ESM build files [#230](https://github.com/magiclabs/magic-js/pull/230) ([@smithki](https://github.com/smithki))
217
+
218
+ #### Authors: 1
219
+
220
+ - Ian K Smith ([@smithki](https://github.com/smithki))
221
+
222
+ ---
223
+
224
+ # v6.0.6 (Thu Sep 23 2021)
225
+
226
+ #### 🐛 Bug Fix
227
+
228
+ - Port `@magic-ext/oauth`, `@magic-ext/react-native-oauth`, `@magic-ext/webauthn` extensions to Magic SDK monorepo [#218](https://github.com/magiclabs/magic-js/pull/218) ([@smithki](https://github.com/smithki))
229
+ - Add `@magic-sdk/pnp` package for out-of-the-box login page UIs [#217](https://github.com/magiclabs/magic-js/pull/217) ([@smithki](https://github.com/smithki))
230
+
231
+ #### Authors: 1
232
+
233
+ - Ian K Smith ([@smithki](https://github.com/smithki))
234
+
235
+ ---
236
+
237
+ # v6.0.2 (Tue Sep 14 2021)
238
+
239
+ #### 🐛 Bug Fix
240
+
241
+ - Import regeneratorRuntime in Magic JS (non-CDN version) [#210](https://github.com/magiclabs/magic-js/pull/210) ([@smithki](https://github.com/smithki))
242
+
243
+ #### Authors: 1
244
+
245
+ - Ian K Smith ([@smithki](https://github.com/smithki))
246
+
247
+ ---
248
+
249
+ # v6.0.1 (Tue Sep 14 2021)
250
+
251
+ #### 🐛 Bug Fix
252
+
253
+ - Fix SemVer cyclic dependency issues with some hacks [#209](https://github.com/magiclabs/magic-js/pull/209) ([@smithki](https://github.com/smithki))
254
+
255
+ #### Authors: 1
256
+
257
+ - Ian K Smith ([@smithki](https://github.com/smithki))
258
+
259
+ ---
260
+
261
+ # v6.0.0 (Tue Sep 14 2021)
262
+
263
+ #### 💥 Breaking Change
264
+
265
+ - v6.0.0 [#208](https://github.com/magiclabs/magic-js/pull/208) ([@smithki](https://github.com/smithki))
266
+
267
+ #### Authors: 1
268
+
269
+ - Ian K Smith ([@smithki](https://github.com/smithki))
270
+
271
+ ---
272
+
273
+ # v4.4.2 (Mon Aug 16 2021)
274
+
275
+ #### 🐛 Bug Fix
276
+
277
+ - Migrate unit tests to Jest [#194](https://github.com/magiclabs/magic-js/pull/194) ([@smithki](https://github.com/smithki))
278
+
279
+ #### Authors: 1
280
+
281
+ - Ian K Smith ([@smithki](https://github.com/smithki))
282
+
283
+ ---
284
+
285
+ # v4.4.0 (Wed Jul 28 2021)
286
+
287
+ #### 🚀 Enhancement
288
+
289
+ - Add explicit JSDelivr entry-point for `magic-sdk` [#191](https://github.com/magiclabs/magic-js/pull/191) ([@smithki](https://github.com/smithki))
290
+
291
+ #### Authors: 1
292
+
293
+ - Ian K Smith ([@smithki](https://github.com/smithki))
294
+
295
+ ---
296
+
297
+ # v4.3.1 (Fri Jun 11 2021)
298
+
299
+ #### 🐛 Bug Fix
300
+
301
+ - Upgrade @aveq-research/localforage-asyncstorage-driver [#183](https://github.com/magiclabs/magic-js/pull/183) ([@Ethella](https://github.com/Ethella))
302
+
303
+ #### Authors: 1
304
+
305
+ - Jerry Liu ([@Ethella](https://github.com/Ethella))
306
+
307
+ ---
308
+
309
+ # v4.0.1 (Tue Dec 01 2020)
310
+
311
+ #### 🐛 Bug Fix
312
+
313
+ - Add 'importHelpers: true' to base tsconfig.json [#152](https://github.com/magiclabs/magic-js/pull/152) ([@smithki](https://github.com/smithki))
314
+
315
+ #### 📝 Documentation
316
+
317
+ - Fix incorrect TypeScript project references and update READMEs with changelog links [#151](https://github.com/magiclabs/magic-js/pull/151) ([@smithki](https://github.com/smithki))
318
+
319
+ #### Authors: 1
320
+
321
+ - Ian K Smith ([@smithki](https://github.com/smithki))
322
+
323
+ ---
324
+
325
+ # v4.0.0 (Tue Nov 17 2020)
326
+
327
+ #### 💥 Breaking Change
328
+
329
+ - [All packages] Internal API changes & Cleanups [#149](https://github.com/magiclabs/magic-js/pull/149) ([@smithki](https://github.com/smithki))
330
+
331
+ #### 🐛 Bug Fix
332
+
333
+ - Update CHANGELOGs and CONTRIBUTING guide [#146](https://github.com/magiclabs/magic-js/pull/146) ([@smithki](https://github.com/smithki))
334
+
335
+ #### 🏠 Internal
336
+
337
+ - Simplify scripts [#147](https://github.com/magiclabs/magic-js/pull/147) ([@smithki](https://github.com/smithki))
338
+
339
+ #### Authors: 1
340
+
341
+ - Ian K Smith ([@smithki](https://github.com/smithki))
342
+
343
+ ---
344
+
345
+ ## `3.0.1` - 10/21/2020
346
+
347
+ #### Changed
348
+
349
+ - Removed the following public methods and functions
350
+ - `BaseExtension.utils.encodeQueryParameters`
351
+ - `BaseExtension.utils.decodeQueryParameters`
352
+
353
+ ## `2.8.0` - 09/24/2020
354
+
355
+ #### Added
356
+
357
+ - Adds a Magic SDK extensions runtime compatibility check, ensuring you're version of Magic SDK is designed for the extensions you have in use.
358
+
359
+ ## `2.7.1` - 09/18/2020
360
+
361
+ #### Fixed
362
+
363
+ - Fix missing BigInt dependency #131
364
+
365
+ ## `2.7.0` - 09/15/2020
366
+
367
+ #### Added
368
+
369
+ - New, optional `redirectURI` parameter for the `loginWithMagicLink` method
370
+ - New `loginWithCredential` method for completing a magic link login with redirect: `await magic.auth.loginWithCredential()`
371
+
372
+ ## `2.6.0` - 08/24/2020
373
+
374
+ #### Added
375
+
376
+ - New optional `locale` parameter to SDK constructor
377
+
378
+ ## `2.5.1` - 08/20/2020
379
+
380
+ #### Added
381
+
382
+ - New RPC error code for the `loginWithMagicLink` method: `-10005`
383
+
384
+ ## `2.4.6` - 07/22/2020
385
+
386
+ #### Added
387
+
388
+ - Export `PromiEvent` type and `isPromiEvent` utility from SDK entry-points (`magic-sdk` and `@magic-sdk/react-native`).
389
+
390
+ ## `2.4.1` through `2.4.5` - 07/13/2020
391
+
392
+ #### Fixed
393
+
394
+ - Bug preventing NPM tarball from containing `/dist` files.
395
+
396
+ ## `2.4.0` - 07/13/2020
397
+
398
+ #### Changed
399
+
400
+ - Updated build system to use TypeScript project references instead of Microbundle.
401
+ - Pass `targetOrigin` parameter to `postMessage` calls.
402
+
403
+ ## `2.3.1` - 07/08/2020
404
+
405
+ #### Fixed
406
+
407
+ - Bug affecting `localforage` type imports causing compilation failure in TypeScript.
408
+
409
+ ## `2.3.0` - 07/08/2020
410
+
411
+ #### Added
412
+
413
+ - WebAuthn support.
414
+ - `localforage` APIs for Magic SDK Extensions.
415
+
416
+ ## `2.1.0` - 06/25/2020
417
+
418
+ #### Changed
419
+
420
+ - Update dependencies.
421
+
422
+ #### Added
423
+
424
+ - Add `ExtensionWarning` class.
425
+
426
+ ## `2.0.5` - 06/23/2020
427
+
428
+ #### Changed
429
+
430
+ - Update dependencies.
431
+
432
+ ## `2.0.4` - 06/23/2020
433
+
434
+ #### Changed
435
+
436
+ - Update dependencies.
437
+
438
+ ## `2.0.3` - 06/23/2020
439
+
440
+ #### Changed
441
+
442
+ - Update dependencies.
443
+
444
+ ## `2.0.2` - 06/22/2020
445
+
446
+ #### Changed
447
+
448
+ - Update dependencies.
449
+
450
+ ## `2.0.1` - 06/16/2020
451
+
452
+ #### Added
453
+
454
+ - Introduce the `ExtensionError` type to ease handling of errors rising from Magic SDK Extensions.
455
+
456
+ ## `2.0.0` - 06/12/2020
457
+
458
+ #### Changed
459
+
460
+ - Move "react-native-webivew" to peer dependencies
461
+
462
+ ## `1.0.1` - 06/11/2020
463
+
464
+ #### Changed
465
+
466
+ - Update dependencies.
467
+ - Circle CI tag in readme is broken after namechange from MagicHQ to MagicLabs
468
+
469
+ ## `1.0.0` - 06/02/2020
470
+
471
+ This is the first release our changelog records. Future updates will be logged in the following format:
472
+
473
+ #### Fixed
474
+
475
+ - Bug fixes and patches will be described here.
476
+
477
+ #### Changed
478
+
479
+ - Changes (breaking or otherwise) to current APIs will be described here.
480
+
481
+ #### Added
482
+
483
+ - New features or APIs will be described here.
package/README.md CHANGED
@@ -37,7 +37,7 @@ yarn add react-native-safe-area-context # Required Peer Dependency
37
37
 
38
38
  ## ⚡️ Quick Start
39
39
 
40
- Sign up or log in to the [developer dashboard](https://dashboard.magic.link) to receive API keys that will allow your application to interact with Magic's authentication APIs.
40
+ Sign up or log in to the [developer dashboard](https://dashboard.magic.link ) to receive API keys that will allow your application to interact with Magic's authentication APIs.
41
41
 
42
42
  Then, you can start authenticating users with _just one method!_
43
43
 
@@ -61,5 +61,7 @@ export default function App() {
61
61
  // Somewhere else in your code...
62
62
  await magic.auth.loginWithMagicLink({ email: 'your.email@example.com' });
63
63
  ```
64
+ ⁠⁠👉 Check out some of our [React Native Demo apps](https://github.com/magiclabs/react-native-demo) for inspiration! 👀
65
+
64
66
  ## 👀 SafeAreaView
65
67
  Please note that as of **v14.0.0** our React Native package offerings wrap the `<magic.Relayer />` in [react-native-safe-area-context's](https://github.com/th3rdwave/react-native-safe-area-context) `<SafeAreaView />`. To prevent any adverse behavior in your app, please place the Magic iFrame React component at the root view of your application wrapped in a [SafeAreaProvider](https://github.com/th3rdwave/react-native-safe-area-context#safeareaprovider) as described in the documentation.
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Le=Object.create;var V=Object.defineProperty,_e=Object.defineProperties,Oe=Object.getOwnPropertyDescriptor,Ae=Object.getOwnPropertyDescriptors,Re=Object.getOwnPropertyNames,oe=Object.getOwnPropertySymbols,Me=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var ie=(n,a,i)=>a in n?V(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,se=(n,a)=>{for(var i in a||(a={}))ae.call(a,i)&&ie(n,i,a[i]);if(oe)for(var i of oe(a))Ge.call(a,i)&&ie(n,i,a[i]);return n},ce=(n,a)=>_e(n,Ae(a));var Ve=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),Ne=(n,a)=>{for(var i in a)V(n,i,{get:a[i],enumerable:!0})},D=(n,a,i,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let c of Re(a))!ae.call(n,c)&&c!==i&&V(n,c,{get:()=>a[c],enumerable:!(p=Oe(a,c))||p.enumerable});return n},u=(n,a,i)=>(D(n,a,"default"),i&&D(i,a,"default")),M=(n,a,i)=>(i=n!=null?Le(Me(n)):{},D(a||!n||!n.__esModule?V(i,"default",{value:n,enumerable:!0}):i,n)),ke=n=>D(V({},"__esModule",{value:!0}),n);var T=(n,a,i)=>new Promise((p,c)=>{var E=g=>{try{L(i.next(g))}catch(v){c(v)}},h=g=>{try{L(i.throw(g))}catch(v){c(v)}},L=g=>g.done?p(g.value):Promise.resolve(g.value).then(E,h);L((i=i.apply(n,a)).next())});var fe=Ve((We,Q)=>{var x=function(n){"use strict";var a=Object.prototype,i=a.hasOwnProperty,p=Object.defineProperty||function(t,e,r){t[e]=r.value},c,E=typeof Symbol=="function"?Symbol:{},h=E.iterator||"@@iterator",L=E.asyncIterator||"@@asyncIterator",g=E.toStringTag||"@@toStringTag";function v(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch{v=function(e,r,s){return e[r]=s}}function _(t,e,r,s){var o=e&&e.prototype instanceof $?e:$,f=Object.create(o.prototype),m=new J(s||[]);return p(f,"_invoke",{value:Se(t,r,m)}),f}n.wrap=_;function U(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var Z="suspendedStart",be="suspendedYield",ee="executing",N="completed",S={};function $(){}function k(){}function O(){}var K={};v(K,h,function(){return this});var z=Object.getPrototypeOf,P=z&&z(z(H([])));P&&P!==a&&i.call(P,h)&&(K=P);var R=O.prototype=$.prototype=Object.create(K);k.prototype=O,p(R,"constructor",{value:O,configurable:!0}),p(O,"constructor",{value:k,configurable:!0}),k.displayName=v(O,g,"GeneratorFunction");function te(t){["next","throw","return"].forEach(function(e){v(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===k||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,O):(t.__proto__=O,v(t,g,"GeneratorFunction")),t.prototype=Object.create(R),t},n.awrap=function(t){return{__await:t}};function I(t,e){function r(f,m,d,b){var y=U(t[f],t,m);if(y.type==="throw")b(y.arg);else{var q=y.arg,G=q.value;return G&&typeof G=="object"&&i.call(G,"__await")?e.resolve(G.__await).then(function(A){r("next",A,d,b)},function(A){r("throw",A,d,b)}):e.resolve(G).then(function(A){q.value=A,d(q)},function(A){return r("throw",A,d,b)})}}var s;function o(f,m){function d(){return new e(function(b,y){r(f,m,b,y)})}return s=s?s.then(d,d):d()}p(this,"_invoke",{value:o})}te(I.prototype),v(I.prototype,L,function(){return this}),n.AsyncIterator=I,n.async=function(t,e,r,s,o){o===void 0&&(o=Promise);var f=new I(_(t,e,r,s),o);return n.isGeneratorFunction(e)?f:f.next().then(function(m){return m.done?m.value:f.next()})};function Se(t,e,r){var s=Z;return function(f,m){if(s===ee)throw new Error("Generator is already running");if(s===N){if(f==="throw")throw m;return ne()}for(r.method=f,r.arg=m;;){var d=r.delegate;if(d){var b=re(d,r);if(b){if(b===S)continue;return b}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===Z)throw s=N,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=ee;var y=U(t,e,r);if(y.type==="normal"){if(s=r.done?N:be,y.arg===S)continue;return{value:y.arg,done:r.done}}else y.type==="throw"&&(s=N,r.method="throw",r.arg=y.arg)}}}function re(t,e){var r=e.method,s=t.iterator[r];if(s===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,re(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),S;var o=U(s,t.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,S;var f=o.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,S;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,S}te(R),v(R,g,"Generator"),v(R,h,function(){return this}),v(R,"toString",function(){return"[object Generator]"});function Ee(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function J(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Ee,this),this.reset(!0)}n.keys=function(t){var e=Object(t),r=[];for(var s in e)r.push(s);return r.reverse(),function o(){for(;r.length;){var f=r.pop();if(f in e)return o.value=f,o.done=!1,o}return o.done=!0,o}};function H(t){if(t){var e=t[h];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,s=function o(){for(;++r<t.length;)if(i.call(t,r))return o.value=t[r],o.done=!1,o;return o.value=c,o.done=!0,o};return s.next=s}}return{next:ne}}n.values=H;function ne(){return{value:c,done:!0}}return J.prototype={constructor:J,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(F),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(b,y){return f.type="throw",f.arg=t,e.next=b,y&&(e.method="next",e.arg=c),!!y}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],f=o.completion;if(o.tryLoc==="root")return r("end");if(o.tryLoc<=this.prev){var m=i.call(o,"catchLoc"),d=i.call(o,"finallyLoc");if(m&&d){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(m){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else if(d){if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&i.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var o=s;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var f=o?o.completion:{};return f.type=t,f.arg=e,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),S},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),S}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var s=r.completion;if(s.type==="throw"){var o=s.arg;F(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:H(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),S}},n}(typeof Q=="object"?Q.exports:{});try{regeneratorRuntime=x}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=x:Function("r","regeneratorRuntime = r")(x)}});var l={};Ne(l,{Magic:()=>Te});module.exports=ke(l);var Ue=M(fe()),me=require("@magic-sdk/provider"),De=M(require("process")),de=M(require("localforage")),Y=require("whatwg-url"),B=require("buffer"),ye=M(require("lodash")),ge=require("react-native-device-info"),we=require("@aveq-research/localforage-asyncstorage-driver"),X=M(require("localforage-driver-memory"));var w=M(require("react")),le=require("react-native"),ue=require("react-native-webview"),he=require("react-native-safe-area-context"),W=require("@magic-sdk/provider"),pe=require("lodash");var Pe="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY";function Ie(){return le.StyleSheet.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var C=class extends W.ViewController{constructor(){super(...arguments);this.Relayer=()=>{let[i,p]=(0,w.useState)(!1),c=(0,w.useCallback)(_=>{this.webView=_},[]),E=(0,w.useCallback)(_=>{this.container=ce(se({},_),{showOverlay:h,hideOverlay:L})},[]),h=(0,w.useCallback)(()=>{p(!0)},[]),L=(0,w.useCallback)(()=>{p(!1)},[]),g=(0,w.useMemo)(()=>[this.styles["webview-container"],i?this.styles.show:this.styles.hide],[i]),v=(0,w.useCallback)(_=>{this.handleReactNativeWebViewMessage(_)},[]);return w.default.createElement(he.SafeAreaView,{ref:E,style:g},w.default.createElement(ue.WebView,{ref:c,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:v,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1}))}}init(){this.webView=null,this.container=null,this.styles=Ie()}handleReactNativeWebViewMessage(i){var p;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(E,h)=>{try{if(h&&typeof h=="object"&&h.flag&&h.flag==="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY")return new global[h.constructor](h.data.split(","))}catch(L){}return h});if(c&&c.msgType&&this.messageHandlers.size){c.response=(p=c.response)!=null?p:{};let E={data:c};for(let h of this.messageHandlers.values())h(E)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return T(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(p,c)=>(0,pe.isTypedArray)(c)?{constructor:c.constructor.name,data:c.toString(),flag:Pe}:c),this.endpoint);else throw(0,W.createModalNotReadyError)()})}};var ve=require("@magic-sdk/provider"),j=class extends ve.SDKBase{get Relayer(){return this.overlay.Relayer}};u(l,require("@magic-sdk/commons"),module.exports);global.process=ye.merge(global.process,De);global.process.browser=!1;global.Buffer=B.Buffer;global.URL=Y.URL;global.URLSearchParams=Y.URLSearchParams;global.btoa=n=>B.Buffer.from(n,"binary").toString("base64");global.atob=n=>B.Buffer.from(n,"base64").toString("binary");var Te=(0,me.createSDK)(j,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"14.0.0",bundleId:(0,ge.getBundleId)(),defaultEndpoint:"https://box.magic.link/",ViewController:C,configureStorage:()=>T(void 0,null,function*(){let n=de.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),a=(0,we.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(a),n.defineDriver(X)]),yield n.setDriver([a._driver,X._driver]),n})});0&&(module.exports={Magic});
1
+ "use strict";var Le=Object.create;var V=Object.defineProperty,_e=Object.defineProperties,Oe=Object.getOwnPropertyDescriptor,Ae=Object.getOwnPropertyDescriptors,Re=Object.getOwnPropertyNames,oe=Object.getOwnPropertySymbols,Me=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable;var ie=(n,a,i)=>a in n?V(n,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[a]=i,se=(n,a)=>{for(var i in a||(a={}))ae.call(a,i)&&ie(n,i,a[i]);if(oe)for(var i of oe(a))Ge.call(a,i)&&ie(n,i,a[i]);return n},ce=(n,a)=>_e(n,Ae(a));var Ve=(n,a)=>()=>(a||n((a={exports:{}}).exports,a),a.exports),Ne=(n,a)=>{for(var i in a)V(n,i,{get:a[i],enumerable:!0})},D=(n,a,i,p)=>{if(a&&typeof a=="object"||typeof a=="function")for(let c of Re(a))!ae.call(n,c)&&c!==i&&V(n,c,{get:()=>a[c],enumerable:!(p=Oe(a,c))||p.enumerable});return n},u=(n,a,i)=>(D(n,a,"default"),i&&D(i,a,"default")),M=(n,a,i)=>(i=n!=null?Le(Me(n)):{},D(a||!n||!n.__esModule?V(i,"default",{value:n,enumerable:!0}):i,n)),ke=n=>D(V({},"__esModule",{value:!0}),n);var T=(n,a,i)=>new Promise((p,c)=>{var E=g=>{try{L(i.next(g))}catch(v){c(v)}},h=g=>{try{L(i.throw(g))}catch(v){c(v)}},L=g=>g.done?p(g.value):Promise.resolve(g.value).then(E,h);L((i=i.apply(n,a)).next())});var fe=Ve((We,Q)=>{var x=function(n){"use strict";var a=Object.prototype,i=a.hasOwnProperty,p=Object.defineProperty||function(t,e,r){t[e]=r.value},c,E=typeof Symbol=="function"?Symbol:{},h=E.iterator||"@@iterator",L=E.asyncIterator||"@@asyncIterator",g=E.toStringTag||"@@toStringTag";function v(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{v({},"")}catch{v=function(e,r,s){return e[r]=s}}function _(t,e,r,s){var o=e&&e.prototype instanceof $?e:$,f=Object.create(o.prototype),m=new J(s||[]);return p(f,"_invoke",{value:Se(t,r,m)}),f}n.wrap=_;function U(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(s){return{type:"throw",arg:s}}}var Z="suspendedStart",be="suspendedYield",ee="executing",N="completed",S={};function $(){}function k(){}function O(){}var K={};v(K,h,function(){return this});var z=Object.getPrototypeOf,P=z&&z(z(H([])));P&&P!==a&&i.call(P,h)&&(K=P);var R=O.prototype=$.prototype=Object.create(K);k.prototype=O,p(R,"constructor",{value:O,configurable:!0}),p(O,"constructor",{value:k,configurable:!0}),k.displayName=v(O,g,"GeneratorFunction");function te(t){["next","throw","return"].forEach(function(e){v(t,e,function(r){return this._invoke(e,r)})})}n.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===k||(e.displayName||e.name)==="GeneratorFunction":!1},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,O):(t.__proto__=O,v(t,g,"GeneratorFunction")),t.prototype=Object.create(R),t},n.awrap=function(t){return{__await:t}};function I(t,e){function r(f,m,d,b){var y=U(t[f],t,m);if(y.type==="throw")b(y.arg);else{var q=y.arg,G=q.value;return G&&typeof G=="object"&&i.call(G,"__await")?e.resolve(G.__await).then(function(A){r("next",A,d,b)},function(A){r("throw",A,d,b)}):e.resolve(G).then(function(A){q.value=A,d(q)},function(A){return r("throw",A,d,b)})}}var s;function o(f,m){function d(){return new e(function(b,y){r(f,m,b,y)})}return s=s?s.then(d,d):d()}p(this,"_invoke",{value:o})}te(I.prototype),v(I.prototype,L,function(){return this}),n.AsyncIterator=I,n.async=function(t,e,r,s,o){o===void 0&&(o=Promise);var f=new I(_(t,e,r,s),o);return n.isGeneratorFunction(e)?f:f.next().then(function(m){return m.done?m.value:f.next()})};function Se(t,e,r){var s=Z;return function(f,m){if(s===ee)throw new Error("Generator is already running");if(s===N){if(f==="throw")throw m;return ne()}for(r.method=f,r.arg=m;;){var d=r.delegate;if(d){var b=re(d,r);if(b){if(b===S)continue;return b}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(s===Z)throw s=N,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);s=ee;var y=U(t,e,r);if(y.type==="normal"){if(s=r.done?N:be,y.arg===S)continue;return{value:y.arg,done:r.done}}else y.type==="throw"&&(s=N,r.method="throw",r.arg=y.arg)}}}function re(t,e){var r=e.method,s=t.iterator[r];if(s===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,re(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),S;var o=U(s,t.iterator,e.arg);if(o.type==="throw")return e.method="throw",e.arg=o.arg,e.delegate=null,S;var f=o.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,S;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,S}te(R),v(R,g,"Generator"),v(R,h,function(){return this}),v(R,"toString",function(){return"[object Generator]"});function Ee(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function F(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function J(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(Ee,this),this.reset(!0)}n.keys=function(t){var e=Object(t),r=[];for(var s in e)r.push(s);return r.reverse(),function o(){for(;r.length;){var f=r.pop();if(f in e)return o.value=f,o.done=!1,o}return o.done=!0,o}};function H(t){if(t){var e=t[h];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,s=function o(){for(;++r<t.length;)if(i.call(t,r))return o.value=t[r],o.done=!1,o;return o.value=c,o.done=!0,o};return s.next=s}}return{next:ne}}n.values=H;function ne(){return{value:c,done:!0}}return J.prototype={constructor:J,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(F),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(b,y){return f.type="throw",f.arg=t,e.next=b,y&&(e.method="next",e.arg=c),!!y}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],f=o.completion;if(o.tryLoc==="root")return r("end");if(o.tryLoc<=this.prev){var m=i.call(o,"catchLoc"),d=i.call(o,"finallyLoc");if(m&&d){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(m){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else if(d){if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r];if(s.tryLoc<=this.prev&&i.call(s,"finallyLoc")&&this.prev<s.finallyLoc){var o=s;break}}o&&(t==="break"||t==="continue")&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var f=o?o.completion:{};return f.type=t,f.arg=e,o?(this.method="next",this.next=o.finallyLoc,S):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),S},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),F(r),S}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var s=r.completion;if(s.type==="throw"){var o=s.arg;F(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:H(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),S}},n}(typeof Q=="object"?Q.exports:{});try{regeneratorRuntime=x}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=x:Function("r","regeneratorRuntime = r")(x)}});var l={};Ne(l,{Magic:()=>Te});module.exports=ke(l);var Ue=M(fe()),me=require("@magic-sdk/provider"),De=M(require("process")),de=M(require("localforage")),Y=require("whatwg-url"),B=require("buffer"),ye=M(require("lodash")),ge=require("react-native-device-info"),we=require("@aveq-research/localforage-asyncstorage-driver"),X=M(require("localforage-driver-memory"));var w=M(require("react")),le=require("react-native"),ue=require("react-native-webview"),he=require("react-native-safe-area-context"),W=require("@magic-sdk/provider"),pe=require("lodash");var Pe="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY";function Ie(){return le.StyleSheet.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var C=class extends W.ViewController{constructor(){super(...arguments);this.Relayer=()=>{let[i,p]=(0,w.useState)(!1),c=(0,w.useCallback)(_=>{this.webView=_},[]),E=(0,w.useCallback)(_=>{this.container=ce(se({},_),{showOverlay:h,hideOverlay:L})},[]),h=(0,w.useCallback)(()=>{p(!0)},[]),L=(0,w.useCallback)(()=>{p(!1)},[]),g=(0,w.useMemo)(()=>[this.styles["webview-container"],i?this.styles.show:this.styles.hide],[i]),v=(0,w.useCallback)(_=>{this.handleReactNativeWebViewMessage(_)},[]);return w.default.createElement(he.SafeAreaView,{ref:E,style:g},w.default.createElement(ue.WebView,{ref:c,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:v,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1}))}}init(){this.webView=null,this.container=null,this.styles=Ie()}handleReactNativeWebViewMessage(i){var p;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(E,h)=>{try{if(h&&typeof h=="object"&&h.flag&&h.flag==="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY")return new global[h.constructor](h.data.split(","))}catch(L){}return h});if(c&&c.msgType&&this.messageHandlers.size){c.response=(p=c.response)!=null?p:{};let E={data:c};for(let h of this.messageHandlers.values())h(E)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return T(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(p,c)=>(0,pe.isTypedArray)(c)?{constructor:c.constructor.name,data:c.toString(),flag:Pe}:c),this.endpoint);else throw(0,W.createModalNotReadyError)()})}};var ve=require("@magic-sdk/provider"),j=class extends ve.SDKBase{get Relayer(){return this.overlay.Relayer}};u(l,require("@magic-sdk/commons"),module.exports);global.process=ye.merge(global.process,De);global.process.browser=!1;global.Buffer=B.Buffer;global.URL=Y.URL;global.URLSearchParams=Y.URLSearchParams;global.btoa=n=>B.Buffer.from(n,"binary").toString("base64");global.atob=n=>B.Buffer.from(n,"base64").toString("binary");var Te=(0,me.createSDK)(j,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"14.2.0",bundleId:(0,ge.getBundleId)(),defaultEndpoint:"https://box.magic.link/",ViewController:C,configureStorage:()=>T(void 0,null,function*(){let n=de.default.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),a=(0,we.driverWithoutSerialization)();return yield Promise.all([n.defineDriver(a),n.defineDriver(X)]),yield n.setDriver([a._driver,X._driver]),n})});0&&(module.exports={Magic});
2
2
  //# sourceMappingURL=index.js.map
package/dist/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var fe=Object.create;var U=Object.defineProperty,le=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,he=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var Z=(o,s,i)=>s in o?U(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,te=(o,s)=>{for(var i in s||(s={}))ee.call(s,i)&&Z(o,i,s[i]);if(X)for(var i of X(s))me.call(s,i)&&Z(o,i,s[i]);return o},re=(o,s)=>le(o,he(s));var de=(o,s)=>()=>(s||o((s={exports:{}}).exports,s),s.exports);var ye=(o,s,i,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of pe(s))!ee.call(o,c)&&c!==i&&U(o,c,{get:()=>s[c],enumerable:!(u=ue(s,c))||u.enumerable});return o};var ge=(o,s,i)=>(i=o!=null?fe(ve(o)):{},ye(s||!o||!o.__esModule?U(i,"default",{value:o,enumerable:!0}):i,o));var N=(o,s,i)=>new Promise((u,c)=>{var w=d=>{try{b(i.next(d))}catch(h){c(h)}},l=d=>{try{b(i.throw(d))}catch(h){c(h)}},b=d=>d.done?u(d.value):Promise.resolve(d.value).then(w,l);b((i=i.apply(o,s)).next())});var ne=de((We,K)=>{var $=function(o){"use strict";var s=Object.prototype,i=s.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},c,w=typeof Symbol=="function"?Symbol:{},l=w.iterator||"@@iterator",b=w.asyncIterator||"@@asyncIterator",d=w.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch{h=function(e,r,a){return e[r]=a}}function S(t,e,r,a){var n=e&&e.prototype instanceof D?e:D,f=Object.create(n.prototype),p=new j(a||[]);return u(f,"_invoke",{value:se(t,r,p)}),f}o.wrap=S;function I(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var J="suspendedStart",ae="suspendedYield",H="executing",R="completed",g={};function D(){}function M(){}function E(){}var T={};h(T,l,function(){return this});var C=Object.getPrototypeOf,G=C&&C(C(Y([])));G&&G!==s&&i.call(G,l)&&(T=G);var _=E.prototype=D.prototype=Object.create(T);M.prototype=E,u(_,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:M,configurable:!0}),M.displayName=h(E,d,"GeneratorFunction");function q(t){["next","throw","return"].forEach(function(e){h(t,e,function(r){return this._invoke(e,r)})})}o.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===M||(e.displayName||e.name)==="GeneratorFunction":!1},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,d,"GeneratorFunction")),t.prototype=Object.create(_),t},o.awrap=function(t){return{__await:t}};function V(t,e){function r(f,p,v,y){var m=I(t[f],t,p);if(m.type==="throw")y(m.arg);else{var B=m.arg,O=B.value;return O&&typeof O=="object"&&i.call(O,"__await")?e.resolve(O.__await).then(function(L){r("next",L,v,y)},function(L){r("throw",L,v,y)}):e.resolve(O).then(function(L){B.value=L,v(B)},function(L){return r("throw",L,v,y)})}}var a;function n(f,p){function v(){return new e(function(y,m){r(f,p,y,m)})}return a=a?a.then(v,v):v()}u(this,"_invoke",{value:n})}q(V.prototype),h(V.prototype,b,function(){return this}),o.AsyncIterator=V,o.async=function(t,e,r,a,n){n===void 0&&(n=Promise);var f=new V(S(t,e,r,a),n);return o.isGeneratorFunction(e)?f:f.next().then(function(p){return p.done?p.value:f.next()})};function se(t,e,r){var a=J;return function(f,p){if(a===H)throw new Error("Generator is already running");if(a===R){if(f==="throw")throw p;return Q()}for(r.method=f,r.arg=p;;){var v=r.delegate;if(v){var y=x(v,r);if(y){if(y===g)continue;return y}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===J)throw a=R,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=H;var m=I(t,e,r);if(m.type==="normal"){if(a=r.done?R:ae,m.arg===g)continue;return{value:m.arg,done:r.done}}else m.type==="throw"&&(a=R,r.method="throw",r.arg=m.arg)}}}function x(t,e){var r=e.method,a=t.iterator[r];if(a===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,x(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var n=I(a,t.iterator,e.arg);if(n.type==="throw")return e.method="throw",e.arg=n.arg,e.delegate=null,g;var f=n.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,g}q(_),h(_,d,"Generator"),h(_,l,function(){return this}),h(_,"toString",function(){return"[object Generator]"});function ce(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function W(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(ce,this),this.reset(!0)}o.keys=function(t){var e=Object(t),r=[];for(var a in e)r.push(a);return r.reverse(),function n(){for(;r.length;){var f=r.pop();if(f in e)return n.value=f,n.done=!1,n}return n.done=!0,n}};function Y(t){if(t){var e=t[l];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=c,n.done=!0,n};return a.next=a}}return{next:Q}}o.values=Y;function Q(){return{value:c,done:!0}}return j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(W),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(y,m){return f.type="throw",f.arg=t,e.next=y,m&&(e.method="next",e.arg=c),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var n=this.tryEntries[a],f=n.completion;if(n.tryLoc==="root")return r("end");if(n.tryLoc<=this.prev){var p=i.call(n,"catchLoc"),v=i.call(n,"finallyLoc");if(p&&v){if(this.prev<n.catchLoc)return r(n.catchLoc,!0);if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else if(p){if(this.prev<n.catchLoc)return r(n.catchLoc,!0)}else if(v){if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&i.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var n=a;break}}n&&(t==="break"||t==="continue")&&n.tryLoc<=e&&e<=n.finallyLoc&&(n=null);var f=n?n.completion:{};return f.type=t,f.arg=e,n?(this.method="next",this.next=n.finallyLoc,g):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),W(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var a=r.completion;if(a.type==="throw"){var n=a.arg;W(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:Y(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),g}},o}(typeof K=="object"?K.exports:{});try{regeneratorRuntime=$}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=$:Function("r","regeneratorRuntime = r")($)}});var qe=ge(ne());import{createSDK as Ve}from"@magic-sdk/provider";import*as Ne from"process";import ke from"localforage";import{URL as Pe,URLSearchParams as Ie}from"whatwg-url";import{Buffer as z}from"buffer";import*as ie from"lodash";import{getBundleId as De}from"react-native-device-info";import{driverWithoutSerialization as Te}from"@aveq-research/localforage-asyncstorage-driver";import*as F from"localforage-driver-memory";import oe,{useState as we,useCallback as A,useMemo as be}from"react";import{StyleSheet as Se}from"react-native";import{WebView as Ee}from"react-native-webview";import{SafeAreaView as Le}from"react-native-safe-area-context";import{ViewController as _e,createModalNotReadyError as Oe}from"@magic-sdk/provider";import{isTypedArray as Ae}from"lodash";var Re="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY";function Me(){return Se.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var k=class extends _e{constructor(){super(...arguments);this.Relayer=()=>{let[i,u]=we(!1),c=A(S=>{this.webView=S},[]),w=A(S=>{this.container=re(te({},S),{showOverlay:l,hideOverlay:b})},[]),l=A(()=>{u(!0)},[]),b=A(()=>{u(!1)},[]),d=be(()=>[this.styles["webview-container"],i?this.styles.show:this.styles.hide],[i]),h=A(S=>{this.handleReactNativeWebViewMessage(S)},[]);return oe.createElement(Le,{ref:w,style:d},oe.createElement(Ee,{ref:c,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:h,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1}))}}init(){this.webView=null,this.container=null,this.styles=Me()}handleReactNativeWebViewMessage(i){var u;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(w,l)=>{try{if(l&&typeof l=="object"&&l.flag&&l.flag==="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY")return new global[l.constructor](l.data.split(","))}catch(b){}return l});if(c&&c.msgType&&this.messageHandlers.size){c.response=(u=c.response)!=null?u:{};let w={data:c};for(let l of this.messageHandlers.values())l(w)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return N(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(u,c)=>Ae(c)?{constructor:c.constructor.name,data:c.toString(),flag:Re}:c),this.endpoint);else throw Oe()})}};import{SDKBase as Ge}from"@magic-sdk/provider";var P=class extends Ge{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=ie.merge(global.process,Ne);global.process.browser=!1;global.Buffer=z;global.URL=Pe;global.URLSearchParams=Ie;global.btoa=o=>z.from(o,"binary").toString("base64");global.atob=o=>z.from(o,"base64").toString("binary");var at=Ve(P,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"14.0.0",bundleId:De(),defaultEndpoint:"https://box.magic.link/",ViewController:k,configureStorage:()=>N(void 0,null,function*(){let o=ke.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=Te();return yield Promise.all([o.defineDriver(s),o.defineDriver(F)]),yield o.setDriver([s._driver,F._driver]),o})});export{at as Magic};
1
+ var fe=Object.create;var U=Object.defineProperty,le=Object.defineProperties,ue=Object.getOwnPropertyDescriptor,he=Object.getOwnPropertyDescriptors,pe=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty,me=Object.prototype.propertyIsEnumerable;var Z=(o,s,i)=>s in o?U(o,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[s]=i,te=(o,s)=>{for(var i in s||(s={}))ee.call(s,i)&&Z(o,i,s[i]);if(X)for(var i of X(s))me.call(s,i)&&Z(o,i,s[i]);return o},re=(o,s)=>le(o,he(s));var de=(o,s)=>()=>(s||o((s={exports:{}}).exports,s),s.exports);var ye=(o,s,i,u)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of pe(s))!ee.call(o,c)&&c!==i&&U(o,c,{get:()=>s[c],enumerable:!(u=ue(s,c))||u.enumerable});return o};var ge=(o,s,i)=>(i=o!=null?fe(ve(o)):{},ye(s||!o||!o.__esModule?U(i,"default",{value:o,enumerable:!0}):i,o));var N=(o,s,i)=>new Promise((u,c)=>{var w=d=>{try{b(i.next(d))}catch(h){c(h)}},l=d=>{try{b(i.throw(d))}catch(h){c(h)}},b=d=>d.done?u(d.value):Promise.resolve(d.value).then(w,l);b((i=i.apply(o,s)).next())});var ne=de((We,K)=>{var $=function(o){"use strict";var s=Object.prototype,i=s.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},c,w=typeof Symbol=="function"?Symbol:{},l=w.iterator||"@@iterator",b=w.asyncIterator||"@@asyncIterator",d=w.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch{h=function(e,r,a){return e[r]=a}}function S(t,e,r,a){var n=e&&e.prototype instanceof D?e:D,f=Object.create(n.prototype),p=new j(a||[]);return u(f,"_invoke",{value:se(t,r,p)}),f}o.wrap=S;function I(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(a){return{type:"throw",arg:a}}}var J="suspendedStart",ae="suspendedYield",H="executing",R="completed",g={};function D(){}function M(){}function E(){}var T={};h(T,l,function(){return this});var C=Object.getPrototypeOf,G=C&&C(C(Y([])));G&&G!==s&&i.call(G,l)&&(T=G);var _=E.prototype=D.prototype=Object.create(T);M.prototype=E,u(_,"constructor",{value:E,configurable:!0}),u(E,"constructor",{value:M,configurable:!0}),M.displayName=h(E,d,"GeneratorFunction");function q(t){["next","throw","return"].forEach(function(e){h(t,e,function(r){return this._invoke(e,r)})})}o.isGeneratorFunction=function(t){var e=typeof t=="function"&&t.constructor;return e?e===M||(e.displayName||e.name)==="GeneratorFunction":!1},o.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,h(t,d,"GeneratorFunction")),t.prototype=Object.create(_),t},o.awrap=function(t){return{__await:t}};function V(t,e){function r(f,p,v,y){var m=I(t[f],t,p);if(m.type==="throw")y(m.arg);else{var B=m.arg,O=B.value;return O&&typeof O=="object"&&i.call(O,"__await")?e.resolve(O.__await).then(function(L){r("next",L,v,y)},function(L){r("throw",L,v,y)}):e.resolve(O).then(function(L){B.value=L,v(B)},function(L){return r("throw",L,v,y)})}}var a;function n(f,p){function v(){return new e(function(y,m){r(f,p,y,m)})}return a=a?a.then(v,v):v()}u(this,"_invoke",{value:n})}q(V.prototype),h(V.prototype,b,function(){return this}),o.AsyncIterator=V,o.async=function(t,e,r,a,n){n===void 0&&(n=Promise);var f=new V(S(t,e,r,a),n);return o.isGeneratorFunction(e)?f:f.next().then(function(p){return p.done?p.value:f.next()})};function se(t,e,r){var a=J;return function(f,p){if(a===H)throw new Error("Generator is already running");if(a===R){if(f==="throw")throw p;return Q()}for(r.method=f,r.arg=p;;){var v=r.delegate;if(v){var y=x(v,r);if(y){if(y===g)continue;return y}}if(r.method==="next")r.sent=r._sent=r.arg;else if(r.method==="throw"){if(a===J)throw a=R,r.arg;r.dispatchException(r.arg)}else r.method==="return"&&r.abrupt("return",r.arg);a=H;var m=I(t,e,r);if(m.type==="normal"){if(a=r.done?R:ae,m.arg===g)continue;return{value:m.arg,done:r.done}}else m.type==="throw"&&(a=R,r.method="throw",r.arg=m.arg)}}}function x(t,e){var r=e.method,a=t.iterator[r];if(a===c)return e.delegate=null,r==="throw"&&t.iterator.return&&(e.method="return",e.arg=c,x(t,e),e.method==="throw")||r!=="return"&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var n=I(a,t.iterator,e.arg);if(n.type==="throw")return e.method="throw",e.arg=n.arg,e.delegate=null,g;var f=n.arg;if(!f)return e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g;if(f.done)e[t.resultName]=f.value,e.next=t.nextLoc,e.method!=="return"&&(e.method="next",e.arg=c);else return f;return e.delegate=null,g}q(_),h(_,d,"Generator"),h(_,l,function(){return this}),h(_,"toString",function(){return"[object Generator]"});function ce(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function W(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(ce,this),this.reset(!0)}o.keys=function(t){var e=Object(t),r=[];for(var a in e)r.push(a);return r.reverse(),function n(){for(;r.length;){var f=r.pop();if(f in e)return n.value=f,n.done=!1,n}return n.done=!0,n}};function Y(t){if(t){var e=t[l];if(e)return e.call(t);if(typeof t.next=="function")return t;if(!isNaN(t.length)){var r=-1,a=function n(){for(;++r<t.length;)if(i.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=c,n.done=!0,n};return a.next=a}}return{next:Q}}o.values=Y;function Q(){return{value:c,done:!0}}return j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=c,this.done=!1,this.delegate=null,this.method="next",this.arg=c,this.tryEntries.forEach(W),!t)for(var e in this)e.charAt(0)==="t"&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=c)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if(e.type==="throw")throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(y,m){return f.type="throw",f.arg=t,e.next=y,m&&(e.method="next",e.arg=c),!!m}for(var a=this.tryEntries.length-1;a>=0;--a){var n=this.tryEntries[a],f=n.completion;if(n.tryLoc==="root")return r("end");if(n.tryLoc<=this.prev){var p=i.call(n,"catchLoc"),v=i.call(n,"finallyLoc");if(p&&v){if(this.prev<n.catchLoc)return r(n.catchLoc,!0);if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else if(p){if(this.prev<n.catchLoc)return r(n.catchLoc,!0)}else if(v){if(this.prev<n.finallyLoc)return r(n.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&i.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var n=a;break}}n&&(t==="break"||t==="continue")&&n.tryLoc<=e&&e<=n.finallyLoc&&(n=null);var f=n?n.completion:{};return f.type=t,f.arg=e,n?(this.method="next",this.next=n.finallyLoc,g):this.complete(f)},complete:function(t,e){if(t.type==="throw")throw t.arg;return t.type==="break"||t.type==="continue"?this.next=t.arg:t.type==="return"?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):t.type==="normal"&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),W(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var a=r.completion;if(a.type==="throw"){var n=a.arg;W(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:Y(t),resultName:e,nextLoc:r},this.method==="next"&&(this.arg=c),g}},o}(typeof K=="object"?K.exports:{});try{regeneratorRuntime=$}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=$:Function("r","regeneratorRuntime = r")($)}});var qe=ge(ne());import{createSDK as Ve}from"@magic-sdk/provider";import*as Ne from"process";import ke from"localforage";import{URL as Pe,URLSearchParams as Ie}from"whatwg-url";import{Buffer as z}from"buffer";import*as ie from"lodash";import{getBundleId as De}from"react-native-device-info";import{driverWithoutSerialization as Te}from"@aveq-research/localforage-asyncstorage-driver";import*as F from"localforage-driver-memory";import oe,{useState as we,useCallback as A,useMemo as be}from"react";import{StyleSheet as Se}from"react-native";import{WebView as Ee}from"react-native-webview";import{SafeAreaView as Le}from"react-native-safe-area-context";import{ViewController as _e,createModalNotReadyError as Oe}from"@magic-sdk/provider";import{isTypedArray as Ae}from"lodash";var Re="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY";function Me(){return Se.create({"magic-webview":{flex:1,backgroundColor:"transparent"},"webview-container":{flex:1,width:"100%",backgroundColor:"transparent",position:"absolute",top:0,left:0,right:0,bottom:0},show:{zIndex:1e4,elevation:1e4},hide:{zIndex:-1e4,elevation:0}})}var k=class extends _e{constructor(){super(...arguments);this.Relayer=()=>{let[i,u]=we(!1),c=A(S=>{this.webView=S},[]),w=A(S=>{this.container=re(te({},S),{showOverlay:l,hideOverlay:b})},[]),l=A(()=>{u(!0)},[]),b=A(()=>{u(!1)},[]),d=be(()=>[this.styles["webview-container"],i?this.styles.show:this.styles.hide],[i]),h=A(S=>{this.handleReactNativeWebViewMessage(S)},[]);return oe.createElement(Le,{ref:w,style:d},oe.createElement(Ee,{ref:c,source:{uri:`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`},onMessage:h,style:this.styles["magic-webview"],autoManageStatusBarEnabled:!1}))}}init(){this.webView=null,this.container=null,this.styles=Me()}handleReactNativeWebViewMessage(i){var u;if(i.nativeEvent&&typeof i.nativeEvent.data=="string"&&(i.nativeEvent.url===`${this.endpoint}/send/?params=${encodeURIComponent(this.parameters)}`||i.nativeEvent.url===`${this.endpoint}/send/?params=${this.parameters}`)){let c=JSON.parse(i.nativeEvent.data,(w,l)=>{try{if(l&&typeof l=="object"&&l.flag&&l.flag==="MAGIC_PAYLOAD_FLAG_TYPED_ARRAY")return new global[l.constructor](l.data.split(","))}catch(b){}return l});if(c&&c.msgType&&this.messageHandlers.size){c.response=(u=c.response)!=null?u:{};let w={data:c};for(let l of this.messageHandlers.values())l(w)}}}hideOverlay(){this.container&&this.container.hideOverlay()}showOverlay(){this.container&&this.container.showOverlay()}_post(i){return N(this,null,function*(){if(this.webView&&this.webView.postMessage)this.webView.postMessage(JSON.stringify(i,(u,c)=>Ae(c)?{constructor:c.constructor.name,data:c.toString(),flag:Re}:c),this.endpoint);else throw Oe()})}};import{SDKBase as Ge}from"@magic-sdk/provider";var P=class extends Ge{get Relayer(){return this.overlay.Relayer}};export*from"@magic-sdk/commons";global.process=ie.merge(global.process,Ne);global.process.browser=!1;global.Buffer=z;global.URL=Pe;global.URLSearchParams=Ie;global.btoa=o=>z.from(o,"binary").toString("base64");global.atob=o=>z.from(o,"base64").toString("binary");var at=Ve(P,{platform:"react-native",sdkName:"@magic-sdk/react-native-bare",version:"14.2.0",bundleId:De(),defaultEndpoint:"https://box.magic.link/",ViewController:k,configureStorage:()=>N(void 0,null,function*(){let o=ke.createInstance({name:"MagicAuthLocalStorageDB",storeName:"MagicAuthLocalStorage"}),s=Te();return yield Promise.all([o.defineDriver(s),o.defineDriver(F)]),yield o.setDriver([s._driver,F._driver]),o})});export{at as Magic};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic-sdk/react-native-bare",
3
- "version": "14.0.1-903c2bf",
3
+ "version": "14.2.0",
4
4
  "description": "Passwordless authentication for React Native (Bare).",
5
5
  "author": "Magic Labs <team@magic.link> (https://magic.link/)",
6
6
  "license": "MIT",
@@ -18,9 +18,9 @@
18
18
  "types": "./dist/types/index.d.ts",
19
19
  "dependencies": {
20
20
  "@aveq-research/localforage-asyncstorage-driver": "^3.0.1",
21
- "@magic-sdk/commons": "^9.1.0",
22
- "@magic-sdk/provider": "^13.1.0",
23
- "@magic-sdk/types": "^11.1.0",
21
+ "@magic-sdk/commons": "^9.2.0",
22
+ "@magic-sdk/provider": "^13.2.0",
23
+ "@magic-sdk/types": "^11.2.0",
24
24
  "@react-native-async-storage/async-storage": "^1.15.5",
25
25
  "@types/lodash": "^4.14.158",
26
26
  "buffer": "~5.6.0",
@@ -50,7 +50,7 @@
50
50
  "react-native": ">=0.60",
51
51
  "react-native-device-info": ">=10.3.0",
52
52
  "react-native-safe-area-context": ">=4.4.1",
53
- "react-native-webview": ">=8"
53
+ "react-native-webview": ">=11.0.0"
54
54
  },
55
- "gitHead": "1ef062ea699d48d5e9a9375a93b7c147632b05ca"
55
+ "gitHead": "1c4c72cf1354c6177c3764144bd121a051a2f0c1"
56
56
  }