@dj-test/payment-sdk 1.0.8 → 1.0.9
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/index.js +82 -49
- package/dist/index.mjs +82 -49
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1137,6 +1137,52 @@ var shortenErrorMessage = (error) => {
|
|
|
1137
1137
|
return message;
|
|
1138
1138
|
};
|
|
1139
1139
|
|
|
1140
|
+
// src/utils/mobile.ts
|
|
1141
|
+
var isMobile = () => {
|
|
1142
|
+
if (typeof window === "undefined") return false;
|
|
1143
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1144
|
+
navigator.userAgent
|
|
1145
|
+
);
|
|
1146
|
+
};
|
|
1147
|
+
var isMetaMaskBrowser = () => {
|
|
1148
|
+
if (typeof window === "undefined") return false;
|
|
1149
|
+
const { ethereum } = window;
|
|
1150
|
+
return Boolean(ethereum && ethereum.isMetaMask);
|
|
1151
|
+
};
|
|
1152
|
+
var isMetaMaskAvailable = () => {
|
|
1153
|
+
if (typeof window === "undefined") return false;
|
|
1154
|
+
const { ethereum } = window;
|
|
1155
|
+
return Boolean(ethereum && ethereum.isMetaMask);
|
|
1156
|
+
};
|
|
1157
|
+
var openMetaMaskDeepLink = (returnUrl) => {
|
|
1158
|
+
if (typeof window === "undefined") return;
|
|
1159
|
+
const url = returnUrl || window.location.href;
|
|
1160
|
+
const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
|
|
1161
|
+
window.location.href = deepLink;
|
|
1162
|
+
};
|
|
1163
|
+
var getConnectionStrategy = () => {
|
|
1164
|
+
if (!isMobile() || isMetaMaskBrowser()) {
|
|
1165
|
+
if (isMetaMaskAvailable()) {
|
|
1166
|
+
return {
|
|
1167
|
+
type: "injected",
|
|
1168
|
+
message: "Connect with browser wallet"
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
return {
|
|
1172
|
+
type: "unavailable",
|
|
1173
|
+
message: "Please install MetaMask extension"
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
return {
|
|
1177
|
+
type: "deeplink",
|
|
1178
|
+
message: "Open in MetaMask app",
|
|
1179
|
+
action: () => openMetaMaskDeepLink()
|
|
1180
|
+
};
|
|
1181
|
+
};
|
|
1182
|
+
var shouldUseDeepLink = () => {
|
|
1183
|
+
return isMobile() && !isMetaMaskBrowser();
|
|
1184
|
+
};
|
|
1185
|
+
|
|
1140
1186
|
// src/components/PayWithWallet.tsx
|
|
1141
1187
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1142
1188
|
var PayWithWallet = ({
|
|
@@ -1400,10 +1446,21 @@ var PayWithWallet = ({
|
|
|
1400
1446
|
},
|
|
1401
1447
|
connector.id
|
|
1402
1448
|
)) })
|
|
1403
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.
|
|
1449
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "no-wallets", children: isMobile() && !isMetaMaskBrowser() && adapterType === "evm" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1450
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: "Open in MetaMask App" }),
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wallet-hint", children: "MetaMask browser extension not detected" }),
|
|
1452
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1453
|
+
"button",
|
|
1454
|
+
{
|
|
1455
|
+
onClick: () => openMetaMaskDeepLink(),
|
|
1456
|
+
className: "btn-deep-link",
|
|
1457
|
+
children: "Open MetaMask App"
|
|
1458
|
+
}
|
|
1459
|
+
)
|
|
1460
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1404
1461
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: "No compatible wallet detected" }),
|
|
1405
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wallet-hint", children: adapterType === "tron" ? "Please install TronLink extension to continue" : "Please install MetaMask, Trust Wallet, or
|
|
1406
|
-
] })
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "wallet-hint", children: adapterType === "tron" ? "Please install TronLink extension to continue" : "Please install MetaMask, Trust Wallet, or compatible wallet to continue" })
|
|
1463
|
+
] }) })
|
|
1407
1464
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "wallet-connected", children: [
|
|
1408
1465
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "connected-info", children: [
|
|
1409
1466
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "connected-address", children: truncateAddress(wallet.address, 6, 4) }),
|
|
@@ -1692,6 +1749,28 @@ var PayWithWallet = ({
|
|
|
1692
1749
|
color: hsl(25 95.8% 35%) !important;
|
|
1693
1750
|
}
|
|
1694
1751
|
|
|
1752
|
+
.btn-deep-link {
|
|
1753
|
+
margin-top: 1rem;
|
|
1754
|
+
padding: 0.625rem 1.25rem;
|
|
1755
|
+
background: hsl(222.2 47.4% 11.2%);
|
|
1756
|
+
color: hsl(210 40% 98%);
|
|
1757
|
+
border: none;
|
|
1758
|
+
border-radius: 0.5rem;
|
|
1759
|
+
font-weight: 600;
|
|
1760
|
+
cursor: pointer;
|
|
1761
|
+
transition: all 0.15s;
|
|
1762
|
+
font-size: 0.875rem;
|
|
1763
|
+
width: 100%;
|
|
1764
|
+
height: 2.5rem;
|
|
1765
|
+
display: inline-flex;
|
|
1766
|
+
align-items: center;
|
|
1767
|
+
justify-content: center;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.btn-deep-link:hover {
|
|
1771
|
+
background: hsl(222.2 47.4% 8%);
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1695
1774
|
@keyframes spin {
|
|
1696
1775
|
to { transform: rotate(360deg); }
|
|
1697
1776
|
}
|
|
@@ -3837,52 +3916,6 @@ var useWallet = () => {
|
|
|
3837
3916
|
// EVM만 체크
|
|
3838
3917
|
};
|
|
3839
3918
|
};
|
|
3840
|
-
|
|
3841
|
-
// src/utils/mobile.ts
|
|
3842
|
-
var isMobile = () => {
|
|
3843
|
-
if (typeof window === "undefined") return false;
|
|
3844
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
3845
|
-
navigator.userAgent
|
|
3846
|
-
);
|
|
3847
|
-
};
|
|
3848
|
-
var isMetaMaskBrowser = () => {
|
|
3849
|
-
if (typeof window === "undefined") return false;
|
|
3850
|
-
const { ethereum } = window;
|
|
3851
|
-
return Boolean(ethereum && ethereum.isMetaMask);
|
|
3852
|
-
};
|
|
3853
|
-
var isMetaMaskAvailable = () => {
|
|
3854
|
-
if (typeof window === "undefined") return false;
|
|
3855
|
-
const { ethereum } = window;
|
|
3856
|
-
return Boolean(ethereum && ethereum.isMetaMask);
|
|
3857
|
-
};
|
|
3858
|
-
var openMetaMaskDeepLink = (returnUrl) => {
|
|
3859
|
-
if (typeof window === "undefined") return;
|
|
3860
|
-
const url = returnUrl || window.location.href;
|
|
3861
|
-
const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
|
|
3862
|
-
window.location.href = deepLink;
|
|
3863
|
-
};
|
|
3864
|
-
var getConnectionStrategy = () => {
|
|
3865
|
-
if (!isMobile() || isMetaMaskBrowser()) {
|
|
3866
|
-
if (isMetaMaskAvailable()) {
|
|
3867
|
-
return {
|
|
3868
|
-
type: "injected",
|
|
3869
|
-
message: "Connect with browser wallet"
|
|
3870
|
-
};
|
|
3871
|
-
}
|
|
3872
|
-
return {
|
|
3873
|
-
type: "unavailable",
|
|
3874
|
-
message: "Please install MetaMask extension"
|
|
3875
|
-
};
|
|
3876
|
-
}
|
|
3877
|
-
return {
|
|
3878
|
-
type: "deeplink",
|
|
3879
|
-
message: "Open in MetaMask app",
|
|
3880
|
-
action: () => openMetaMaskDeepLink()
|
|
3881
|
-
};
|
|
3882
|
-
};
|
|
3883
|
-
var shouldUseDeepLink = () => {
|
|
3884
|
-
return isMobile() && !isMetaMaskBrowser();
|
|
3885
|
-
};
|
|
3886
3919
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3887
3920
|
0 && (module.exports = {
|
|
3888
3921
|
API_ENDPOINTS,
|
package/dist/index.mjs
CHANGED
|
@@ -1072,6 +1072,52 @@ var shortenErrorMessage = (error) => {
|
|
|
1072
1072
|
return message;
|
|
1073
1073
|
};
|
|
1074
1074
|
|
|
1075
|
+
// src/utils/mobile.ts
|
|
1076
|
+
var isMobile = () => {
|
|
1077
|
+
if (typeof window === "undefined") return false;
|
|
1078
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1079
|
+
navigator.userAgent
|
|
1080
|
+
);
|
|
1081
|
+
};
|
|
1082
|
+
var isMetaMaskBrowser = () => {
|
|
1083
|
+
if (typeof window === "undefined") return false;
|
|
1084
|
+
const { ethereum } = window;
|
|
1085
|
+
return Boolean(ethereum && ethereum.isMetaMask);
|
|
1086
|
+
};
|
|
1087
|
+
var isMetaMaskAvailable = () => {
|
|
1088
|
+
if (typeof window === "undefined") return false;
|
|
1089
|
+
const { ethereum } = window;
|
|
1090
|
+
return Boolean(ethereum && ethereum.isMetaMask);
|
|
1091
|
+
};
|
|
1092
|
+
var openMetaMaskDeepLink = (returnUrl) => {
|
|
1093
|
+
if (typeof window === "undefined") return;
|
|
1094
|
+
const url = returnUrl || window.location.href;
|
|
1095
|
+
const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
|
|
1096
|
+
window.location.href = deepLink;
|
|
1097
|
+
};
|
|
1098
|
+
var getConnectionStrategy = () => {
|
|
1099
|
+
if (!isMobile() || isMetaMaskBrowser()) {
|
|
1100
|
+
if (isMetaMaskAvailable()) {
|
|
1101
|
+
return {
|
|
1102
|
+
type: "injected",
|
|
1103
|
+
message: "Connect with browser wallet"
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
return {
|
|
1107
|
+
type: "unavailable",
|
|
1108
|
+
message: "Please install MetaMask extension"
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
return {
|
|
1112
|
+
type: "deeplink",
|
|
1113
|
+
message: "Open in MetaMask app",
|
|
1114
|
+
action: () => openMetaMaskDeepLink()
|
|
1115
|
+
};
|
|
1116
|
+
};
|
|
1117
|
+
var shouldUseDeepLink = () => {
|
|
1118
|
+
return isMobile() && !isMetaMaskBrowser();
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1075
1121
|
// src/components/PayWithWallet.tsx
|
|
1076
1122
|
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
1077
1123
|
var PayWithWallet = ({
|
|
@@ -1335,10 +1381,21 @@ var PayWithWallet = ({
|
|
|
1335
1381
|
},
|
|
1336
1382
|
connector.id
|
|
1337
1383
|
)) })
|
|
1338
|
-
] }) : /* @__PURE__ */
|
|
1384
|
+
] }) : /* @__PURE__ */ jsx3("div", { className: "no-wallets", children: isMobile() && !isMetaMaskBrowser() && adapterType === "evm" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1385
|
+
/* @__PURE__ */ jsx3("p", { children: "Open in MetaMask App" }),
|
|
1386
|
+
/* @__PURE__ */ jsx3("p", { className: "wallet-hint", children: "MetaMask browser extension not detected" }),
|
|
1387
|
+
/* @__PURE__ */ jsx3(
|
|
1388
|
+
"button",
|
|
1389
|
+
{
|
|
1390
|
+
onClick: () => openMetaMaskDeepLink(),
|
|
1391
|
+
className: "btn-deep-link",
|
|
1392
|
+
children: "Open MetaMask App"
|
|
1393
|
+
}
|
|
1394
|
+
)
|
|
1395
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1339
1396
|
/* @__PURE__ */ jsx3("p", { children: "No compatible wallet detected" }),
|
|
1340
|
-
/* @__PURE__ */ jsx3("p", { className: "wallet-hint", children: adapterType === "tron" ? "Please install TronLink extension to continue" : "Please install MetaMask, Trust Wallet, or
|
|
1341
|
-
] })
|
|
1397
|
+
/* @__PURE__ */ jsx3("p", { className: "wallet-hint", children: adapterType === "tron" ? "Please install TronLink extension to continue" : "Please install MetaMask, Trust Wallet, or compatible wallet to continue" })
|
|
1398
|
+
] }) })
|
|
1342
1399
|
] }) : /* @__PURE__ */ jsxs("div", { className: "wallet-connected", children: [
|
|
1343
1400
|
/* @__PURE__ */ jsxs("div", { className: "connected-info", children: [
|
|
1344
1401
|
/* @__PURE__ */ jsx3("p", { className: "connected-address", children: truncateAddress(wallet.address, 6, 4) }),
|
|
@@ -1627,6 +1684,28 @@ var PayWithWallet = ({
|
|
|
1627
1684
|
color: hsl(25 95.8% 35%) !important;
|
|
1628
1685
|
}
|
|
1629
1686
|
|
|
1687
|
+
.btn-deep-link {
|
|
1688
|
+
margin-top: 1rem;
|
|
1689
|
+
padding: 0.625rem 1.25rem;
|
|
1690
|
+
background: hsl(222.2 47.4% 11.2%);
|
|
1691
|
+
color: hsl(210 40% 98%);
|
|
1692
|
+
border: none;
|
|
1693
|
+
border-radius: 0.5rem;
|
|
1694
|
+
font-weight: 600;
|
|
1695
|
+
cursor: pointer;
|
|
1696
|
+
transition: all 0.15s;
|
|
1697
|
+
font-size: 0.875rem;
|
|
1698
|
+
width: 100%;
|
|
1699
|
+
height: 2.5rem;
|
|
1700
|
+
display: inline-flex;
|
|
1701
|
+
align-items: center;
|
|
1702
|
+
justify-content: center;
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
.btn-deep-link:hover {
|
|
1706
|
+
background: hsl(222.2 47.4% 8%);
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1630
1709
|
@keyframes spin {
|
|
1631
1710
|
to { transform: rotate(360deg); }
|
|
1632
1711
|
}
|
|
@@ -3772,52 +3851,6 @@ var useWallet = () => {
|
|
|
3772
3851
|
// EVM만 체크
|
|
3773
3852
|
};
|
|
3774
3853
|
};
|
|
3775
|
-
|
|
3776
|
-
// src/utils/mobile.ts
|
|
3777
|
-
var isMobile = () => {
|
|
3778
|
-
if (typeof window === "undefined") return false;
|
|
3779
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
3780
|
-
navigator.userAgent
|
|
3781
|
-
);
|
|
3782
|
-
};
|
|
3783
|
-
var isMetaMaskBrowser = () => {
|
|
3784
|
-
if (typeof window === "undefined") return false;
|
|
3785
|
-
const { ethereum } = window;
|
|
3786
|
-
return Boolean(ethereum && ethereum.isMetaMask);
|
|
3787
|
-
};
|
|
3788
|
-
var isMetaMaskAvailable = () => {
|
|
3789
|
-
if (typeof window === "undefined") return false;
|
|
3790
|
-
const { ethereum } = window;
|
|
3791
|
-
return Boolean(ethereum && ethereum.isMetaMask);
|
|
3792
|
-
};
|
|
3793
|
-
var openMetaMaskDeepLink = (returnUrl) => {
|
|
3794
|
-
if (typeof window === "undefined") return;
|
|
3795
|
-
const url = returnUrl || window.location.href;
|
|
3796
|
-
const deepLink = `https://metamask.app.link/dapp/${url.replace(/^https?:\/\//, "")}`;
|
|
3797
|
-
window.location.href = deepLink;
|
|
3798
|
-
};
|
|
3799
|
-
var getConnectionStrategy = () => {
|
|
3800
|
-
if (!isMobile() || isMetaMaskBrowser()) {
|
|
3801
|
-
if (isMetaMaskAvailable()) {
|
|
3802
|
-
return {
|
|
3803
|
-
type: "injected",
|
|
3804
|
-
message: "Connect with browser wallet"
|
|
3805
|
-
};
|
|
3806
|
-
}
|
|
3807
|
-
return {
|
|
3808
|
-
type: "unavailable",
|
|
3809
|
-
message: "Please install MetaMask extension"
|
|
3810
|
-
};
|
|
3811
|
-
}
|
|
3812
|
-
return {
|
|
3813
|
-
type: "deeplink",
|
|
3814
|
-
message: "Open in MetaMask app",
|
|
3815
|
-
action: () => openMetaMaskDeepLink()
|
|
3816
|
-
};
|
|
3817
|
-
};
|
|
3818
|
-
var shouldUseDeepLink = () => {
|
|
3819
|
-
return isMobile() && !isMetaMaskBrowser();
|
|
3820
|
-
};
|
|
3821
3854
|
export {
|
|
3822
3855
|
API_ENDPOINTS,
|
|
3823
3856
|
ChainType as ChainTypes,
|