@paywithglide/glide-react 0.0.43 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/glide.js +44 -39
- package/dist/walletProviderBridge.d.ts +3 -0
- package/package.json +3 -3
package/dist/glide.js
CHANGED
|
@@ -158,8 +158,11 @@ function he(s, t = {}) {
|
|
|
158
158
|
const e = le.encode(s);
|
|
159
159
|
return X(e, t);
|
|
160
160
|
}
|
|
161
|
-
let K = !1;
|
|
162
161
|
function ue(s) {
|
|
162
|
+
return s instanceof Error;
|
|
163
|
+
}
|
|
164
|
+
let K = !1;
|
|
165
|
+
function me(s) {
|
|
163
166
|
if (K)
|
|
164
167
|
return;
|
|
165
168
|
K = !0;
|
|
@@ -209,10 +212,12 @@ function ue(s) {
|
|
|
209
212
|
});
|
|
210
213
|
i.delete(n), r(n, { result: u });
|
|
211
214
|
} catch (u) {
|
|
212
|
-
i.delete(n), r(n, {
|
|
215
|
+
i.delete(n), ue(u) ? r(n, {
|
|
213
216
|
error: u.message || String(u),
|
|
214
217
|
code: u.code,
|
|
215
218
|
data: u.data
|
|
219
|
+
}) : r(n, {
|
|
220
|
+
error: String(u)
|
|
216
221
|
});
|
|
217
222
|
}
|
|
218
223
|
break;
|
|
@@ -283,7 +288,7 @@ class H {
|
|
|
283
288
|
}
|
|
284
289
|
});
|
|
285
290
|
j(this, "iframeEventHandler", async (t) => {
|
|
286
|
-
var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w,
|
|
291
|
+
var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w, S, v, x, E, U, M, C, k, P, D, T, R, B, W, A;
|
|
287
292
|
const e = t.data;
|
|
288
293
|
switch (e.type) {
|
|
289
294
|
case "sendInit": {
|
|
@@ -386,7 +391,7 @@ class H {
|
|
|
386
391
|
this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
|
|
387
392
|
break;
|
|
388
393
|
case "setMode":
|
|
389
|
-
(
|
|
394
|
+
(S = (w = this.opts) == null ? void 0 : w.onSetMode) == null || S.call(w, e.mode);
|
|
390
395
|
break;
|
|
391
396
|
case "switchChain":
|
|
392
397
|
if (!this.opts.walletProvider)
|
|
@@ -394,7 +399,7 @@ class H {
|
|
|
394
399
|
try {
|
|
395
400
|
await this.opts.walletProvider.switchChainAsync({
|
|
396
401
|
chainId: e.chainId
|
|
397
|
-
}), (
|
|
402
|
+
}), (x = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || x.postMessage(
|
|
398
403
|
{
|
|
399
404
|
type: "didSwitchChain",
|
|
400
405
|
success: !0,
|
|
@@ -493,7 +498,7 @@ class H {
|
|
|
493
498
|
initialize() {
|
|
494
499
|
window.addEventListener("message", this.iframeEventHandler);
|
|
495
500
|
const t = new URL(this.baseUrl).origin;
|
|
496
|
-
|
|
501
|
+
me(t);
|
|
497
502
|
}
|
|
498
503
|
destroy() {
|
|
499
504
|
window.removeEventListener("message", this.iframeEventHandler);
|
|
@@ -537,7 +542,7 @@ class H {
|
|
|
537
542
|
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
|
-
const
|
|
545
|
+
const ye = ({
|
|
541
546
|
app: s,
|
|
542
547
|
recipient: t,
|
|
543
548
|
chainId: e,
|
|
@@ -559,9 +564,9 @@ const fe = ({
|
|
|
559
564
|
showOnrampFirst: y,
|
|
560
565
|
debitCardAlias: I,
|
|
561
566
|
copyOverrides: w,
|
|
562
|
-
stableDepositAddressKey:
|
|
567
|
+
stableDepositAddressKey: S,
|
|
563
568
|
sessionId: v,
|
|
564
|
-
sessionMetadata:
|
|
569
|
+
sessionMetadata: x,
|
|
565
570
|
disableWithdrawToSelfSuggestion: E,
|
|
566
571
|
theme: U,
|
|
567
572
|
walletProvider: M,
|
|
@@ -596,9 +601,9 @@ const fe = ({
|
|
|
596
601
|
showOnrampFirst: y,
|
|
597
602
|
debitCardAlias: I,
|
|
598
603
|
copyOverrides: w,
|
|
599
|
-
stableDepositAddressKey:
|
|
604
|
+
stableDepositAddressKey: S,
|
|
600
605
|
sessionId: v,
|
|
601
|
-
sessionMetadata:
|
|
606
|
+
sessionMetadata: x,
|
|
602
607
|
disableWithdrawToSelfSuggestion: E,
|
|
603
608
|
theme: U,
|
|
604
609
|
walletProvider: M,
|
|
@@ -632,9 +637,9 @@ const fe = ({
|
|
|
632
637
|
y,
|
|
633
638
|
I,
|
|
634
639
|
w,
|
|
635
|
-
x,
|
|
636
|
-
v,
|
|
637
640
|
S,
|
|
641
|
+
v,
|
|
642
|
+
x,
|
|
638
643
|
E,
|
|
639
644
|
U,
|
|
640
645
|
M,
|
|
@@ -652,7 +657,7 @@ const fe = ({
|
|
|
652
657
|
externalUrl: A.externalUrl,
|
|
653
658
|
opts: A.opts
|
|
654
659
|
};
|
|
655
|
-
},
|
|
660
|
+
}, we = ({
|
|
656
661
|
app: s,
|
|
657
662
|
preferGaslessPayment: t,
|
|
658
663
|
chainIds: e,
|
|
@@ -674,9 +679,9 @@ const fe = ({
|
|
|
674
679
|
sessionMetadata: y,
|
|
675
680
|
theme: I,
|
|
676
681
|
walletProvider: w,
|
|
677
|
-
localStorageProvider:
|
|
682
|
+
localStorageProvider: S,
|
|
678
683
|
onOpen: v,
|
|
679
|
-
onSuccess:
|
|
684
|
+
onSuccess: x,
|
|
680
685
|
onClose: E,
|
|
681
686
|
autoCloseOnSuccess: U,
|
|
682
687
|
popupsBlocked: M,
|
|
@@ -706,9 +711,9 @@ const fe = ({
|
|
|
706
711
|
sessionMetadata: y,
|
|
707
712
|
theme: I,
|
|
708
713
|
walletProvider: w,
|
|
709
|
-
localStorageProvider:
|
|
714
|
+
localStorageProvider: S,
|
|
710
715
|
onOpen: v,
|
|
711
|
-
onSuccess:
|
|
716
|
+
onSuccess: x,
|
|
712
717
|
onClose: E,
|
|
713
718
|
autoCloseOnSuccess: U,
|
|
714
719
|
popupsBlocked: M,
|
|
@@ -736,9 +741,9 @@ const fe = ({
|
|
|
736
741
|
y,
|
|
737
742
|
I,
|
|
738
743
|
w,
|
|
739
|
-
x,
|
|
740
|
-
v,
|
|
741
744
|
S,
|
|
745
|
+
v,
|
|
746
|
+
x,
|
|
742
747
|
E,
|
|
743
748
|
U,
|
|
744
749
|
M,
|
|
@@ -750,7 +755,7 @@ const fe = ({
|
|
|
750
755
|
externalUrl: P.externalUrl,
|
|
751
756
|
opts: P.opts
|
|
752
757
|
};
|
|
753
|
-
},
|
|
758
|
+
}, ve = ({
|
|
754
759
|
app: s,
|
|
755
760
|
evm: t,
|
|
756
761
|
approval: e,
|
|
@@ -772,10 +777,10 @@ const fe = ({
|
|
|
772
777
|
onClose: y,
|
|
773
778
|
autoCloseOnSuccess: I,
|
|
774
779
|
popupsBlocked: w,
|
|
775
|
-
baseUrl:
|
|
780
|
+
baseUrl: S,
|
|
776
781
|
debug: v
|
|
777
782
|
}) => {
|
|
778
|
-
const
|
|
783
|
+
const x = G(() => new H({
|
|
779
784
|
app: s,
|
|
780
785
|
evm: t,
|
|
781
786
|
approval: e,
|
|
@@ -798,7 +803,7 @@ const fe = ({
|
|
|
798
803
|
onClose: y,
|
|
799
804
|
autoCloseOnSuccess: I,
|
|
800
805
|
popupsBlocked: w,
|
|
801
|
-
baseUrl:
|
|
806
|
+
baseUrl: S,
|
|
802
807
|
debug: v
|
|
803
808
|
}), [
|
|
804
809
|
s,
|
|
@@ -822,15 +827,15 @@ const fe = ({
|
|
|
822
827
|
y,
|
|
823
828
|
I,
|
|
824
829
|
w,
|
|
825
|
-
|
|
830
|
+
S,
|
|
826
831
|
v
|
|
827
832
|
]);
|
|
828
833
|
return {
|
|
829
|
-
openGlideCall:
|
|
830
|
-
externalUrl:
|
|
831
|
-
opts:
|
|
834
|
+
openGlideCall: x.open,
|
|
835
|
+
externalUrl: x.externalUrl,
|
|
836
|
+
opts: x.opts
|
|
832
837
|
};
|
|
833
|
-
},
|
|
838
|
+
}, be = ({
|
|
834
839
|
app: s,
|
|
835
840
|
recipient: t,
|
|
836
841
|
chainId: e,
|
|
@@ -852,7 +857,7 @@ const fe = ({
|
|
|
852
857
|
onSuccess: y,
|
|
853
858
|
onClose: I,
|
|
854
859
|
autoCloseOnSuccess: w,
|
|
855
|
-
baseUrl:
|
|
860
|
+
baseUrl: S
|
|
856
861
|
}) => {
|
|
857
862
|
const v = G(() => new H({
|
|
858
863
|
app: s,
|
|
@@ -877,7 +882,7 @@ const fe = ({
|
|
|
877
882
|
onSuccess: y,
|
|
878
883
|
onClose: I,
|
|
879
884
|
autoCloseOnSuccess: w,
|
|
880
|
-
baseUrl:
|
|
885
|
+
baseUrl: S
|
|
881
886
|
}), [
|
|
882
887
|
s,
|
|
883
888
|
t,
|
|
@@ -900,14 +905,14 @@ const fe = ({
|
|
|
900
905
|
y,
|
|
901
906
|
I,
|
|
902
907
|
w,
|
|
903
|
-
|
|
908
|
+
S
|
|
904
909
|
]);
|
|
905
910
|
return {
|
|
906
911
|
openGlideBuy: v.open,
|
|
907
912
|
externalUrl: v.externalUrl,
|
|
908
913
|
opts: v.opts
|
|
909
914
|
};
|
|
910
|
-
},
|
|
915
|
+
}, $e = Object.freeze({
|
|
911
916
|
getItem: (s) => new Promise((t, e) => {
|
|
912
917
|
try {
|
|
913
918
|
const i = localStorage.getItem(s);
|
|
@@ -941,10 +946,10 @@ const fe = ({
|
|
|
941
946
|
});
|
|
942
947
|
export {
|
|
943
948
|
H as GlideDeposit,
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
949
|
+
$e as browserLocalStorageProvider,
|
|
950
|
+
me as initializeParentBridge,
|
|
951
|
+
be as useGlideBuy,
|
|
952
|
+
ve as useGlideCall,
|
|
953
|
+
ye as useGlideDeposit,
|
|
954
|
+
we as useGlidePay
|
|
950
955
|
};
|
|
@@ -14,6 +14,9 @@ export interface EIP1193Provider {
|
|
|
14
14
|
}): Promise<unknown>;
|
|
15
15
|
on?(event: string, listener: (...args: unknown[]) => void): void;
|
|
16
16
|
removeListener?(event: string, listener: (...args: unknown[]) => void): void;
|
|
17
|
+
isConnected?: boolean;
|
|
18
|
+
chainId?: string;
|
|
19
|
+
selectedAddress?: string;
|
|
17
20
|
}
|
|
18
21
|
export interface EIP6963ProviderInfo {
|
|
19
22
|
uuid: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paywithglide/glide-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"sideEffects": false,
|
|
18
18
|
"scripts": {
|
|
19
19
|
"dev": "vite",
|
|
20
|
-
"build": "
|
|
20
|
+
"build": "bun run lint && vite build",
|
|
21
21
|
"build-web": "tsc --p ./tsconfig.build.json && vite build --mode web",
|
|
22
22
|
"build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background",
|
|
23
23
|
"lint": "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json",
|
|
24
24
|
"preview": "vite preview",
|
|
25
|
-
"prepublishOnly": "
|
|
25
|
+
"prepublishOnly": "bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@paywithglide/glide-js": "0.13.10"
|