@coinflowlabs/react 4.3.1 → 4.4.1
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/README.md +53 -41
- package/build/cjs/CoinflowPurchase.d.ts +2 -1
- package/build/cjs/CoinflowPurchase.js +98 -3
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/MobileWalletButton.d.ts +1 -0
- package/build/cjs/MobileWalletButton.js +6 -2
- package/build/cjs/MobileWalletButton.js.map +1 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.d.ts +2 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.js +1 -0
- package/build/cjs/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/cjs/common/CoinflowTypes.d.ts +5 -1
- package/build/cjs/common/CoinflowTypes.js.map +1 -1
- package/build/cjs/common/CoinflowUtils.d.ts +1 -1
- package/build/cjs/common/CoinflowUtils.js +3 -1
- package/build/cjs/common/CoinflowUtils.js.map +1 -1
- package/build/esm/CoinflowPurchase.d.ts +2 -1
- package/build/esm/CoinflowPurchase.js +100 -6
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/MobileWalletButton.d.ts +1 -0
- package/build/esm/MobileWalletButton.js +6 -2
- package/build/esm/MobileWalletButton.js.map +1 -1
- package/build/esm/common/CoinflowLibMessageHandlers.d.ts +2 -1
- package/build/esm/common/CoinflowLibMessageHandlers.js +1 -0
- package/build/esm/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/esm/common/CoinflowTypes.d.ts +5 -1
- package/build/esm/common/CoinflowTypes.js.map +1 -1
- package/build/esm/common/CoinflowUtils.d.ts +1 -1
- package/build/esm/common/CoinflowUtils.js +3 -1
- package/build/esm/common/CoinflowUtils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Coinflow React
|
|
2
2
|
|
|
3
3
|
## Withdraw Usage
|
|
4
|
+
|
|
4
5
|
```
|
|
5
6
|
import {useWallet} from '@solana/wallet-adapter-react';
|
|
6
7
|
const wallet = useWallet();
|
|
@@ -10,23 +11,25 @@ const connection = useConnection();
|
|
|
10
11
|
```
|
|
11
12
|
|
|
12
13
|
Props:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
|
|
15
|
+
- `wallet`: The Solana Wallet Adapter Wallet
|
|
16
|
+
- `merchantId`: Your Merchant ID (Contact Coinflow support for this)
|
|
17
|
+
- `connection`: Solana Connection
|
|
18
|
+
- `env` (optional): This defaults to `prod`
|
|
19
|
+
- For testing set to `staging`
|
|
20
|
+
- `onSuccess` (optional): function to run when the withdrawal process is successful
|
|
21
|
+
- `lockAmount` (optional): Whether to let the user select the amount to withdraw or to disable the input
|
|
22
|
+
- `amount` (optional): The amount to withdraw - required if `lockAmount=true`
|
|
23
|
+
- `tokens` (optional): Define a list to filter the available tokens
|
|
24
|
+
- `lockDefaultToken` (optional): Only allow the default token to be used
|
|
25
|
+
- `email` (optional): Set the default email to be used in entry fields
|
|
26
|
+
- `bankAccountLinkRedirect` (optional): The URL to be used for bank account setup
|
|
27
|
+
- `additionalWallets` (optional): Define additional wallets to assign to the user
|
|
28
|
+
- `usePermit` (optional): Pass as false to disable permit message signing for EVM and use approve transactions
|
|
29
|
+
- `transactionSigner` (optional): Public Key of the wallet which will actually execute the withdrawal transaction. Must be associated with the same withdrawer as the main wallet.
|
|
28
30
|
|
|
29
31
|
## Purchase Usage
|
|
32
|
+
|
|
30
33
|
```
|
|
31
34
|
import {useWallet} from '@solana/wallet-adapter-react';
|
|
32
35
|
const wallet = useWallet();
|
|
@@ -36,41 +39,51 @@ const connection = useConnection();
|
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
Props:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
|
|
43
|
+
- `wallet`: The Solana Wallet Adapter Wallet
|
|
44
|
+
- `merchantId`: Your Merchant ID (Contact Coinflow support for this)
|
|
45
|
+
- `connection`: Solana Connection
|
|
46
|
+
- `env` (optional): This defaults to `prod`
|
|
43
47
|
- For testing set to `staging`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
- `onSuccess` (optional): function to run when the purchase process is successful
|
|
49
|
+
- `transaction` (optional): transaction for the user to run which redeems their credits with your smart contract. Create this transaction just like you would for a normal user who has USDC in their account.
|
|
50
|
+
- `partialSigners` (optional): Keypairs of Partial Signers to sign the transaction with, this is necessary when initializing new accounts as the new account Keypair must sign the transaction.
|
|
51
|
+
- `debugTx` (optional): Setting this to `true` will sign the transaction with the wallet, and send the transaction with no preflight checks allowing for easier debug of any issues.
|
|
52
|
+
- `token` (optional): The token to use for the purchase. Defaults to USDC. Currently only supported for the Solana Blockchain.
|
|
53
|
+
- `planCode` (optional): When a subscription is being purchased, the code of the subscription plan.
|
|
54
|
+
- `settlementType` (optional): The settlement method to use for the proceeds of a purchase. (Credits, USDC, or Bank)
|
|
55
|
+
- `amount` (optional): Fix the amount of purchase
|
|
56
|
+
- `webhookInfo` (optional): Product or transaction based information that you want transmitted when you receive webhooks regarding the purchase
|
|
57
|
+
- `email` (optional): Set the default email to use in email entry fields
|
|
58
|
+
- `chargebackProtectionData` (optional):
|
|
59
|
+
- `disableApplePay` (optional): Ability to disable Apple Pay
|
|
60
|
+
- `disableGooglePay` (optional): Ability to disable Google Pay
|
|
61
|
+
- `customerInfo` (optional): Additional information about the customer
|
|
62
|
+
- `rent` (optional, Solana only): Specify the blockchain rent amount to add to the total
|
|
63
|
+
- `nativeSolToConvert` (optional, Solana only): Specify the amount of native SOL to convert wSOL for the purchase
|
|
64
|
+
- `jwtToken` (optional): A JWT token which encodes verified checkout parameters to prevent spoofing of arguments.
|
|
65
|
+
- `supportEmail` (optional): Your business support email address to use for support inquiries
|
|
61
66
|
|
|
62
67
|
## Utils
|
|
63
68
|
|
|
64
69
|
`CoinflowUtils`
|
|
65
70
|
|
|
66
|
-
|
|
71
|
+
- `getFeePayer` - Return the `PublicKey` of the Coinflow Fee Payer
|
|
67
72
|
|
|
68
73
|
# Changelog
|
|
69
74
|
|
|
70
|
-
## 4.
|
|
75
|
+
## 4.4.1
|
|
76
|
+
|
|
77
|
+
- Added `onError` callback to Apple Pay and Google Pay buttons
|
|
78
|
+
|
|
79
|
+
## 4.4.0
|
|
71
80
|
|
|
72
81
|
- Added overlay to digital wallet buttons to make the loading time 0
|
|
73
82
|
|
|
83
|
+
## 4.3.1
|
|
84
|
+
|
|
85
|
+
- CoinflowPurchaseV2 component added for a modernized purchase flow
|
|
86
|
+
|
|
74
87
|
## 4.3.0
|
|
75
88
|
|
|
76
89
|
- Added arbitrum blockchain support
|
|
@@ -162,16 +175,15 @@ Props:
|
|
|
162
175
|
|
|
163
176
|
### 2.6.1
|
|
164
177
|
|
|
165
|
-
- Added built in support for SSR which fixes a "window not defined" error.
|
|
178
|
+
- Added built in support for SSR which fixes a "window not defined" error.
|
|
166
179
|
|
|
167
180
|
### 2.6.0
|
|
168
181
|
|
|
169
182
|
- Added support for Apple Pay and Google Pay
|
|
170
183
|
|
|
171
|
-
|
|
172
184
|
### 2.5.0
|
|
173
185
|
|
|
174
|
-
- Added the `CoinflowCardForm` component which allows merchants to collect credit card information from their users in a PCI compliant way. Tokenize it, and then utilize the remainder of Coinflow's APIs.
|
|
186
|
+
- Added the `CoinflowCardForm` component which allows merchants to collect credit card information from their users in a PCI compliant way. Tokenize it, and then utilize the remainder of Coinflow's APIs.
|
|
175
187
|
|
|
176
188
|
### 2.4.0
|
|
177
189
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { CoinflowPurchaseProps } from './common';
|
|
3
|
+
export declare function CoinflowPurchaseLegacy(purchaseProps: CoinflowPurchaseProps): React.JSX.Element;
|
|
3
4
|
export declare function CoinflowPurchase(purchaseProps: CoinflowPurchaseProps): React.JSX.Element;
|
|
@@ -1,18 +1,113 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoinflowPurchaseLegacy = CoinflowPurchaseLegacy;
|
|
3
4
|
exports.CoinflowPurchase = CoinflowPurchase;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
7
|
var common_1 = require("./common");
|
|
7
8
|
var CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
8
|
-
|
|
9
|
+
var useOverlay_1 = require("./useOverlay");
|
|
10
|
+
function useCoinflowPurchase(purchaseProps, version) {
|
|
9
11
|
var iframeProps = (0, react_1.useMemo)(function () {
|
|
10
12
|
var walletPubkey = (0, common_1.getWalletPubkey)(purchaseProps);
|
|
11
|
-
return tslib_1.__assign(tslib_1.__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase/".concat(purchaseProps.merchantId), transaction: common_1.CoinflowUtils.getTransaction(purchaseProps) });
|
|
12
|
-
}, [purchaseProps]);
|
|
13
|
+
return tslib_1.__assign(tslib_1.__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase".concat(version, "/").concat(purchaseProps.merchantId), transaction: common_1.CoinflowUtils.getTransaction(purchaseProps) });
|
|
14
|
+
}, [purchaseProps, version]);
|
|
13
15
|
var messageHandlers = (0, react_1.useMemo)(function () {
|
|
14
16
|
return tslib_1.__assign(tslib_1.__assign({}, (0, common_1.getHandlers)(purchaseProps)), { handleHeightChange: purchaseProps.handleHeightChange });
|
|
15
17
|
}, [purchaseProps]);
|
|
18
|
+
return { iframeProps: iframeProps, messageHandlers: messageHandlers };
|
|
19
|
+
}
|
|
20
|
+
function CoinflowPurchaseLegacy(purchaseProps) {
|
|
21
|
+
var _a = useCoinflowPurchase(purchaseProps, ''), iframeProps = _a.iframeProps, messageHandlers = _a.messageHandlers;
|
|
16
22
|
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps, messageHandlers));
|
|
17
23
|
}
|
|
24
|
+
function CoinflowPurchase(purchaseProps) {
|
|
25
|
+
var iframeRef = (0, react_1.useRef)(null);
|
|
26
|
+
var _a = useCoinflowPurchase(purchaseProps, '-v2'), iframeProps = _a.iframeProps, messageHandlers = _a.messageHandlers;
|
|
27
|
+
var showOverlay = (0, useOverlay_1.useOverlay)(iframeRef).showOverlay;
|
|
28
|
+
var loaderBackground = iframeProps.loaderBackground || '#ffffff'; // white default bg
|
|
29
|
+
var invertedColor = invertHexColor(loaderBackground);
|
|
30
|
+
return (react_1.default.createElement("div", { style: styles.container(loaderBackground) },
|
|
31
|
+
react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({ ref: iframeRef }, iframeProps, messageHandlers)),
|
|
32
|
+
showOverlay && (react_1.default.createElement(LoaderOverlay, { loaderBackground: loaderBackground, invertedColor: invertedColor }))));
|
|
33
|
+
}
|
|
34
|
+
function LoaderOverlay(_a) {
|
|
35
|
+
var loaderBackground = _a.loaderBackground, invertedColor = _a.invertedColor;
|
|
36
|
+
return (react_1.default.createElement("div", { style: styles.overlay(loaderBackground) },
|
|
37
|
+
react_1.default.createElement(LoaderGrid, { columns: 2 },
|
|
38
|
+
react_1.default.createElement(Loader, { loaderBackground: invertedColor }),
|
|
39
|
+
react_1.default.createElement(Loader, { loaderBackground: invertedColor })),
|
|
40
|
+
react_1.default.createElement(LoaderGrid, { columns: 1 },
|
|
41
|
+
react_1.default.createElement(Loader, { height: 80, loaderBackground: invertedColor })),
|
|
42
|
+
tslib_1.__spreadArray([], Array(3), true).map(function (_, index) { return (react_1.default.createElement(LoaderRow, { key: index },
|
|
43
|
+
react_1.default.createElement(Loader, { width: index < 2 ? 80 : 120, height: index < 2 ? 15 : 20, loaderBackground: invertedColor }),
|
|
44
|
+
react_1.default.createElement(Loader, { width: index < 2 ? 60 : 100, height: index < 2 ? 15 : 20, loaderBackground: invertedColor }))); }),
|
|
45
|
+
react_1.default.createElement(LoaderGrid, { columns: 1 },
|
|
46
|
+
react_1.default.createElement(Loader, { height: 60, loaderBackground: invertedColor })),
|
|
47
|
+
react_1.default.createElement(LoaderGrid, { columns: 1, width: "50%" },
|
|
48
|
+
react_1.default.createElement(Loader, { height: 10, loaderBackground: invertedColor })),
|
|
49
|
+
react_1.default.createElement(LoaderGrid, { columns: 1, width: "40%" },
|
|
50
|
+
react_1.default.createElement(Loader, { height: 6, loaderBackground: invertedColor }))));
|
|
51
|
+
}
|
|
52
|
+
function LoaderGrid(_a) {
|
|
53
|
+
var children = _a.children, columns = _a.columns, _b = _a.width, width = _b === void 0 ? '100%' : _b;
|
|
54
|
+
return (react_1.default.createElement("div", { style: tslib_1.__assign(tslib_1.__assign({}, styles.grid), { gridTemplateColumns: "repeat(".concat(columns, ", 1fr)"), width: width }) }, children));
|
|
55
|
+
}
|
|
56
|
+
function LoaderRow(_a) {
|
|
57
|
+
var children = _a.children;
|
|
58
|
+
return react_1.default.createElement("div", { style: styles.row }, children);
|
|
59
|
+
}
|
|
60
|
+
function Loader(_a) {
|
|
61
|
+
var loaderBackground = _a.loaderBackground, _b = _a.height, height = _b === void 0 ? 40 : _b, width = _a.width;
|
|
62
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
63
|
+
react_1.default.createElement("div", { style: styles.loader(loaderBackground, height, width) }),
|
|
64
|
+
react_1.default.createElement("style", null, styles.keyframes)));
|
|
65
|
+
}
|
|
66
|
+
function invertHexColor(hex) {
|
|
67
|
+
var _a;
|
|
68
|
+
hex = hex.replace(/^#/, '');
|
|
69
|
+
var rgb = ((_a = hex.match(/.{2}/g)) === null || _a === void 0 ? void 0 : _a.map(function (val) { return 255 - parseInt(val, 16); })) || [];
|
|
70
|
+
return "#".concat(rgb.map(function (val) { return val.toString(16).padStart(2, '0'); }).join(''));
|
|
71
|
+
}
|
|
72
|
+
var styles = {
|
|
73
|
+
container: function (bg) { return ({
|
|
74
|
+
position: 'relative',
|
|
75
|
+
height: '100%',
|
|
76
|
+
backgroundColor: bg,
|
|
77
|
+
}); },
|
|
78
|
+
overlay: function (bg) { return ({
|
|
79
|
+
backgroundColor: bg,
|
|
80
|
+
display: 'flex',
|
|
81
|
+
color: 'gray',
|
|
82
|
+
position: 'absolute',
|
|
83
|
+
top: 0,
|
|
84
|
+
left: 0,
|
|
85
|
+
right: 0,
|
|
86
|
+
bottom: 0,
|
|
87
|
+
fontSize: 24,
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
flexDirection: 'column',
|
|
90
|
+
gap: '20px',
|
|
91
|
+
zIndex: 10,
|
|
92
|
+
padding: '20px',
|
|
93
|
+
}); },
|
|
94
|
+
grid: {
|
|
95
|
+
display: 'grid',
|
|
96
|
+
gap: '20px',
|
|
97
|
+
width: '100%',
|
|
98
|
+
},
|
|
99
|
+
row: {
|
|
100
|
+
display: 'flex',
|
|
101
|
+
justifyContent: 'space-between',
|
|
102
|
+
width: '100%',
|
|
103
|
+
},
|
|
104
|
+
loader: function (bg, height, width) { return ({
|
|
105
|
+
width: width ? "".concat(width, "px") : '100%',
|
|
106
|
+
height: "".concat(height, "px"),
|
|
107
|
+
backgroundColor: bg,
|
|
108
|
+
borderRadius: '4px',
|
|
109
|
+
animation: 'pulse 1.5s infinite',
|
|
110
|
+
}); },
|
|
111
|
+
keyframes: "\n @keyframes pulse {\n 0%, 100% { opacity: 0.07; }\n 50% { opacity: 0.03; }\n }\n ",
|
|
112
|
+
};
|
|
18
113
|
//# sourceMappingURL=CoinflowPurchase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;AAoCA,wDAGC;AAED,4CAuBC;;AAhED,qDAA+C;AAC/C,mCAOkB;AAClB,mDAAkF;AAClF,2CAA0C;AAE1C,SAAS,mBAAmB,CAC1B,aAAoC,EACpC,OAAe;IAEf,IAAM,WAAW,GAAG,IAAA,eAAO,EAAsB;QAC/C,IAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAC;QACpD,6CACK,aAAa,KAChB,YAAY,cAAA,EACZ,KAAK,EAAE,mBAAY,OAAO,cAAI,aAAa,CAAC,UAAU,CAAE,EACxD,WAAW,EAAE,sBAAa,CAAC,cAAc,CAAC,aAAa,CAAC,IACxD;IACJ,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;IAE7B,IAAM,eAAe,GAAG,IAAA,eAAO,EAAwB;QACrD,6CACK,IAAA,oBAAW,EAAC,aAAa,CAAC,KAC7B,kBAAkB,EAAE,aAAa,CAAC,kBAAkB,IACpD;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,EAAC,WAAW,aAAA,EAAE,eAAe,iBAAA,EAAC,CAAC;AACxC,CAAC;AAED,SAAgB,sBAAsB,CAAC,aAAoC;IACnE,IAAA,KAAiC,mBAAmB,CAAC,aAAa,EAAE,EAAE,CAAC,EAAtE,WAAW,iBAAA,EAAE,eAAe,qBAA0C,CAAC;IAC9E,OAAO,8BAAC,+BAAc,uBAAK,WAAW,EAAM,eAAe,EAAI,CAAC;AAClE,CAAC;AAED,SAAgB,gBAAgB,CAAC,aAAoC;IACnE,IAAM,SAAS,GAAG,IAA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,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,aAAa,EAAE,QAAiB;QAChC,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,MAAM;KAChB,CAAC,EAfuB,CAevB;IACF,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,MAAM;QACX,KAAK,EAAE,MAAM;KACd;IACD,GAAG,EAAE;QACH,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,eAAe;QAC/B,KAAK,EAAE,MAAM;KACd;IACD,MAAM,EAAE,UAAC,EAAU,EAAE,MAAc,EAAE,KAAc,IAAK,OAAA,CAAC;QACvD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,UAAG,KAAK,OAAI,CAAC,CAAC,CAAC,MAAM;QACpC,MAAM,EAAE,UAAG,MAAM,OAAI;QACrB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,qBAAqB;KACjC,CAAC,EANsD,CAMtD;IACF,SAAS,EAAE,sGAKV;CACF,CAAC"}
|
|
@@ -10,7 +10,7 @@ function MobileWalletButton(_a) {
|
|
|
10
10
|
var props = _a.props, route = _a.route, overlayDisplayOverride = _a.overlayDisplayOverride, children = _a.children, alignItems = _a.alignItems;
|
|
11
11
|
var iframeRef = (0, react_1.useRef)(null);
|
|
12
12
|
var _b = (0, useOverlay_1.useOverlay)(iframeRef), opacity = _b.opacity, display = _b.display;
|
|
13
|
-
var onSuccess = props.onSuccess;
|
|
13
|
+
var onSuccess = props.onSuccess, onError = props.onError;
|
|
14
14
|
(0, react_1.useEffect)(function () {
|
|
15
15
|
if (!onSuccess)
|
|
16
16
|
return;
|
|
@@ -20,6 +20,10 @@ function MobileWalletButton(_a) {
|
|
|
20
20
|
.listenForMessage(function (data) {
|
|
21
21
|
try {
|
|
22
22
|
var res = JSON.parse(data);
|
|
23
|
+
if ('method' in res && res.data.startsWith('ERROR')) {
|
|
24
|
+
onError === null || onError === void 0 ? void 0 : onError(res.info);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
23
27
|
return 'method' in res && res.method === 'getToken';
|
|
24
28
|
}
|
|
25
29
|
catch (e) {
|
|
@@ -27,7 +31,7 @@ function MobileWalletButton(_a) {
|
|
|
27
31
|
}
|
|
28
32
|
})
|
|
29
33
|
.then(function (data) { return onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(data); });
|
|
30
|
-
}, [onSuccess]);
|
|
34
|
+
}, [onError, onSuccess]);
|
|
31
35
|
var iframeProps = (0, react_1.useMemo)(function () {
|
|
32
36
|
var walletPubkey = (0, common_1.getWalletPubkey)(props);
|
|
33
37
|
return tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: walletPubkey, transaction: undefined, routePrefix: 'form', route: "/".concat(route, "/").concat(props.merchantId) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileWalletButton.js","sourceRoot":"","sources":["../../src/MobileWalletButton.tsx"],"names":[],"mappings":";;AAWA,
|
|
1
|
+
{"version":3,"file":"MobileWalletButton.js","sourceRoot":"","sources":["../../src/MobileWalletButton.tsx"],"names":[],"mappings":";;AAWA,gDA4FC;;AAvGD,mCAMkB;AAClB,qDAAwD;AACxD,mDAAgF;AAChF,2CAAwC;AAExC,SAAgB,kBAAkB,CAAC,EAYlC;QAXC,KAAK,WAAA,EACL,KAAK,WAAA,EACL,sBAAsB,4BAAA,EACtB,QAAQ,cAAA,EACR,UAAU,gBAAA;IAQV,IAAM,SAAS,GAAG,IAAA,cAAM,EAAiC,IAAI,CAAC,CAAC;IACzD,IAAA,KAAqB,IAAA,uBAAU,EAAC,SAAS,CAAC,EAAzC,OAAO,aAAA,EAAE,OAAO,aAAyB,CAAC;IAE1C,IAAA,SAAS,GAAa,KAAK,UAAlB,EAAE,OAAO,GAAI,KAAK,QAAT,CAAU;IACnC,IAAA,iBAAS,EAA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AAkB,EAAE,KAAK,CAAC,kBAAkB,IAC5C;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CACL,uCACE,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,MAAM,EAAE,MAAM;SACf;QAED,uCACE,KAAK,EAAE;gBACL,eAAe,EAAE,KAAK,CAAC,KAAK;gBAC5B,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,MAAM;gBACd,QAAQ,EAAE,UAAU;gBACpB,GAAG,EAAE,CAAC;gBACN,MAAM,EAAE,CAAC;gBACT,IAAI,EAAE,CAAC;gBACP,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,OAAO;gBAC1C,OAAO,SAAA;gBACP,cAAc,EAAE,QAAQ;gBACxB,UAAU,YAAA;gBACV,aAAa,EAAE,MAAM;aACtB,IAEA,QAAQ,CACL;QACN,uCACE,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,MAAM;aACf;YAED,8BAAC,+BAAc,qBAAC,GAAG,EAAE,SAAS,IAAM,WAAW,EAAM,eAAe,EAAI,CACpE,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -23,7 +23,8 @@ declare enum IFrameMessageMethods {
|
|
|
23
23
|
SignTransaction = "signTransaction",
|
|
24
24
|
SendTransaction = "sendTransaction",
|
|
25
25
|
HeightChange = "heightChange",
|
|
26
|
-
Success = "success"
|
|
26
|
+
Success = "success",
|
|
27
|
+
Load = "load"
|
|
27
28
|
}
|
|
28
29
|
export declare function getWalletPubkey({ wallet, }: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined;
|
|
29
30
|
export declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers): Promise<string> | void;
|
|
@@ -13,6 +13,7 @@ var IFrameMessageMethods;
|
|
|
13
13
|
IFrameMessageMethods["SendTransaction"] = "sendTransaction";
|
|
14
14
|
IFrameMessageMethods["HeightChange"] = "heightChange";
|
|
15
15
|
IFrameMessageMethods["Success"] = "success";
|
|
16
|
+
IFrameMessageMethods["Load"] = "load";
|
|
16
17
|
})(IFrameMessageMethods || (IFrameMessageMethods = {}));
|
|
17
18
|
function getWalletPubkey(_a) {
|
|
18
19
|
var wallet = _a.wallet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";;AAsCA,0CAgBC;AAED,kDAmCC;AAED,kCAWC;;AAjGD,iDAA8C;AAE9C,mDAA8C;AAoB9C,IAAK,oBAOJ;AAPD,WAAK,oBAAoB;IACvB,mDAA2B,CAAA;IAC3B,2DAAmC,CAAA;IACnC,2DAAmC,CAAA;IACnC,qDAA6B,CAAA;IAC7B,2CAAmB,CAAA;IACnB,qCAAa,CAAA;AACf,CAAC,EAPI,oBAAoB,KAApB,oBAAoB,QAOxB;AAED,SAAgB,eAAe,CAAC,EAEQ;QADtC,MAAM,YAAA;IAEN,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAU,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IAED,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;QACxB,OAAO,MAAM,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,WAAW,IAAI,MAAM,EAAE,CAAC;QAC1B,OAAO,MAAM,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,mBAAmB,CACjC,UAAkB,EAClB,QAA+B;IAE/B,IAAI,UAAsB,CAAC;IAC3B,IAAI,CAAC;QACH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L,qBAAqB,EAAE,UAAO,WAAmB;;;;;wBACzC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBAChD,qBAAM,UAAU,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAA;;wBAAlE,gBAAgB,GAAG,SAA+C;wBACxE,IAAI,CAAC,gBAAgB;4BAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;wBAC/C,iBAAiB,GAAI,gBAAgB,YAApB,CAAqB;wBAC1D,sBAAO,iBAAiB,CAAC,IAAI,EAAC;;;aAC/B;QACD,SAAS,WAAA;KACV,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,EAGwB;IAHtD,iBAmBC;QAlBC,MAAM,YAAA,EACN,SAAS,eAAA;IAKT,IAAM,SAAS,GAAG,MAAmB,CAAC;IACtC,OAAO;QACL,qBAAqB,EAAE,UAAO,WAAmB;;;;;wBACzC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;wBACtD,qBAAM,SAAS,CAAC,eAAe,CAAC,EAAE,CAAC,EAAA;;wBAA3C,IAAI,GAAI,CAAA,SAAmC,CAAA,KAAvC;wBACX,sBAAO,IAAI,EAAC;;;aACb;QACD,iBAAiB,EAAE,UAAO,OAAe;;gBACvC,sBAAO,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,EAAC;;aACvC;QACD,SAAS,WAAA;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -169,6 +169,10 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
169
169
|
authOnly?: boolean;
|
|
170
170
|
deviceId?: string;
|
|
171
171
|
jwtToken?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Your company email address that the customer can contact.
|
|
174
|
+
*/
|
|
175
|
+
supportEmail?: string;
|
|
172
176
|
/**
|
|
173
177
|
* If rendering the Coinflow component within multiple nested iframes, all ancestors in the chain must be provided as a comma-separated list.
|
|
174
178
|
*
|
|
@@ -307,7 +311,7 @@ export interface TokenRedeem extends CommonEvmRedeem {
|
|
|
307
311
|
destination: string;
|
|
308
312
|
}
|
|
309
313
|
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
|
|
310
|
-
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
314
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference' | 'supportEmail'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
311
315
|
walletPubkey: string | null | undefined;
|
|
312
316
|
route: string;
|
|
313
317
|
routePrefix?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":";;;AAQA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAuND,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,2DAA6B,CAAA;IAC7B,qDAAuB,CAAA;AACzB,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;
|
|
1
|
+
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":";;;AAQA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,+BAAa,CAAA;AACf,CAAC,EAJW,cAAc,8BAAd,cAAc,QAIzB;AAED,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,gCAAe,CAAA;IACf,8BAAa,CAAA;AACf,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAuND,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,2DAA6B,CAAA;IAC7B,qDAAuB,CAAA;AACzB,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAmPD,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"}
|
|
@@ -9,7 +9,7 @@ export declare class CoinflowUtils {
|
|
|
9
9
|
}>;
|
|
10
10
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
11
11
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
12
|
-
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, }: CoinflowIFrameProps): string;
|
|
12
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, }: CoinflowIFrameProps): string;
|
|
13
13
|
static getTransaction(props: CoinflowPurchaseProps): string | undefined;
|
|
14
14
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
15
15
|
solana: T;
|
|
@@ -67,7 +67,7 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
67
67
|
};
|
|
68
68
|
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
69
69
|
var _b;
|
|
70
|
-
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss, color = _a.color, rent = _a.rent, lockDefaultToken = _a.lockDefaultToken, token = _a.token, tokens = _a.tokens, planCode = _a.planCode, disableApplePay = _a.disableApplePay, disableGooglePay = _a.disableGooglePay, customerInfo = _a.customerInfo, settlementType = _a.settlementType, lockAmount = _a.lockAmount, nativeSolToConvert = _a.nativeSolToConvert, theme = _a.theme, usePermit = _a.usePermit, transactionSigner = _a.transactionSigner, authOnly = _a.authOnly, deviceId = _a.deviceId, jwtToken = _a.jwtToken, origins = _a.origins, threeDsChallengePreference = _a.threeDsChallengePreference;
|
|
70
|
+
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, webhookInfo = _a.webhookInfo, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss, color = _a.color, rent = _a.rent, lockDefaultToken = _a.lockDefaultToken, token = _a.token, tokens = _a.tokens, planCode = _a.planCode, disableApplePay = _a.disableApplePay, disableGooglePay = _a.disableGooglePay, customerInfo = _a.customerInfo, settlementType = _a.settlementType, lockAmount = _a.lockAmount, nativeSolToConvert = _a.nativeSolToConvert, theme = _a.theme, usePermit = _a.usePermit, transactionSigner = _a.transactionSigner, authOnly = _a.authOnly, deviceId = _a.deviceId, jwtToken = _a.jwtToken, origins = _a.origins, threeDsChallengePreference = _a.threeDsChallengePreference, supportEmail = _a.supportEmail;
|
|
71
71
|
var prefix = routePrefix
|
|
72
72
|
? "/".concat(routePrefix, "/").concat(blockchain)
|
|
73
73
|
: "/".concat(blockchain);
|
|
@@ -91,6 +91,8 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
91
91
|
if (email) {
|
|
92
92
|
url.searchParams.append('email', email);
|
|
93
93
|
}
|
|
94
|
+
if (supportEmail)
|
|
95
|
+
url.searchParams.append('supportEmail', supportEmail);
|
|
94
96
|
if (token) {
|
|
95
97
|
url.searchParams.append('token', token.toString());
|
|
96
98
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../../src/common/CoinflowUtils.ts"],"names":[],"mappings":";;;;AAOA,mDAA8C;AAC9C,gEAAiC;AACjC,2CAA2E;AAC3E,uCAA+B;AAE/B;IAIE,uBAAY,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;aAC3D,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO;YAAE,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAAC;;YAC7D,IAAI,CAAC,GAAG,GAAG,sBAAe,IAAI,CAAC,GAAG,mBAAgB,CAAC;IAC1D,CAAC;IAEK,yCAAiB,GAAvB,UAAwB,UAAkB;;;gBACxC,sBAAO,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,yBAAkB,UAAU,CAAE,CAAC;yBACpD,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,IAAI,EAAE,EAAf,CAAe,CAAC;yBACjC,IAAI,CACH,UAAC,IAGA,YAAK,OAAA,CAAA,MAAA,IAAI,CAAC,aAAa,0CAAE,cAAc,KAAI,IAAI,CAAC,cAAc,CAAA,EAAA,CAChE;yBACA,KAAK,CAAC,UAAA,CAAC;wBACN,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;wBACjB,OAAO,SAAS,CAAC;oBACnB,CAAC,CAAC,EAAC;;;KACN;IAEK,wCAAgB,GAAtB,UACE,SAAiB,EACjB,UAAkB,EAClB,UAA6B;;;;;4BAEZ,qBAAM,KAAK,CAC1B,IAAI,CAAC,GAAG,G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|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { CoinflowPurchaseProps } from './common';
|
|
3
|
+
export declare function CoinflowPurchaseLegacy(purchaseProps: CoinflowPurchaseProps): React.JSX.Element;
|
|
3
4
|
export declare function CoinflowPurchase(purchaseProps: CoinflowPurchaseProps): React.JSX.Element;
|
|
@@ -1,15 +1,109 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
2
|
-
import React, { useMemo } from
|
|
1
|
+
import { __assign, __spreadArray } from "tslib";
|
|
2
|
+
import React, { useMemo, useRef } from "react";
|
|
3
3
|
import { CoinflowUtils, getHandlers, getWalletPubkey, } from './common';
|
|
4
|
-
import { CoinflowIFrame } from
|
|
5
|
-
|
|
4
|
+
import { CoinflowIFrame } from "./CoinflowIFrame";
|
|
5
|
+
import { useOverlay } from "./useOverlay";
|
|
6
|
+
function useCoinflowPurchase(purchaseProps, version) {
|
|
6
7
|
var iframeProps = useMemo(function () {
|
|
7
8
|
var walletPubkey = getWalletPubkey(purchaseProps);
|
|
8
|
-
return __assign(__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase/".concat(purchaseProps.merchantId), transaction: CoinflowUtils.getTransaction(purchaseProps) });
|
|
9
|
-
}, [purchaseProps]);
|
|
9
|
+
return __assign(__assign({}, purchaseProps), { walletPubkey: walletPubkey, route: "/purchase".concat(version, "/").concat(purchaseProps.merchantId), transaction: CoinflowUtils.getTransaction(purchaseProps) });
|
|
10
|
+
}, [purchaseProps, version]);
|
|
10
11
|
var messageHandlers = useMemo(function () {
|
|
11
12
|
return __assign(__assign({}, getHandlers(purchaseProps)), { handleHeightChange: purchaseProps.handleHeightChange });
|
|
12
13
|
}, [purchaseProps]);
|
|
14
|
+
return { iframeProps: iframeProps, messageHandlers: messageHandlers };
|
|
15
|
+
}
|
|
16
|
+
export function CoinflowPurchaseLegacy(purchaseProps) {
|
|
17
|
+
var _a = useCoinflowPurchase(purchaseProps, ''), iframeProps = _a.iframeProps, messageHandlers = _a.messageHandlers;
|
|
13
18
|
return React.createElement(CoinflowIFrame, __assign({}, iframeProps, messageHandlers));
|
|
14
19
|
}
|
|
20
|
+
export function CoinflowPurchase(purchaseProps) {
|
|
21
|
+
var iframeRef = useRef(null);
|
|
22
|
+
var _a = useCoinflowPurchase(purchaseProps, '-v2'), iframeProps = _a.iframeProps, messageHandlers = _a.messageHandlers;
|
|
23
|
+
var showOverlay = useOverlay(iframeRef).showOverlay;
|
|
24
|
+
var loaderBackground = iframeProps.loaderBackground || '#ffffff'; // white default bg
|
|
25
|
+
var invertedColor = invertHexColor(loaderBackground);
|
|
26
|
+
return (React.createElement("div", { style: styles.container(loaderBackground) },
|
|
27
|
+
React.createElement(CoinflowIFrame, __assign({ ref: iframeRef }, iframeProps, messageHandlers)),
|
|
28
|
+
showOverlay && (React.createElement(LoaderOverlay, { loaderBackground: loaderBackground, invertedColor: invertedColor }))));
|
|
29
|
+
}
|
|
30
|
+
function LoaderOverlay(_a) {
|
|
31
|
+
var loaderBackground = _a.loaderBackground, invertedColor = _a.invertedColor;
|
|
32
|
+
return (React.createElement("div", { style: styles.overlay(loaderBackground) },
|
|
33
|
+
React.createElement(LoaderGrid, { columns: 2 },
|
|
34
|
+
React.createElement(Loader, { loaderBackground: invertedColor }),
|
|
35
|
+
React.createElement(Loader, { loaderBackground: invertedColor })),
|
|
36
|
+
React.createElement(LoaderGrid, { columns: 1 },
|
|
37
|
+
React.createElement(Loader, { height: 80, loaderBackground: invertedColor })),
|
|
38
|
+
__spreadArray([], Array(3), true).map(function (_, index) { return (React.createElement(LoaderRow, { key: index },
|
|
39
|
+
React.createElement(Loader, { width: index < 2 ? 80 : 120, height: index < 2 ? 15 : 20, loaderBackground: invertedColor }),
|
|
40
|
+
React.createElement(Loader, { width: index < 2 ? 60 : 100, height: index < 2 ? 15 : 20, loaderBackground: invertedColor }))); }),
|
|
41
|
+
React.createElement(LoaderGrid, { columns: 1 },
|
|
42
|
+
React.createElement(Loader, { height: 60, loaderBackground: invertedColor })),
|
|
43
|
+
React.createElement(LoaderGrid, { columns: 1, width: "50%" },
|
|
44
|
+
React.createElement(Loader, { height: 10, loaderBackground: invertedColor })),
|
|
45
|
+
React.createElement(LoaderGrid, { columns: 1, width: "40%" },
|
|
46
|
+
React.createElement(Loader, { height: 6, loaderBackground: invertedColor }))));
|
|
47
|
+
}
|
|
48
|
+
function LoaderGrid(_a) {
|
|
49
|
+
var children = _a.children, columns = _a.columns, _b = _a.width, width = _b === void 0 ? '100%' : _b;
|
|
50
|
+
return (React.createElement("div", { style: __assign(__assign({}, styles.grid), { gridTemplateColumns: "repeat(".concat(columns, ", 1fr)"), width: width }) }, children));
|
|
51
|
+
}
|
|
52
|
+
function LoaderRow(_a) {
|
|
53
|
+
var children = _a.children;
|
|
54
|
+
return React.createElement("div", { style: styles.row }, children);
|
|
55
|
+
}
|
|
56
|
+
function Loader(_a) {
|
|
57
|
+
var loaderBackground = _a.loaderBackground, _b = _a.height, height = _b === void 0 ? 40 : _b, width = _a.width;
|
|
58
|
+
return (React.createElement(React.Fragment, null,
|
|
59
|
+
React.createElement("div", { style: styles.loader(loaderBackground, height, width) }),
|
|
60
|
+
React.createElement("style", null, styles.keyframes)));
|
|
61
|
+
}
|
|
62
|
+
function invertHexColor(hex) {
|
|
63
|
+
var _a;
|
|
64
|
+
hex = hex.replace(/^#/, '');
|
|
65
|
+
var rgb = ((_a = hex.match(/.{2}/g)) === null || _a === void 0 ? void 0 : _a.map(function (val) { return 255 - parseInt(val, 16); })) || [];
|
|
66
|
+
return "#".concat(rgb.map(function (val) { return val.toString(16).padStart(2, '0'); }).join(''));
|
|
67
|
+
}
|
|
68
|
+
var styles = {
|
|
69
|
+
container: function (bg) { return ({
|
|
70
|
+
position: 'relative',
|
|
71
|
+
height: '100%',
|
|
72
|
+
backgroundColor: bg,
|
|
73
|
+
}); },
|
|
74
|
+
overlay: function (bg) { return ({
|
|
75
|
+
backgroundColor: bg,
|
|
76
|
+
display: 'flex',
|
|
77
|
+
color: 'gray',
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
top: 0,
|
|
80
|
+
left: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
bottom: 0,
|
|
83
|
+
fontSize: 24,
|
|
84
|
+
alignItems: 'center',
|
|
85
|
+
flexDirection: 'column',
|
|
86
|
+
gap: '20px',
|
|
87
|
+
zIndex: 10,
|
|
88
|
+
padding: '20px',
|
|
89
|
+
}); },
|
|
90
|
+
grid: {
|
|
91
|
+
display: 'grid',
|
|
92
|
+
gap: '20px',
|
|
93
|
+
width: '100%',
|
|
94
|
+
},
|
|
95
|
+
row: {
|
|
96
|
+
display: 'flex',
|
|
97
|
+
justifyContent: 'space-between',
|
|
98
|
+
width: '100%',
|
|
99
|
+
},
|
|
100
|
+
loader: function (bg, height, width) { return ({
|
|
101
|
+
width: width ? "".concat(width, "px") : '100%',
|
|
102
|
+
height: "".concat(height, "px"),
|
|
103
|
+
backgroundColor: bg,
|
|
104
|
+
borderRadius: '4px',
|
|
105
|
+
animation: 'pulse 1.5s infinite',
|
|
106
|
+
}); },
|
|
107
|
+
keyframes: "\n @keyframes pulse {\n 0%, 100% { opacity: 0.07; }\n 50% { opacity: 0.03; }\n }\n ",
|
|
108
|
+
};
|
|
15
109
|
//# sourceMappingURL=CoinflowPurchase.js.map
|