@heliofi/deposit-react 0.2.1 → 0.2.3
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.
|
@@ -1,28 +1,55 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
readonly SOL: true;
|
|
4
|
+
readonly ETH: true;
|
|
5
|
+
readonly BASE: true;
|
|
6
|
+
readonly POLYGON: true;
|
|
7
|
+
readonly ARBITRUM: true;
|
|
8
|
+
readonly BSC: true;
|
|
9
|
+
readonly ABSTRACT: true;
|
|
10
|
+
readonly HYPERLIQUID: true;
|
|
11
|
+
readonly PLASMA: false;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
wallet: DepositConnectWallet;
|
|
15
|
+
blockchain: SupportedBlockchain;
|
|
16
|
+
address: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
METAMASK = "METAMASK",
|
|
20
|
+
PHANTOM = "PHANTOM",
|
|
21
|
+
TRUST_WALLET = "TRUST_WALLET",
|
|
22
|
+
WALLET_CONNECT = "WALLET_CONNECT"
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
3
26
|
|
|
4
27
|
|
|
5
28
|
|
|
6
29
|
|
|
7
30
|
export declare const MoonpayCommerceDeposit: (props: MoonpayCommerceDepositReactProps) => JSX.Element | null;
|
|
8
31
|
|
|
32
|
+
currentlyConnectedWallet?: ConnectWalletSelection;
|
|
33
|
+
debug?: boolean;
|
|
9
34
|
depositCustomerToken: string;
|
|
10
|
-
|
|
35
|
+
display?: DepositDisplay;
|
|
36
|
+
forcedStep?: DepositForcedStep;
|
|
37
|
+
loadingText?: React.ReactNode;
|
|
38
|
+
network?: DepositNetwork;
|
|
11
39
|
onError?: (error: {
|
|
12
40
|
message: string;
|
|
13
41
|
}) => void;
|
|
14
|
-
|
|
15
|
-
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
openWalletConnectInNewTab?: boolean;
|
|
16
44
|
themeMode?: DepositThemeMode;
|
|
17
45
|
variant?: DepositVariant;
|
|
18
|
-
loadingText?: React.ReactNode;
|
|
19
|
-
trigger?: (props: {
|
|
20
|
-
onClick: () => void;
|
|
21
|
-
}) => React.ReactNode;
|
|
22
|
-
debug?: boolean;
|
|
23
46
|
}
|
|
24
47
|
|
|
25
48
|
config: MoonpayCommerceDepositConfig;
|
|
49
|
+
trigger?: React.ComponentType<{
|
|
50
|
+
onClick: () => void;
|
|
51
|
+
}>;
|
|
26
52
|
}
|
|
53
|
+
|
|
27
54
|
|
|
28
55
|
export { }
|
|
@@ -1,56 +1,70 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as E, jsx as i, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as u, useEffect as p, useLayoutEffect as I } from "react";
|
|
3
|
+
const R = "v1", b = () => {
|
|
4
4
|
try {
|
|
5
5
|
return process.env.VITE_PROD_HOSTNAME || "embed.deposits.hel.io";
|
|
6
6
|
} catch {
|
|
7
7
|
return "embed.deposits.hel.io";
|
|
8
8
|
}
|
|
9
|
-
},
|
|
9
|
+
}, M = b(), g = "deposit-embed-script", O = `https://${M}/assets/index-${R}.js`, _ = ({ children: e }) => /* @__PURE__ */ E("div", { children: [
|
|
10
10
|
"Error loading Helio Deposit for React",
|
|
11
|
-
|
|
12
|
-
] }),
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
if (
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
24
|
-
|
|
11
|
+
e ? `: ${e}` : ""
|
|
12
|
+
] }), h = (e = O) => {
|
|
13
|
+
const t = document.createElement("script");
|
|
14
|
+
return t.setAttribute("type", "module"), t.setAttribute("id", g), t.setAttribute("src", e), document.body.appendChild(t), t;
|
|
15
|
+
}, T = (e) => {
|
|
16
|
+
const t = C(null), [d, D] = u(!1), [r, v] = u(), [m, s] = u("");
|
|
17
|
+
if (p(() => D(!0), []), p(() => {
|
|
18
|
+
let o = !1;
|
|
19
|
+
if (r) return;
|
|
20
|
+
const c = () => {
|
|
21
|
+
if (o) return;
|
|
22
|
+
const n = window.moonpayCommerceDeposit;
|
|
23
|
+
if (!n) {
|
|
24
|
+
s(
|
|
25
25
|
"Unable to load Helio Deposit - missing init function on window.moonpayCommerceDeposit"
|
|
26
26
|
);
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
|
-
v(() =>
|
|
30
|
-
},
|
|
31
|
-
const
|
|
32
|
-
return
|
|
33
|
-
|
|
29
|
+
v(() => n);
|
|
30
|
+
}, a = (n) => {
|
|
31
|
+
const l = () => s("Error loading script tag");
|
|
32
|
+
return n.addEventListener("load", c), n.addEventListener("error", l), () => {
|
|
33
|
+
o = !0, n.removeEventListener("load", c), n.removeEventListener("error", l);
|
|
34
34
|
};
|
|
35
|
-
},
|
|
36
|
-
`script#${
|
|
35
|
+
}, f = document.querySelector(
|
|
36
|
+
`script#${g}`
|
|
37
37
|
);
|
|
38
|
-
if (
|
|
39
|
-
window.moonpayCommerceDeposit ?
|
|
38
|
+
if (f) {
|
|
39
|
+
window.moonpayCommerceDeposit ? c() : a(f);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
const S =
|
|
43
|
-
return
|
|
44
|
-
}, [
|
|
45
|
-
if (!(!
|
|
46
|
-
if (!
|
|
47
|
-
|
|
42
|
+
const S = h();
|
|
43
|
+
return a(S);
|
|
44
|
+
}, [r]), I(() => {
|
|
45
|
+
if (!(!r || !d)) {
|
|
46
|
+
if (!t.current) {
|
|
47
|
+
s("Missing element to mount Helio Deposit");
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
e.trigger || r(t.current, e.config);
|
|
51
51
|
}
|
|
52
|
-
}, [
|
|
52
|
+
}, [r, d, e.config, e.trigger]), m) return /* @__PURE__ */ i(_, { children: m });
|
|
53
|
+
if (!r) return null;
|
|
54
|
+
if (e.trigger) {
|
|
55
|
+
const o = e.trigger;
|
|
56
|
+
return /* @__PURE__ */ E(y, { children: [
|
|
57
|
+
/* @__PURE__ */ i("div", { ref: t }),
|
|
58
|
+
/* @__PURE__ */ i(
|
|
59
|
+
o,
|
|
60
|
+
{
|
|
61
|
+
onClick: () => r(t.current, { ...e.config, display: "modal" })
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] });
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ i("div", { ref: t });
|
|
53
67
|
};
|
|
54
68
|
export {
|
|
55
|
-
|
|
69
|
+
T as MoonpayCommerceDeposit
|
|
56
70
|
};
|