@magic-sdk/react-native-bare 18.1.1 → 18.1.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/CHANGELOG.md +12 -0
- package/LICENSE +176 -21
- package/dist/cjs/index.js +1 -1
- package/dist/es/index.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
# v18.1.2 (Tue Apr 25 2023)
|
2
|
+
|
3
|
+
#### 🐛 Bug Fix
|
4
|
+
|
5
|
+
- update MIT license to apache [#500](https://github.com/magiclabs/magic-js/pull/500) ([@Dizigen](https://github.com/Dizigen))
|
6
|
+
|
7
|
+
#### Authors: 1
|
8
|
+
|
9
|
+
- David He ([@Dizigen](https://github.com/Dizigen))
|
10
|
+
|
11
|
+
---
|
12
|
+
|
1
13
|
# v18.1.1 (Fri Apr 21 2023)
|
2
14
|
|
3
15
|
#### 🐛 Bug Fix
|
package/LICENSE
CHANGED
@@ -1,21 +1,176 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
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:"18.1.1",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:"18.1.2",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:"18.1.1",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:"18.1.2",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": "18.1.
|
3
|
+
"version": "18.1.2",
|
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": "^13.1.
|
22
|
-
"@magic-sdk/provider": "^17.1.
|
23
|
-
"@magic-sdk/types": "^15.1.
|
21
|
+
"@magic-sdk/commons": "^13.1.2",
|
22
|
+
"@magic-sdk/provider": "^17.1.2",
|
23
|
+
"@magic-sdk/types": "^15.1.2",
|
24
24
|
"@react-native-async-storage/async-storage": "^1.15.5",
|
25
25
|
"@types/lodash": "^4.14.158",
|
26
26
|
"buffer": "~5.6.0",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"react-native-safe-area-context": ">=4.4.1",
|
53
53
|
"react-native-webview": ">=11.0.0"
|
54
54
|
},
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "1609b16b343c0567328982fb57091dbe3b7e43c2"
|
56
56
|
}
|