@coinflowlabs/react 2.3.2 → 2.5.0
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 +13 -0
- package/build/cjs/CoinflowCardForm.d.ts +39 -0
- package/build/cjs/CoinflowCardForm.js +119 -0
- package/build/cjs/CoinflowCardForm.js.map +1 -0
- package/build/cjs/CoinflowPurchase.d.ts +2 -2
- package/build/cjs/CoinflowPurchase.js +5 -4
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.js +3 -2
- package/build/cjs/CoinflowPurchaseHistory.js.map +1 -1
- package/build/cjs/CoinflowTypes.d.ts +39 -7
- package/build/cjs/CoinflowUtils.d.ts +1 -1
- package/build/cjs/CoinflowUtils.js +5 -2
- package/build/cjs/CoinflowUtils.js.map +1 -1
- package/build/cjs/index.d.ts +1 -0
- package/build/cjs/index.js +1 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/wallet/useIframeWallet.d.ts +2 -1
- package/build/cjs/wallet/useIframeWallet.js +4 -3
- package/build/cjs/wallet/useIframeWallet.js.map +1 -1
- package/build/esm/CoinflowCardForm.d.ts +39 -0
- package/build/esm/CoinflowCardForm.js +116 -0
- package/build/esm/CoinflowCardForm.js.map +1 -0
- package/build/esm/CoinflowPurchase.d.ts +2 -2
- package/build/esm/CoinflowPurchase.js +3 -2
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.js +3 -2
- package/build/esm/CoinflowPurchaseHistory.js.map +1 -1
- package/build/esm/CoinflowTypes.d.ts +39 -7
- package/build/esm/CoinflowUtils.d.ts +1 -1
- package/build/esm/CoinflowUtils.js +5 -2
- package/build/esm/CoinflowUtils.js.map +1 -1
- package/build/esm/index.d.ts +1 -0
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/wallet/useIframeWallet.d.ts +2 -1
- package/build/esm/wallet/useIframeWallet.js +2 -2
- package/build/esm/wallet/useIframeWallet.js.map +1 -1
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -46,6 +46,19 @@ Props:
|
|
|
46
46
|
|
|
47
47
|
# Changelog
|
|
48
48
|
|
|
49
|
+
### 2.5.0
|
|
50
|
+
|
|
51
|
+
- 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.
|
|
52
|
+
|
|
53
|
+
### 2.4.0
|
|
54
|
+
|
|
55
|
+
- Added support for Ethereum Mainnet
|
|
56
|
+
|
|
57
|
+
### 2.3.2
|
|
58
|
+
|
|
59
|
+
- Added typing for `ChargebackProtectionData`
|
|
60
|
+
- Added `token` prop for `CoinflowPurchase` with polygon
|
|
61
|
+
|
|
49
62
|
### 2.3.0
|
|
50
63
|
|
|
51
64
|
Support Versioned Transactions in CoinflowPurchase
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { CoinflowBlockchain, CoinflowEnvs } from './CoinflowTypes';
|
|
3
|
+
export type CoinflowCardTokenResponse = {
|
|
4
|
+
last4: string;
|
|
5
|
+
type: 'VISA' | 'MSTR' | 'AMEX' | 'DISC';
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
8
|
+
export interface CoinflowCardFormProps {
|
|
9
|
+
merchantId: string;
|
|
10
|
+
walletPubkey?: string;
|
|
11
|
+
handleHeightChange?: (height: string) => void;
|
|
12
|
+
env: CoinflowEnvs;
|
|
13
|
+
inputCss?: CSSProperties;
|
|
14
|
+
customCss?: {
|
|
15
|
+
[key: string]: CSSProperties;
|
|
16
|
+
};
|
|
17
|
+
blockchain: CoinflowBlockchain;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive a token for use with the `/api/checkout/token` endpoint.
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const ref = useRef<{getToken(): Promise<{token: string}>}>();
|
|
25
|
+
*
|
|
26
|
+
* <CoinflowCardForm
|
|
27
|
+
* ref={coinflowCardFormRef}
|
|
28
|
+
* ...
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* <button onClick={() => {
|
|
32
|
+
* ref.current?.getToken()
|
|
33
|
+
* .then(({token}) => console.log(token))
|
|
34
|
+
* .catch(e => console.error('GET TOKEN ERROR', e))
|
|
35
|
+
* }}>Get Token</button>
|
|
36
|
+
*
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const CoinflowCardForm: React.ForwardRefExoticComponent<CoinflowCardFormProps & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoinflowCardForm = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var useIframeWallet_1 = require("./wallet/useIframeWallet");
|
|
7
|
+
var CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
8
|
+
/**
|
|
9
|
+
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive a token for use with the `/api/checkout/token` endpoint.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const ref = useRef<{getToken(): Promise<{token: string}>}>();
|
|
14
|
+
*
|
|
15
|
+
* <CoinflowCardForm
|
|
16
|
+
* ref={coinflowCardFormRef}
|
|
17
|
+
* ...
|
|
18
|
+
* />
|
|
19
|
+
*
|
|
20
|
+
* <button onClick={() => {
|
|
21
|
+
* ref.current?.getToken()
|
|
22
|
+
* .then(({token}) => console.log(token))
|
|
23
|
+
* .catch(e => console.error('GET TOKEN ERROR', e))
|
|
24
|
+
* }}>Get Token</button>
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
exports.CoinflowCardForm = (0, react_1.forwardRef)(function (_a, ref) {
|
|
29
|
+
var handleHeightChange = _a.handleHeightChange, walletPubkey = _a.walletPubkey, env = _a.env, customCss = _a.customCss, merchantId = _a.merchantId, blockchain = _a.blockchain;
|
|
30
|
+
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)({
|
|
31
|
+
handleSendTransaction: function () { return Promise.resolve(''); },
|
|
32
|
+
}, {
|
|
33
|
+
handleHeightChange: handleHeightChange,
|
|
34
|
+
env: env,
|
|
35
|
+
}, walletPubkey).IFrameRef;
|
|
36
|
+
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
37
|
+
getToken: function () {
|
|
38
|
+
var _a;
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
40
|
+
return tslib_1.__generator(this, function (_b) {
|
|
41
|
+
if (!((_a = IFrameRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow))
|
|
42
|
+
throw new Error('content window not found');
|
|
43
|
+
IFrameRef.current.contentWindow.postMessage('getToken', '*');
|
|
44
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
45
|
+
var handleIframeMessage = function (_a) {
|
|
46
|
+
var incomingData = _a.data;
|
|
47
|
+
if (origin === 'https://cdn.plaid.com')
|
|
48
|
+
return;
|
|
49
|
+
if (typeof incomingData !== 'string')
|
|
50
|
+
return;
|
|
51
|
+
var parsedData = (0, useIframeWallet_1.parseIframeMessageJSON)(incomingData);
|
|
52
|
+
if (!parsedData)
|
|
53
|
+
return;
|
|
54
|
+
var method = parsedData.method, data = parsedData.data;
|
|
55
|
+
switch (method) {
|
|
56
|
+
case 'heightChange':
|
|
57
|
+
if (handleHeightChange)
|
|
58
|
+
handleHeightChange(data);
|
|
59
|
+
return;
|
|
60
|
+
case 'getToken':
|
|
61
|
+
if (data.startsWith('ERROR')) {
|
|
62
|
+
reject(new Error(data.replace('ERROR', '')));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
resolve(JSON.parse(data));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
if (!window)
|
|
69
|
+
throw new Error('Window not defined');
|
|
70
|
+
window.onmessage = handleIframeMessage;
|
|
71
|
+
})];
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}); });
|
|
76
|
+
var merchantCss = (0, react_1.useMemo)(function () {
|
|
77
|
+
if (!customCss)
|
|
78
|
+
return undefined;
|
|
79
|
+
var cssStr = Object.entries(customCss).reduce(function (acc, _a) {
|
|
80
|
+
var key = _a[0], value = _a[1];
|
|
81
|
+
return acc + "".concat(key, " {").concat(CSSPropertiesToComponent(value), "}\n");
|
|
82
|
+
}, '');
|
|
83
|
+
return Buffer.from(cssStr).toString('base64');
|
|
84
|
+
}, [customCss]);
|
|
85
|
+
if (!walletPubkey)
|
|
86
|
+
return null;
|
|
87
|
+
var iFrameProps = {
|
|
88
|
+
walletPubkey: walletPubkey,
|
|
89
|
+
blockchain: blockchain,
|
|
90
|
+
route: "/checkout-form/".concat(merchantId),
|
|
91
|
+
env: env,
|
|
92
|
+
IFrameRef: IFrameRef,
|
|
93
|
+
routePrefix: 'form',
|
|
94
|
+
merchantCss: merchantCss,
|
|
95
|
+
handleHeightChange: handleHeightChange,
|
|
96
|
+
};
|
|
97
|
+
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iFrameProps));
|
|
98
|
+
});
|
|
99
|
+
function CSSPropertiesToComponent(dict) {
|
|
100
|
+
var str = '';
|
|
101
|
+
var _loop_1 = function (key, value) {
|
|
102
|
+
var clo = '';
|
|
103
|
+
key.split('').forEach(function (lt) {
|
|
104
|
+
if (lt.toUpperCase() === lt) {
|
|
105
|
+
clo += '-' + lt.toLowerCase();
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
clo += lt;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
str += clo + ':' + value + ';';
|
|
112
|
+
};
|
|
113
|
+
for (var _i = 0, _a = Object.entries(dict); _i < _a.length; _i++) {
|
|
114
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
115
|
+
_loop_1(key, value);
|
|
116
|
+
}
|
|
117
|
+
return str;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=CoinflowCardForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinflowCardForm.js","sourceRoot":"","sources":["../../src/CoinflowCardForm.tsx"],"names":[],"mappings":";;;;AAAA,qDAAqF;AACrF,4DAAiF;AACjF,mDAAgD;AAmBhD;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,gBAAgB,GAAG,IAAA,kBAAU,EAAC,UAAC,EAAiG,EAAE,GAAG;QAArG,kBAAkB,wBAAA,EAAE,YAAY,kBAAA,EAAE,GAAG,SAAA,EAAE,SAAS,eAAA,EAAE,UAAU,gBAAA,EAAE,UAAU,gBAAA;IAC5G,IAAA,SAAS,GAAI,IAAA,iCAAe,EACjC;QACE,qBAAqB,EAAE,cAAM,OAAA,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,EAAnB,CAAmB;KACjD,EACD;QACE,kBAAkB,oBAAA;QAClB,GAAG,KAAA;KACJ,EACD,YAAY,CACb,UATe,CASd;IAEF,IAAA,2BAAmB,EAAC,GAAG,EAAE,cAAM,OAAA,CAAC;QACxB,QAAQ;;;;oBACZ,IAAI,CAAC,CAAA,MAAA,SAAS,CAAC,OAAO,0CAAE,aAAa,CAAA;wBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;oBAEnF,SAAS,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;oBAC7D,sBAAO,IAAI,OAAO,CAA4B,UAAC,OAAO,EAAE,MAAM;4BAC5D,IAAM,mBAAmB,GAAG,UAAC,EAAqC;oCAA9B,YAAY,UAAA;gCAC9C,IAAI,MAAM,KAAK,uBAAuB;oCAAE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inflowTypes';
|
|
3
3
|
export declare function CoinflowPurchase(props: CoinflowPurchaseProps): React.JSX.Element;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function EvmCoinflowPurchase(props: CoinflowEvmPurchaseProps): React.JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EvmCoinflowPurchase = exports.CoinflowPurchase = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
6
|
var CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
@@ -13,7 +13,8 @@ function CoinflowPurchase(props) {
|
|
|
13
13
|
return CoinflowUtils_1.CoinflowUtils.byBlockchain(props.blockchain, {
|
|
14
14
|
solana: (react_1.default.createElement(SolanaCoinflowPurchase, tslib_1.__assign({}, props))),
|
|
15
15
|
near: react_1.default.createElement(NearCoinflowPurchase, tslib_1.__assign({}, props)),
|
|
16
|
-
polygon: (react_1.default.createElement(
|
|
16
|
+
polygon: (react_1.default.createElement(EvmCoinflowPurchase, tslib_1.__assign({}, props))),
|
|
17
|
+
eth: (react_1.default.createElement(EvmCoinflowPurchase, tslib_1.__assign({}, props)))
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
exports.CoinflowPurchase = CoinflowPurchase;
|
|
@@ -55,7 +56,7 @@ function NearCoinflowPurchase(props) {
|
|
|
55
56
|
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: wallet.accountId, IFrameRef: IFrameRef, transaction: transaction, route: "/purchase/".concat(props.merchantId), nearDeposit: props.nearDeposit });
|
|
56
57
|
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps));
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function EvmCoinflowPurchase(props) {
|
|
59
60
|
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
60
61
|
var transaction = props.transaction, wallet = props.wallet;
|
|
61
62
|
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, wallet.address).IFrameRef;
|
|
@@ -69,5 +70,5 @@ function PolygonCoinflowPurchase(props) {
|
|
|
69
70
|
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: wallet.address, IFrameRef: IFrameRef, transaction: transactionStr, route: "/purchase/".concat(props.merchantId) });
|
|
70
71
|
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps));
|
|
71
72
|
}
|
|
72
|
-
exports.
|
|
73
|
+
exports.EvmCoinflowPurchase = EvmCoinflowPurchase;
|
|
73
74
|
//# sourceMappingURL=CoinflowPurchase.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;;;AAAA,qDAAqC;AACrC,mDAAgD;AAChD,oFAAoF;AACpF,iDAA8C;AAC9C,4DAAyD;AACzD,gFAAgF;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;;;AAAA,qDAAqC;AACrC,mDAAgD;AAChD,oFAAoF;AACpF,iDAA8C;AAC9C,4DAAyD;AACzD,gFAAgF;AAUhF,8EAA8E;AAE9E,SAAgB,gBAAgB,CAAC,KAA4B;IAC3D,OAAO,6BAAa,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE;QAClD,MAAM,EAAE,CACN,8BAAC,sBAAsB,uBAAM,KAAqC,EAAI,CACvE;QACD,IAAI,EAAE,8BAAC,oBAAoB,uBAAM,KAAmC,EAAI;QACxE,OAAO,EAAE,CACP,8BAAC,mBAAmB,uBAAM,KAAsC,EAAI,CACrE;QACD,GAAG,EAAE,CACH,8BAAC,mBAAm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CAAC,UAApD,CAAqD;IAErE,IAAM,cAAc,GAAG,IAAA,eAAO,EAAC;QAC7B,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QACnC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAEjC,IAAM,WAAW,yCACZ,KAAK,KACR,YAAY,EAAE,MAAM,CAAC,OAAO,EAC5B,SAAS,WAAA,EACT,WAAW,EAAE,cAAc,EAC3B,KAAK,EAAE,oBAAa,KAAK,CAAC,UAAU,CAAE,GACvC,CAAC;IACF,OAAO,8BAAC,+BAAc,uBAAK,WAAW,EAAI,CAAC;AAC7C,CAAC;AApBD,kDAoBC"}
|
|
@@ -13,7 +13,8 @@ function CoinflowPurchaseHistory(props) {
|
|
|
13
13
|
return CoinflowUtils_1.CoinflowUtils.byBlockchain(props.blockchain, {
|
|
14
14
|
solana: (react_1.default.createElement(SolanaPurchaseHistory, tslib_1.__assign({}, props))),
|
|
15
15
|
near: react_1.default.createElement(NearPurchaseHistory, tslib_1.__assign({}, props)),
|
|
16
|
-
polygon: react_1.default.createElement(
|
|
16
|
+
polygon: react_1.default.createElement(EvmPurchaseHistory, tslib_1.__assign({}, props)),
|
|
17
|
+
eth: react_1.default.createElement(EvmPurchaseHistory, tslib_1.__assign({}, props)),
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
exports.CoinflowPurchaseHistory = CoinflowPurchaseHistory;
|
|
@@ -37,7 +38,7 @@ function NearPurchaseHistory(props) {
|
|
|
37
38
|
var iframeProps = tslib_1.__assign(tslib_1.__assign({}, props), { walletPubkey: props.wallet.accountId, IFrameRef: IFrameRef, route: "/history/purchase/".concat(props.merchantId) });
|
|
38
39
|
return (react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, tslib_1.__assign({}, iframeProps)));
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function EvmPurchaseHistory(props) {
|
|
41
42
|
var _a, _b, _c;
|
|
42
43
|
var handlers = (0, EthIFrameMessageHandlers_1.useEthIFrameMessageHandlers)(props);
|
|
43
44
|
var IFrameRef = (0, useIframeWallet_1.useIframeWallet)(handlers, props, (_a = props.wallet) === null || _a === void 0 ? void 0 : _a.address).IFrameRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";;;;AAAA,4DAAyD;AACzD,mDAAgD;AAChD,wDAA0B;AAC1B,oFAAoF;AACpF,gFAAgF;AAChF,iDAA8C;
|
|
1
|
+
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";;;;AAAA,4DAAyD;AACzD,mDAAgD;AAChD,wDAA0B;AAC1B,oFAAoF;AACpF,gFAAgF;AAChF,iDAA8C;AAS9C,8EAA8E;AAE9E,SAAgB,uBAAuB,CACrC,KAA2B;IAE3B,OAAO,6BAAa,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,EAAE;QAClD,MAAM,EAAE,CACN,8BAAC,qBAAqB,uBAAM,KAAoC,EAAI,CACrE;QACD,IAAI,EAAE,8BAAC,mBAAmB,uBAAM,KAAkC,EAAI;QACtE,OAAO,EAAE,8BAAC,kBAAkB,uBAAM,KAAqC,EAAI;QAC3E,GAAG,EAAE,8BAAC,kBAAkB,uBAAM,KAAiC,EAAI;KACpE,CAAC,CAAC;AACL,CAAC;AAXD,0DAWC;AAED,SAAS,qBAAqB,CAAC,KAAiC;;IAC9D,IAAM,QAAQ,GAAG,IAAA,4DAA8B,EAAC,KAAK,CAAC,CAAC;IAChD,IAAA,MAAM,GAAI,KAAK,OAA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AAC,UAA3D,CAA4D;IAE5E,IAAI,CAAC,CAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,OAAO,CAAA;QAAE,OAAO,IAAI,CAAC;IAExC,IAAM,WAAW,yCACZ,KAAK,KACR,YAAY,EAAE,MAAA,KAAK,CAAC,MAAM,0CAAE,OAAO,EACnC,SAAS,WAAA,EACT,KAAK,EAAE,4BAAqB,KAAK,CAAC,UAAU,CAAE,GAC/C,CAAC;IACF,OAAO,CACL,8BAAC,+BAAc,uBAAK,WAAW,EAAI,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -58,24 +58,27 @@ export interface CoinflowNearHistoryProps extends CoinflowTypes {
|
|
|
58
58
|
wallet: NearWallet;
|
|
59
59
|
blockchain: 'near';
|
|
60
60
|
}
|
|
61
|
-
export interface
|
|
61
|
+
export interface CoinflowEvmHistoryProps extends CoinflowTypes {
|
|
62
62
|
wallet: EthWallet;
|
|
63
|
+
}
|
|
64
|
+
export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
|
|
63
65
|
blockchain: 'eth';
|
|
64
66
|
}
|
|
65
|
-
export interface CoinflowPolygonHistoryProps extends
|
|
66
|
-
wallet: EthWallet;
|
|
67
|
+
export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
67
68
|
blockchain: 'polygon';
|
|
68
69
|
}
|
|
69
|
-
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps;
|
|
70
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps;
|
|
70
71
|
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets'> {
|
|
71
72
|
walletPubkey: string;
|
|
72
73
|
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
73
74
|
route: string;
|
|
75
|
+
routePrefix?: string;
|
|
74
76
|
transaction?: string;
|
|
75
77
|
token?: string | PublicKey;
|
|
76
78
|
email?: string;
|
|
77
79
|
supportsVersionedTransactions?: boolean;
|
|
78
80
|
nearDeposit?: string;
|
|
81
|
+
merchantCss?: string;
|
|
79
82
|
}
|
|
80
83
|
/** Transactions **/
|
|
81
84
|
export type NearFtTransferCallAction = {
|
|
@@ -103,7 +106,30 @@ export type EvmTransaction = {
|
|
|
103
106
|
ccipReadEnabled?: boolean;
|
|
104
107
|
};
|
|
105
108
|
/** Purchase **/
|
|
106
|
-
type ChargebackProtectionData =
|
|
109
|
+
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
110
|
+
export interface ChargebackProtectionItem {
|
|
111
|
+
/**
|
|
112
|
+
* The name of the product
|
|
113
|
+
*/
|
|
114
|
+
productName: string;
|
|
115
|
+
/**
|
|
116
|
+
* The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp
|
|
117
|
+
*/
|
|
118
|
+
productType: 'inGameProduct' | 'gameOfSkill' | 'dataStorage' | 'computingResources' | 'sportsTicket' | 'eSportsTicket' | 'musicTicket' | 'conferenceTicket' | 'virtualSportsTicket' | 'virtualESportsTicket' | 'virtualMusicTicket' | 'virtualConferenceTicket' | 'alcohol' | 'DLC' | 'subscription' | 'fundACause' | 'realEstate' | 'computingContract' | 'digitalArt' | 'topUp';
|
|
119
|
+
/**
|
|
120
|
+
* The item's list price
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* The number of units sold
|
|
124
|
+
*/
|
|
125
|
+
quantity: number;
|
|
126
|
+
/**
|
|
127
|
+
* Any additional data that the store can provide on the product, e.g. description, link to image, etc.
|
|
128
|
+
*/
|
|
129
|
+
rawProductData?: {
|
|
130
|
+
[key: string]: any;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
107
133
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
108
134
|
amount?: number;
|
|
109
135
|
onSuccess?: OnSuccessMethod;
|
|
@@ -127,12 +153,18 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
|
127
153
|
action?: NearFtTransferCallAction;
|
|
128
154
|
nearDeposit?: string;
|
|
129
155
|
}
|
|
130
|
-
export interface
|
|
156
|
+
export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
131
157
|
transaction?: EvmTransaction;
|
|
158
|
+
token?: string;
|
|
132
159
|
wallet: EthWallet;
|
|
160
|
+
}
|
|
161
|
+
export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
133
162
|
blockchain: 'polygon';
|
|
134
163
|
}
|
|
135
|
-
export
|
|
164
|
+
export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
165
|
+
blockchain: 'eth';
|
|
166
|
+
}
|
|
167
|
+
export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps;
|
|
136
168
|
/** Withdraw **/
|
|
137
169
|
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
138
170
|
onSuccess?: OnSuccessMethod;
|
|
@@ -8,7 +8,7 @@ export declare class CoinflowUtils {
|
|
|
8
8
|
getCreditBalance(publicKey: string, blockchain: 'solana' | 'near'): Promise<number>;
|
|
9
9
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
10
10
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
11
|
-
static getCoinflowUrl({ walletPubkey, route, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, token, email, loaderBackground, handleHeightChange, useSocket, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, }: CoinflowIFrameProps): string;
|
|
11
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, token, email, loaderBackground, handleHeightChange, useSocket, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, }: CoinflowIFrameProps): string;
|
|
12
12
|
static serializeSolanaTransaction(transaction: Transaction | VersionedTransaction | undefined): string | undefined;
|
|
13
13
|
static solanaWalletSupportsVersionedTransactions(wallet: SolanaWallet): boolean;
|
|
14
14
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
@@ -61,8 +61,9 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
61
61
|
};
|
|
62
62
|
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
63
63
|
var _b;
|
|
64
|
-
var walletPubkey = _a.walletPubkey, route = _a.route, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, useSocket = _a.useSocket, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData;
|
|
65
|
-
var
|
|
64
|
+
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, useSocket = _a.useSocket, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss;
|
|
65
|
+
var prefix = routePrefix ? "/".concat(routePrefix, "/").concat(blockchain) : "/".concat(blockchain);
|
|
66
|
+
var url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));
|
|
66
67
|
url.searchParams.append('pubkey', walletPubkey);
|
|
67
68
|
if (transaction) {
|
|
68
69
|
url.searchParams.append('transaction', transaction);
|
|
@@ -104,6 +105,8 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
104
105
|
var deviceId = (_b = window === null || window === void 0 ? void 0 : window.nSureSDK) === null || _b === void 0 ? void 0 : _b.getDeviceId();
|
|
105
106
|
if (deviceId)
|
|
106
107
|
url.searchParams.append('deviceId', deviceId);
|
|
108
|
+
if (merchantCss)
|
|
109
|
+
url.searchParams.append('merchantCss', merchantCss);
|
|
107
110
|
return url.toString();
|
|
108
111
|
};
|
|
109
112
|
CoinflowUtils.serializeSolanaTransaction = function (transaction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";;;;AACA,sDAA0B;AAQ1B;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,mCAAW,GAAjB,UAAkB,UAAkB;;;;;4BACjB,qBAAM,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,yBAAkB,UAAU,CAAE,CAAC,EAAA;;wBAAjE,QAAQ,GAAG,SAAsD;wBAC1D,qBAAM,QAAQ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AQ,EAAE,CAAC;IACxB,CAAC;IAEM,wCAA0B,GAAjC,UACE,WAA2D;QAE3D,IAAI,CAAC,WAAW;YAAE,OAAO,SAAS,CAAC;QAEnC,IAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC;YACzC,oBAAoB,EAAE,KAAK;YAC3B,gBAAgB,EAAE,KAAK;SACxB,CAAC,CAAC;QACH,OAAO,cAAM,CAAC,MAAM,CAAC,YAA0B,CAAC,CAAC;IACnD,CAAC;IAEM,uDAAyC,GAAhD,UACE,MAAoB;;QAEpB,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,0CAAE,4BAA4B,0CAAE,GAAG,CAAC,CAAC,CAAC,CAAA,CAAC;IACxE,CAAC;IAEM,0BAAY,GAAnB,UACE,UAA8B,EAC9B,IAA+C;QAE/C,QAAQ,UAAU,EAAE;YAClB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;oBACxB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBAClE,OAAO,IAAI,CAAC,GAAG,CAAC;YAClB;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AA1KD,IA0KC;AA1KY,sCAAa"}
|
package/build/cjs/index.d.ts
CHANGED
package/build/cjs/index.js
CHANGED
|
@@ -10,4 +10,5 @@ tslib_1.__exportStar(require("./CoinflowPurchaseHistory"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./CoinflowWithdrawHistory"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./CoinflowTypes"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./CoinflowPurchaseProtection"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./CoinflowCardForm"), exports);
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6DAAmC;AACnC,0DAAgC;AAChC,mEAAyC;AACzC,2DAAiC;AACjC,oEAA0C;AAC1C,oEAA0C;AAC1C,0DAAgC;AAChC,uEAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6DAAmC;AACnC,0DAAgC;AAChC,mEAAyC;AACzC,2DAAiC;AACjC,oEAA0C;AAC1C,oEAA0C;AAC1C,0DAAgC;AAChC,uEAA6C;AAC7C,6DAAmC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
2
|
+
import { IFrameMessageHandlers, WalletCall } from './SolanaIFrameMessageHandlers';
|
|
3
3
|
import { CoinflowEnvs, OnSuccessMethod } from '../CoinflowTypes';
|
|
4
4
|
export declare function useIframeWallet({ handleSignTransaction, handleSendTransaction, handleSignMessage, }: IFrameMessageHandlers, { onSuccess, handleHeightChange, useSocket, env }: {
|
|
5
5
|
onSuccess?: OnSuccessMethod;
|
|
@@ -9,3 +9,4 @@ export declare function useIframeWallet({ handleSignTransaction, handleSendTrans
|
|
|
9
9
|
}, walletPubkey: string | null | undefined): {
|
|
10
10
|
IFrameRef: import("react").MutableRefObject<HTMLIFrameElement | null>;
|
|
11
11
|
};
|
|
12
|
+
export declare function parseIframeMessageJSON(data: string): WalletCall | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIframeWallet = void 0;
|
|
3
|
+
exports.parseIframeMessageJSON = exports.useIframeWallet = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
var SocketService_1 = require("./SocketService");
|
|
@@ -29,7 +29,7 @@ function useIframeWallet(_a, _b, walletPubkey) {
|
|
|
29
29
|
switch (_c.label) {
|
|
30
30
|
case 0:
|
|
31
31
|
_c.trys.push([0, 11, , 12]);
|
|
32
|
-
parsedData =
|
|
32
|
+
parsedData = parseIframeMessageJSON(data);
|
|
33
33
|
if (!parsedData)
|
|
34
34
|
return [2 /*return*/];
|
|
35
35
|
_b = parsedData.method;
|
|
@@ -114,7 +114,7 @@ function useIframeWallet(_a, _b, walletPubkey) {
|
|
|
114
114
|
return { IFrameRef: IFrameRef };
|
|
115
115
|
}
|
|
116
116
|
exports.useIframeWallet = useIframeWallet;
|
|
117
|
-
function
|
|
117
|
+
function parseIframeMessageJSON(data) {
|
|
118
118
|
try {
|
|
119
119
|
var res = JSON.parse(data);
|
|
120
120
|
if (!res.method)
|
|
@@ -127,4 +127,5 @@ function parseJSON(data) {
|
|
|
127
127
|
return null;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
+
exports.parseIframeMessageJSON = parseIframeMessageJSON;
|
|
130
131
|
//# sourceMappingURL=useIframeWallet.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../../src/wallet/useIframeWallet.ts"],"names":[],"mappings":";;;;AAAA,+BAAqD;AAGrD,iDAAwG;AAExG,SAAgB,eAAe,CAC7B,EAIwB,EACxB,EAKC,EACD,YAAuC;IAZzC,iBAwGC;QAtGG,qBAAqB,2BAAA,EACrB,qBAAqB,2BAAA,EACrB,iBAAiB,uBAAA;QAElB,SAAS,eAAA,EAAE,kBAAkB,wBAAA,EAAE,SAAS,eAAA,EAAE,GAAG,SAAA;IAQ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CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,GAAG,oBAAoB,CAAC;QACxC,OAAO,cAAO,CAAC,CAAC;IAClB,CAAC,EAAE,CAAC,GAAG,EAAE,oBAAoB,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IAEzD,OAAO,EAAC,SAAS,WAAA,EAAC,CAAC;AACrB,CAAC;AAxGD,0CAwGC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,IAAI;QACF,IAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAC3B,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AATD,wDASC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
import { CoinflowBlockchain, CoinflowEnvs } from './CoinflowTypes';
|
|
3
|
+
export type CoinflowCardTokenResponse = {
|
|
4
|
+
last4: string;
|
|
5
|
+
type: 'VISA' | 'MSTR' | 'AMEX' | 'DISC';
|
|
6
|
+
token: string;
|
|
7
|
+
};
|
|
8
|
+
export interface CoinflowCardFormProps {
|
|
9
|
+
merchantId: string;
|
|
10
|
+
walletPubkey?: string;
|
|
11
|
+
handleHeightChange?: (height: string) => void;
|
|
12
|
+
env: CoinflowEnvs;
|
|
13
|
+
inputCss?: CSSProperties;
|
|
14
|
+
customCss?: {
|
|
15
|
+
[key: string]: CSSProperties;
|
|
16
|
+
};
|
|
17
|
+
blockchain: CoinflowBlockchain;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive a token for use with the `/api/checkout/token` endpoint.
|
|
21
|
+
*
|
|
22
|
+
* Usage:
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const ref = useRef<{getToken(): Promise<{token: string}>}>();
|
|
25
|
+
*
|
|
26
|
+
* <CoinflowCardForm
|
|
27
|
+
* ref={coinflowCardFormRef}
|
|
28
|
+
* ...
|
|
29
|
+
* />
|
|
30
|
+
*
|
|
31
|
+
* <button onClick={() => {
|
|
32
|
+
* ref.current?.getToken()
|
|
33
|
+
* .then(({token}) => console.log(token))
|
|
34
|
+
* .catch(e => console.error('GET TOKEN ERROR', e))
|
|
35
|
+
* }}>Get Token</button>
|
|
36
|
+
*
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare const CoinflowCardForm: React.ForwardRefExoticComponent<CoinflowCardFormProps & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
|
+
import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
3
|
+
import { parseIframeMessageJSON, useIframeWallet } from './wallet/useIframeWallet';
|
|
4
|
+
import { CoinflowIFrame } from './CoinflowIFrame';
|
|
5
|
+
/**
|
|
6
|
+
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive a token for use with the `/api/checkout/token` endpoint.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const ref = useRef<{getToken(): Promise<{token: string}>}>();
|
|
11
|
+
*
|
|
12
|
+
* <CoinflowCardForm
|
|
13
|
+
* ref={coinflowCardFormRef}
|
|
14
|
+
* ...
|
|
15
|
+
* />
|
|
16
|
+
*
|
|
17
|
+
* <button onClick={() => {
|
|
18
|
+
* ref.current?.getToken()
|
|
19
|
+
* .then(({token}) => console.log(token))
|
|
20
|
+
* .catch(e => console.error('GET TOKEN ERROR', e))
|
|
21
|
+
* }}>Get Token</button>
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export var CoinflowCardForm = forwardRef(function (_a, ref) {
|
|
26
|
+
var handleHeightChange = _a.handleHeightChange, walletPubkey = _a.walletPubkey, env = _a.env, customCss = _a.customCss, merchantId = _a.merchantId, blockchain = _a.blockchain;
|
|
27
|
+
var IFrameRef = useIframeWallet({
|
|
28
|
+
handleSendTransaction: function () { return Promise.resolve(''); },
|
|
29
|
+
}, {
|
|
30
|
+
handleHeightChange: handleHeightChange,
|
|
31
|
+
env: env,
|
|
32
|
+
}, walletPubkey).IFrameRef;
|
|
33
|
+
useImperativeHandle(ref, function () { return ({
|
|
34
|
+
getToken: function () {
|
|
35
|
+
var _a;
|
|
36
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
37
|
+
return __generator(this, function (_b) {
|
|
38
|
+
if (!((_a = IFrameRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow))
|
|
39
|
+
throw new Error('content window not found');
|
|
40
|
+
IFrameRef.current.contentWindow.postMessage('getToken', '*');
|
|
41
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
42
|
+
var handleIframeMessage = function (_a) {
|
|
43
|
+
var incomingData = _a.data;
|
|
44
|
+
if (origin === 'https://cdn.plaid.com')
|
|
45
|
+
return;
|
|
46
|
+
if (typeof incomingData !== 'string')
|
|
47
|
+
return;
|
|
48
|
+
var parsedData = parseIframeMessageJSON(incomingData);
|
|
49
|
+
if (!parsedData)
|
|
50
|
+
return;
|
|
51
|
+
var method = parsedData.method, data = parsedData.data;
|
|
52
|
+
switch (method) {
|
|
53
|
+
case 'heightChange':
|
|
54
|
+
if (handleHeightChange)
|
|
55
|
+
handleHeightChange(data);
|
|
56
|
+
return;
|
|
57
|
+
case 'getToken':
|
|
58
|
+
if (data.startsWith('ERROR')) {
|
|
59
|
+
reject(new Error(data.replace('ERROR', '')));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
resolve(JSON.parse(data));
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
if (!window)
|
|
66
|
+
throw new Error('Window not defined');
|
|
67
|
+
window.onmessage = handleIframeMessage;
|
|
68
|
+
})];
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}); });
|
|
73
|
+
var merchantCss = useMemo(function () {
|
|
74
|
+
if (!customCss)
|
|
75
|
+
return undefined;
|
|
76
|
+
var cssStr = Object.entries(customCss).reduce(function (acc, _a) {
|
|
77
|
+
var key = _a[0], value = _a[1];
|
|
78
|
+
return acc + "".concat(key, " {").concat(CSSPropertiesToComponent(value), "}\n");
|
|
79
|
+
}, '');
|
|
80
|
+
return Buffer.from(cssStr).toString('base64');
|
|
81
|
+
}, [customCss]);
|
|
82
|
+
if (!walletPubkey)
|
|
83
|
+
return null;
|
|
84
|
+
var iFrameProps = {
|
|
85
|
+
walletPubkey: walletPubkey,
|
|
86
|
+
blockchain: blockchain,
|
|
87
|
+
route: "/checkout-form/".concat(merchantId),
|
|
88
|
+
env: env,
|
|
89
|
+
IFrameRef: IFrameRef,
|
|
90
|
+
routePrefix: 'form',
|
|
91
|
+
merchantCss: merchantCss,
|
|
92
|
+
handleHeightChange: handleHeightChange,
|
|
93
|
+
};
|
|
94
|
+
return React.createElement(CoinflowIFrame, __assign({}, iFrameProps));
|
|
95
|
+
});
|
|
96
|
+
function CSSPropertiesToComponent(dict) {
|
|
97
|
+
var str = '';
|
|
98
|
+
var _loop_1 = function (key, value) {
|
|
99
|
+
var clo = '';
|
|
100
|
+
key.split('').forEach(function (lt) {
|
|
101
|
+
if (lt.toUpperCase() === lt) {
|
|
102
|
+
clo += '-' + lt.toLowerCase();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
clo += lt;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
str += clo + ':' + value + ';';
|
|
109
|
+
};
|
|
110
|
+
for (var _i = 0, _a = Object.entries(dict); _i < _a.length; _i++) {
|
|
111
|
+
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
112
|
+
_loop_1(key, value);
|
|
113
|
+
}
|
|
114
|
+
return str;
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
|
|
3
3
|
export declare function CoinflowPurchase(props: CoinflowPurchaseProps): React.JSX.Element;
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function EvmCoinflowPurchase(props: CoinflowEvmPurchaseProps): React.JSX.Element | null;
|
|
@@ -10,7 +10,8 @@ export function CoinflowPurchase(props) {
|
|
|
10
10
|
return CoinflowUtils.byBlockchain(props.blockchain, {
|
|
11
11
|
solana: (React.createElement(SolanaCoinflowPurchase, __assign({}, props))),
|
|
12
12
|
near: React.createElement(NearCoinflowPurchase, __assign({}, props)),
|
|
13
|
-
polygon: (React.createElement(
|
|
13
|
+
polygon: (React.createElement(EvmCoinflowPurchase, __assign({}, props))),
|
|
14
|
+
eth: (React.createElement(EvmCoinflowPurchase, __assign({}, props)))
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
function SolanaCoinflowPurchase(props) {
|
|
@@ -51,7 +52,7 @@ function NearCoinflowPurchase(props) {
|
|
|
51
52
|
var iframeProps = __assign(__assign({}, props), { walletPubkey: wallet.accountId, IFrameRef: IFrameRef, transaction: transaction, route: "/purchase/".concat(props.merchantId), nearDeposit: props.nearDeposit });
|
|
52
53
|
return React.createElement(CoinflowIFrame, __assign({}, iframeProps));
|
|
53
54
|
}
|
|
54
|
-
export function
|
|
55
|
+
export function EvmCoinflowPurchase(props) {
|
|
55
56
|
var handlers = useEthIFrameMessageHandlers(props);
|
|
56
57
|
var transaction = props.transaction, wallet = props.wallet;
|
|
57
58
|
var IFrameRef = useIframeWallet(handlers, props, wallet.address).IFrameRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,8BAA8B,EAAC,MAAM,sCAAsC,CAAC;AACpF,O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E,MAAM,CAAC,OAAO,EAC5B,SAAS,WAAA,EACT,WAAW,EAAE,cAAc,EAC3B,KAAK,EAAE,oBAAa,KAAK,CAAC,UAAU,CAAE,GACvC,CAAC;IACF,OAAO,oBAAC,cAAc,eAAK,WAAW,EAAI,CAAC;AAC7C,CAAC"}
|
|
@@ -10,7 +10,8 @@ export function CoinflowPurchaseHistory(props) {
|
|
|
10
10
|
return CoinflowUtils.byBlockchain(props.blockchain, {
|
|
11
11
|
solana: (React.createElement(SolanaPurchaseHistory, __assign({}, props))),
|
|
12
12
|
near: React.createElement(NearPurchaseHistory, __assign({}, props)),
|
|
13
|
-
polygon: React.createElement(
|
|
13
|
+
polygon: React.createElement(EvmPurchaseHistory, __assign({}, props)),
|
|
14
|
+
eth: React.createElement(EvmPurchaseHistory, __assign({}, props)),
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
function SolanaPurchaseHistory(props) {
|
|
@@ -33,7 +34,7 @@ function NearPurchaseHistory(props) {
|
|
|
33
34
|
var iframeProps = __assign(__assign({}, props), { walletPubkey: props.wallet.accountId, IFrameRef: IFrameRef, route: "/history/purchase/".concat(props.merchantId) });
|
|
34
35
|
return (React.createElement(CoinflowIFrame, __assign({}, iframeProps)));
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function EvmPurchaseHistory(props) {
|
|
37
38
|
var _a, _b, _c;
|
|
38
39
|
var handlers = useEthIFrameMessageHandlers(props);
|
|
39
40
|
var IFrameRef = useIframeWallet(handlers, props, (_a = props.wallet) === null || _a === void 0 ? void 0 : _a.address).IFrameRef;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,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,MAAM,0CAAE,OAAO,EACnC,SAAS,WAAA,EACT,KAAK,EAAE,4BAAqB,KAAK,CAAC,UAAU,CAAE,GAC/C,CAAC;IACF,OAAO,CACL,oBAAC,cAAc,eAAK,WAAW,EAAI,CACpC,CAAC;AACJ,CAAC"}
|
|
@@ -58,24 +58,27 @@ export interface CoinflowNearHistoryProps extends CoinflowTypes {
|
|
|
58
58
|
wallet: NearWallet;
|
|
59
59
|
blockchain: 'near';
|
|
60
60
|
}
|
|
61
|
-
export interface
|
|
61
|
+
export interface CoinflowEvmHistoryProps extends CoinflowTypes {
|
|
62
62
|
wallet: EthWallet;
|
|
63
|
+
}
|
|
64
|
+
export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
|
|
63
65
|
blockchain: 'eth';
|
|
64
66
|
}
|
|
65
|
-
export interface CoinflowPolygonHistoryProps extends
|
|
66
|
-
wallet: EthWallet;
|
|
67
|
+
export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
67
68
|
blockchain: 'polygon';
|
|
68
69
|
}
|
|
69
|
-
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps;
|
|
70
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps;
|
|
70
71
|
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets'> {
|
|
71
72
|
walletPubkey: string;
|
|
72
73
|
IFrameRef: React.RefObject<HTMLIFrameElement>;
|
|
73
74
|
route: string;
|
|
75
|
+
routePrefix?: string;
|
|
74
76
|
transaction?: string;
|
|
75
77
|
token?: string | PublicKey;
|
|
76
78
|
email?: string;
|
|
77
79
|
supportsVersionedTransactions?: boolean;
|
|
78
80
|
nearDeposit?: string;
|
|
81
|
+
merchantCss?: string;
|
|
79
82
|
}
|
|
80
83
|
/** Transactions **/
|
|
81
84
|
export type NearFtTransferCallAction = {
|
|
@@ -103,7 +106,30 @@ export type EvmTransaction = {
|
|
|
103
106
|
ccipReadEnabled?: boolean;
|
|
104
107
|
};
|
|
105
108
|
/** Purchase **/
|
|
106
|
-
type ChargebackProtectionData =
|
|
109
|
+
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
110
|
+
export interface ChargebackProtectionItem {
|
|
111
|
+
/**
|
|
112
|
+
* The name of the product
|
|
113
|
+
*/
|
|
114
|
+
productName: string;
|
|
115
|
+
/**
|
|
116
|
+
* The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp
|
|
117
|
+
*/
|
|
118
|
+
productType: 'inGameProduct' | 'gameOfSkill' | 'dataStorage' | 'computingResources' | 'sportsTicket' | 'eSportsTicket' | 'musicTicket' | 'conferenceTicket' | 'virtualSportsTicket' | 'virtualESportsTicket' | 'virtualMusicTicket' | 'virtualConferenceTicket' | 'alcohol' | 'DLC' | 'subscription' | 'fundACause' | 'realEstate' | 'computingContract' | 'digitalArt' | 'topUp';
|
|
119
|
+
/**
|
|
120
|
+
* The item's list price
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* The number of units sold
|
|
124
|
+
*/
|
|
125
|
+
quantity: number;
|
|
126
|
+
/**
|
|
127
|
+
* Any additional data that the store can provide on the product, e.g. description, link to image, etc.
|
|
128
|
+
*/
|
|
129
|
+
rawProductData?: {
|
|
130
|
+
[key: string]: any;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
107
133
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
108
134
|
amount?: number;
|
|
109
135
|
onSuccess?: OnSuccessMethod;
|
|
@@ -127,12 +153,18 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
|
127
153
|
action?: NearFtTransferCallAction;
|
|
128
154
|
nearDeposit?: string;
|
|
129
155
|
}
|
|
130
|
-
export interface
|
|
156
|
+
export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
131
157
|
transaction?: EvmTransaction;
|
|
158
|
+
token?: string;
|
|
132
159
|
wallet: EthWallet;
|
|
160
|
+
}
|
|
161
|
+
export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
133
162
|
blockchain: 'polygon';
|
|
134
163
|
}
|
|
135
|
-
export
|
|
164
|
+
export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
165
|
+
blockchain: 'eth';
|
|
166
|
+
}
|
|
167
|
+
export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps;
|
|
136
168
|
/** Withdraw **/
|
|
137
169
|
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
138
170
|
onSuccess?: OnSuccessMethod;
|
|
@@ -8,7 +8,7 @@ export declare class CoinflowUtils {
|
|
|
8
8
|
getCreditBalance(publicKey: string, blockchain: 'solana' | 'near'): Promise<number>;
|
|
9
9
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
10
10
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
11
|
-
static getCoinflowUrl({ walletPubkey, route, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, token, email, loaderBackground, handleHeightChange, useSocket, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, }: CoinflowIFrameProps): string;
|
|
11
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, token, email, loaderBackground, handleHeightChange, useSocket, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, }: CoinflowIFrameProps): string;
|
|
12
12
|
static serializeSolanaTransaction(transaction: Transaction | VersionedTransaction | undefined): string | undefined;
|
|
13
13
|
static solanaWalletSupportsVersionedTransactions(wallet: SolanaWallet): boolean;
|
|
14
14
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
@@ -58,8 +58,9 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
58
58
|
};
|
|
59
59
|
CoinflowUtils.getCoinflowUrl = function (_a) {
|
|
60
60
|
var _b;
|
|
61
|
-
var walletPubkey = _a.walletPubkey, route = _a.route, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, useSocket = _a.useSocket, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData;
|
|
62
|
-
var
|
|
61
|
+
var walletPubkey = _a.walletPubkey, route = _a.route, routePrefix = _a.routePrefix, env = _a.env, amount = _a.amount, transaction = _a.transaction, blockchain = _a.blockchain, supportsVersionedTransactions = _a.supportsVersionedTransactions, webhookInfo = _a.webhookInfo, token = _a.token, email = _a.email, loaderBackground = _a.loaderBackground, handleHeightChange = _a.handleHeightChange, useSocket = _a.useSocket, bankAccountLinkRedirect = _a.bankAccountLinkRedirect, additionalWallets = _a.additionalWallets, nearDeposit = _a.nearDeposit, chargebackProtectionData = _a.chargebackProtectionData, merchantCss = _a.merchantCss;
|
|
62
|
+
var prefix = routePrefix ? "/".concat(routePrefix, "/").concat(blockchain) : "/".concat(blockchain);
|
|
63
|
+
var url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));
|
|
63
64
|
url.searchParams.append('pubkey', walletPubkey);
|
|
64
65
|
if (transaction) {
|
|
65
66
|
url.searchParams.append('transaction', transaction);
|
|
@@ -101,6 +102,8 @@ var CoinflowUtils = /** @class */ (function () {
|
|
|
101
102
|
var deviceId = (_b = window === null || window === void 0 ? void 0 : window.nSureSDK) === null || _b === void 0 ? void 0 : _b.getDeviceId();
|
|
102
103
|
if (deviceId)
|
|
103
104
|
url.searchParams.append('deviceId', deviceId);
|
|
105
|
+
if (merchantCss)
|
|
106
|
+
url.searchParams.append('merchantCss', merchantCss);
|
|
104
107
|
return url.toString();
|
|
105
108
|
};
|
|
106
109
|
CoinflowUtils.serializeSolanaTransaction = function (transaction) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,MAAM,CAAC;AAQ1B;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,mCAAW,GAAjB,UAAkB,UAAkB;;;;;4BACjB,qBAAM,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,yBAAkB,UAAU,CAAE,CAAC,EAAA;;wBAAjE,QAAQ,GAAG,SAAsD;wBAC1D,qBAAM,QAAQ,CAAC,IAAI,EAAE,EAAA;;wBAA5B,IAAI,GAAG,SAAqB;wBAClC,sBAAO,IAAI,CAAC,iBAAiB,EAAC;;;;KAC/B;IAEK,wCAAgB,GAAtB,UACE,SAAiB,EACjB,UAA6B;;;;;4BA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CAAC,SAAS,CAAC;YACzC,oBAAoB,EAAE,KAAK;YAC3B,gBAAgB,EAAE,KAAK;SACxB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,YAA0B,CAAC,CAAC;IACnD,CAAC;IAEM,uDAAyC,GAAhD,UACE,MAAoB;;QAEpB,OAAO,CAAC,CAAC,CAAA,MAAA,MAAA,MAAA,MAAM,CAAC,MAAM,0CAAE,OAAO,0CAAE,4BAA4B,0CAAE,GAAG,CAAC,CAAC,CAAC,CAAA,CAAC;IACxE,CAAC;IAEM,0BAAY,GAAnB,UACE,UAA8B,EAC9B,IAA+C;QAE/C,QAAQ,UAAU,EAAE;YAClB,KAAK,QAAQ;gBACX,OAAO,IAAI,CAAC,MAAM,CAAC;YACrB,KAAK,MAAM;gBACT,OAAO,IAAI,CAAC,IAAI,CAAC;YACnB,KAAK,SAAS;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,KAAK,KAAK;gBACR,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS;oBACxB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;gBAClE,OAAO,IAAI,CAAC,GAAG,CAAC;YAClB;gBACE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;IACH,CAAC;IACH,oBAAC;AAAD,CAAC,AA1KD,IA0KC"}
|
package/build/esm/index.d.ts
CHANGED
package/build/esm/index.js
CHANGED
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { IFrameMessageHandlers } from './SolanaIFrameMessageHandlers';
|
|
2
|
+
import { IFrameMessageHandlers, WalletCall } from './SolanaIFrameMessageHandlers';
|
|
3
3
|
import { CoinflowEnvs, OnSuccessMethod } from '../CoinflowTypes';
|
|
4
4
|
export declare function useIframeWallet({ handleSignTransaction, handleSendTransaction, handleSignMessage, }: IFrameMessageHandlers, { onSuccess, handleHeightChange, useSocket, env }: {
|
|
5
5
|
onSuccess?: OnSuccessMethod;
|
|
@@ -9,3 +9,4 @@ export declare function useIframeWallet({ handleSignTransaction, handleSendTrans
|
|
|
9
9
|
}, walletPubkey: string | null | undefined): {
|
|
10
10
|
IFrameRef: import("react").MutableRefObject<HTMLIFrameElement | null>;
|
|
11
11
|
};
|
|
12
|
+
export declare function parseIframeMessageJSON(data: string): WalletCall | null;
|
|
@@ -26,7 +26,7 @@ export function useIframeWallet(_a, _b, walletPubkey) {
|
|
|
26
26
|
switch (_c.label) {
|
|
27
27
|
case 0:
|
|
28
28
|
_c.trys.push([0, 11, , 12]);
|
|
29
|
-
parsedData =
|
|
29
|
+
parsedData = parseIframeMessageJSON(data);
|
|
30
30
|
if (!parsedData)
|
|
31
31
|
return [2 /*return*/];
|
|
32
32
|
_b = parsedData.method;
|
|
@@ -110,7 +110,7 @@ export function useIframeWallet(_a, _b, walletPubkey) {
|
|
|
110
110
|
}, [env, handleIframeMessages, useSocket, walletPubkey]);
|
|
111
111
|
return { IFrameRef: IFrameRef };
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
export function parseIframeMessageJSON(data) {
|
|
114
114
|
try {
|
|
115
115
|
var res = JSON.parse(data);
|
|
116
116
|
if (!res.method)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIframeWallet.js","sourceRoot":"","sources":["../../../src/wallet/useIframeWallet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAGrD,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAE,oBAAoB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAExG,MAAM,UAAU,eAAe,CAC7B,EAIwB,EACxB,EAKC,EACD,YAAuC;IAZzC,iBAwGC;QAtGG,qBAAqB,2BAAA,EACrB,qBAAqB,2BAAA,EACrB,iBAAiB,uBAAA;QAElB,SAAS,eAAA,EAAE,kBAAkB,wBAAA,EAAE,SAAS,eAAA,EAAE,GAAG,SAAA;IAQ9C,IAAM,SAAS,GAAG,MAAM,CAA2B,IAAI,CAAC,CAAC;IAEzD,IAAM,iBAAiB,GAAG,WAAW,CACnC,UAAC,OAAe;;QACd,IAAI,SAAS,EAAE;YACb,IAAI,CAAC,YAAY;gBAAE,OAAO;YAC1B,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO;SACR;QAED,IAAI,CAAC,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,0CAAE,aAAa,CAAA;YACpC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAExC,MAAA,SAAS,CAAC,OAAO,0CAAE,aAAa,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7D,CAAC,EACD,CAAC,SAAS,EAAE,YAAY,CAAC,CAC1B,CAA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AAC;QAC3B,OAAO,GAAG,CAAC;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,IAAI,CAAC;KACb;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "React Component for Coinflow Withdraw",
|
|
5
5
|
"main": "./build/cjs/index.js",
|
|
6
6
|
"module": "./build/esm/index.js",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@solana/wallet-adapter-react": "^0.15.32",
|
|
36
|
-
"@near-wallet-selector/core": "^8.5.
|
|
37
|
-
"@types/react": "^18.2.
|
|
36
|
+
"@near-wallet-selector/core": "^8.5.2",
|
|
37
|
+
"@types/react": "^18.2.21",
|
|
38
38
|
"eslint-config-react-app": "^7.0.1",
|
|
39
|
-
"typescript": "^5.0.4"
|
|
39
|
+
"typescript": "^5.0.4",
|
|
40
|
+
"csstype": "^3.1.2"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"@solana/web3.js": ">=1.54.0",
|