coinley-test 0.0.25 → 0.0.26
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.esm.js +97 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/vanilla/Logomark.png +0 -0
- package/dist/vanilla/coinley-vanilla.umd.js +21 -0
- package/dist/vanilla/coinley-vanilla.umd.js.map +1 -0
- package/dist/vanilla/style.css +1 -0
- package/dist/vanilla/vite.svg +1 -0
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -3,6 +3,7 @@ import { motion, AnimatePresence } from "framer-motion";
|
|
|
3
3
|
import { ArrowLeft, X, Sparkles, Wallet, Zap, QrCode, Loader2, ChevronDown, CheckCircle2, Copy, ExternalLink, AlertCircle } from "lucide-react";
|
|
4
4
|
import { createCoinleyWalletConfig, CoinleyWalletProvider, WalletModal, useWallet, useWalletConnect, useWalletDetection, useWalletTransaction, useWalletModal } from "@coinley/wallet-connect-core";
|
|
5
5
|
import axios from "axios";
|
|
6
|
+
import require$$0 from "react-dom";
|
|
6
7
|
var jsxRuntime = { exports: {} };
|
|
7
8
|
var reactJsxRuntime_production_min = {};
|
|
8
9
|
/**
|
|
@@ -14,13 +15,13 @@ var reactJsxRuntime_production_min = {};
|
|
|
14
15
|
* This source code is licensed under the MIT license found in the
|
|
15
16
|
* LICENSE file in the root directory of this source tree.
|
|
16
17
|
*/
|
|
17
|
-
var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
18
|
+
var f = React, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m$1 = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
18
19
|
function q(c, a, g) {
|
|
19
20
|
var b, d = {}, e = null, h = null;
|
|
20
21
|
void 0 !== g && (e = "" + g);
|
|
21
22
|
void 0 !== a.key && (e = "" + a.key);
|
|
22
23
|
void 0 !== a.ref && (h = a.ref);
|
|
23
|
-
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
24
|
+
for (b in a) m$1.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
24
25
|
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
25
26
|
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
26
27
|
}
|
|
@@ -2780,8 +2781,66 @@ const EnhancedSimpleCoinleyPayment = ({
|
|
|
2780
2781
|
] }) }) })
|
|
2781
2782
|
] });
|
|
2782
2783
|
};
|
|
2784
|
+
var createRoot;
|
|
2785
|
+
var m = require$$0;
|
|
2786
|
+
{
|
|
2787
|
+
createRoot = m.createRoot;
|
|
2788
|
+
m.hydrateRoot;
|
|
2789
|
+
}
|
|
2790
|
+
class CoinleyVanilla {
|
|
2791
|
+
constructor(config = {}) {
|
|
2792
|
+
this.config = { ...config };
|
|
2793
|
+
this.isOpen = false;
|
|
2794
|
+
this.root = null;
|
|
2795
|
+
this.container = null;
|
|
2796
|
+
this.callbacks = {};
|
|
2797
|
+
}
|
|
2798
|
+
open(paymentConfig, callbacks = {}) {
|
|
2799
|
+
if (this.isOpen) return;
|
|
2800
|
+
this.callbacks = callbacks;
|
|
2801
|
+
this.container = document.createElement("div");
|
|
2802
|
+
this.container.id = "coinley-payment-container";
|
|
2803
|
+
this.container.style.cssText = "position:fixed;top:0;left:0;right:0;bottom:0;z-index:999999;";
|
|
2804
|
+
document.body.appendChild(this.container);
|
|
2805
|
+
this.root = createRoot(this.container);
|
|
2806
|
+
this.isOpen = true;
|
|
2807
|
+
this.root.render(
|
|
2808
|
+
React.createElement(EnhancedSimpleCoinleyPayment, {
|
|
2809
|
+
...this.config,
|
|
2810
|
+
isOpen: true,
|
|
2811
|
+
config: paymentConfig,
|
|
2812
|
+
onSuccess: this.handleSuccess.bind(this),
|
|
2813
|
+
onError: this.handleError.bind(this),
|
|
2814
|
+
onClose: this.handleClose.bind(this)
|
|
2815
|
+
})
|
|
2816
|
+
);
|
|
2817
|
+
}
|
|
2818
|
+
close() {
|
|
2819
|
+
if (!this.isOpen) return;
|
|
2820
|
+
this.isOpen = false;
|
|
2821
|
+
if (this.root) {
|
|
2822
|
+
this.root.unmount();
|
|
2823
|
+
this.root = null;
|
|
2824
|
+
}
|
|
2825
|
+
if (this.container) {
|
|
2826
|
+
this.container.remove();
|
|
2827
|
+
this.container = null;
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
handleSuccess(paymentId, txHash, details) {
|
|
2831
|
+
if (this.callbacks.onSuccess) this.callbacks.onSuccess(paymentId, txHash, details);
|
|
2832
|
+
}
|
|
2833
|
+
handleError(error) {
|
|
2834
|
+
if (this.callbacks.onError) this.callbacks.onError(error);
|
|
2835
|
+
}
|
|
2836
|
+
handleClose() {
|
|
2837
|
+
this.close();
|
|
2838
|
+
if (this.callbacks.onClose) this.callbacks.onClose();
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
if (typeof window !== "undefined") window.CoinleyVanilla = CoinleyVanilla;
|
|
2783
2842
|
const SimpleCoinleyProvider = ({ children, ...props }) => children;
|
|
2784
|
-
const VERSION = "0.0.
|
|
2843
|
+
const VERSION = "0.0.26";
|
|
2785
2844
|
const utils = {
|
|
2786
2845
|
formatAmount: (amount, decimals = 2) => amount.toFixed(decimals),
|
|
2787
2846
|
truncateAddress: (address, startChars = 6, endChars = 4) => {
|
|
@@ -2827,30 +2886,8 @@ const DEFAULT_CONFIG = {
|
|
|
2827
2886
|
autoOpen: false
|
|
2828
2887
|
};
|
|
2829
2888
|
const USAGE_EXAMPLES = {
|
|
2830
|
-
//
|
|
2831
|
-
|
|
2832
|
-
import { SimpleCoinleyPayment } from 'coinley-test';
|
|
2833
|
-
|
|
2834
|
-
<SimpleCoinleyPayment
|
|
2835
|
-
apiKey="your-api-key"
|
|
2836
|
-
apiSecret="your-api-secret"
|
|
2837
|
-
apiUrl="https://your-api-url.com"
|
|
2838
|
-
isOpen={isOpen}
|
|
2839
|
-
config={{
|
|
2840
|
-
amount: 100,
|
|
2841
|
-
customerEmail: "customer@example.com",
|
|
2842
|
-
merchantWalletAddresses: {
|
|
2843
|
-
ethereum: "0x...",
|
|
2844
|
-
bsc: "0x..."
|
|
2845
|
-
}
|
|
2846
|
-
}}
|
|
2847
|
-
onSuccess={(paymentId, txHash, details) => console.log('Success!')}
|
|
2848
|
-
onError={(error) => console.error('Error:', error)}
|
|
2849
|
-
onClose={() => setIsOpen(false)}
|
|
2850
|
-
/>
|
|
2851
|
-
`,
|
|
2852
|
-
// Enhanced component with modern design
|
|
2853
|
-
enhanced: `
|
|
2889
|
+
// React usage (unchanged)
|
|
2890
|
+
react: `
|
|
2854
2891
|
import { EnhancedSimpleCoinleyPayment } from 'coinley-test';
|
|
2855
2892
|
|
|
2856
2893
|
<EnhancedSimpleCoinleyPayment
|
|
@@ -2870,8 +2907,39 @@ import { EnhancedSimpleCoinleyPayment } from 'coinley-test';
|
|
|
2870
2907
|
onSuccess={(paymentId, txHash, details) => console.log('Success!')}
|
|
2871
2908
|
onError={(error) => console.error('Error:', error)}
|
|
2872
2909
|
onClose={() => setIsOpen(false)}
|
|
2873
|
-
theme="light"
|
|
2910
|
+
theme="light"
|
|
2874
2911
|
/>
|
|
2912
|
+
`,
|
|
2913
|
+
// NEW: Vanilla JavaScript usage
|
|
2914
|
+
vanilla: `
|
|
2915
|
+
<!-- Include via CDN -->
|
|
2916
|
+
<script src="https://unpkg.com/coinley-test@latest/vanilla"><\/script>
|
|
2917
|
+
<link rel="stylesheet" href="https://unpkg.com/coinley-test@latest/vanilla/style.css">
|
|
2918
|
+
|
|
2919
|
+
<script>
|
|
2920
|
+
// Initialize
|
|
2921
|
+
const coinley = new CoinleyVanilla({
|
|
2922
|
+
apiKey: "your-api-key",
|
|
2923
|
+
apiSecret: "your-api-secret",
|
|
2924
|
+
apiUrl: "https://your-api-url.com",
|
|
2925
|
+
theme: "light"
|
|
2926
|
+
});
|
|
2927
|
+
|
|
2928
|
+
// Use in checkout
|
|
2929
|
+
coinley.open({
|
|
2930
|
+
amount: 100,
|
|
2931
|
+
customerEmail: "customer@example.com",
|
|
2932
|
+
merchantName: "Your Store",
|
|
2933
|
+
merchantWalletAddresses: {
|
|
2934
|
+
ethereum: "0x...",
|
|
2935
|
+
bsc: "0x..."
|
|
2936
|
+
}
|
|
2937
|
+
}, {
|
|
2938
|
+
onSuccess: (paymentId, txHash, details) => console.log('Success!'),
|
|
2939
|
+
onError: (error) => console.error('Error:', error),
|
|
2940
|
+
onClose: () => console.log('Closed')
|
|
2941
|
+
});
|
|
2942
|
+
<\/script>
|
|
2875
2943
|
`
|
|
2876
2944
|
};
|
|
2877
2945
|
export {
|
|
@@ -2879,6 +2947,7 @@ export {
|
|
|
2879
2947
|
CoinleyError,
|
|
2880
2948
|
CoinleyPayment,
|
|
2881
2949
|
CoinleyProvider,
|
|
2950
|
+
CoinleyVanilla,
|
|
2882
2951
|
DEFAULT_CONFIG,
|
|
2883
2952
|
EnhancedSimpleCoinleyPayment,
|
|
2884
2953
|
PaymentAPI,
|