@coinflowlabs/react 5.9.1 → 5.10.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 +8 -0
- package/build/cjs/CoinflowApplePayButton.d.ts +1 -1
- package/build/cjs/CoinflowApplePayButton.js +5 -6
- package/build/cjs/CoinflowApplePayButton.js.map +1 -1
- package/build/cjs/CoinflowGooglePayButton.js +4 -5
- package/build/cjs/CoinflowGooglePayButton.js.map +1 -1
- package/build/cjs/CoinflowIFrame.js +42 -53
- package/build/cjs/CoinflowIFrame.js.map +1 -1
- package/build/cjs/CoinflowPurchase.js +55 -42
- package/build/cjs/CoinflowPurchase.js.map +1 -1
- package/build/cjs/CoinflowPurchaseHistory.js +20 -11
- package/build/cjs/CoinflowPurchaseHistory.js.map +1 -1
- package/build/cjs/CoinflowPurchaseProtection.d.ts +1 -1
- package/build/cjs/CoinflowPurchaseProtection.js +10 -11
- package/build/cjs/CoinflowPurchaseProtection.js.map +1 -1
- package/build/cjs/CoinflowWithdraw.js +20 -11
- package/build/cjs/CoinflowWithdraw.js.map +1 -1
- package/build/cjs/CoinflowWithdrawHistory.js +20 -11
- package/build/cjs/CoinflowWithdrawHistory.js.map +1 -1
- package/build/cjs/MobileWalletButton.d.ts +1 -1
- package/build/cjs/MobileWalletButton.js +35 -26
- package/build/cjs/MobileWalletButton.js.map +1 -1
- package/build/cjs/card-form/CoinflowCardForm.js +42 -54
- package/build/cjs/card-form/CoinflowCardForm.js.map +1 -1
- package/build/cjs/card-form/CoinflowCardFormHeader.js +5 -5
- package/build/cjs/card-form/CoinflowCardFormHeader.js.map +1 -1
- package/build/cjs/card-form/useCardFormIframe.d.ts +5 -5
- package/build/cjs/card-form/useCardFormIframe.js +57 -57
- package/build/cjs/card-form/useCardFormIframe.js.map +1 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.d.ts +2 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.js +128 -193
- package/build/cjs/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/cjs/common/CoinflowTypes.d.ts +19 -8
- package/build/cjs/common/CoinflowTypes.js +15 -16
- package/build/cjs/common/CoinflowTypes.js.map +1 -1
- package/build/cjs/common/CoinflowUtils.d.ts +2 -1
- package/build/cjs/common/CoinflowUtils.js +68 -64
- package/build/cjs/common/CoinflowUtils.js.map +1 -1
- package/build/cjs/common/EventBus.js +8 -11
- package/build/cjs/common/EventBus.js.map +1 -1
- package/build/cjs/common/NSure.js +2 -2
- package/build/cjs/common/NSure.js.map +1 -1
- package/build/cjs/common/NSure.native.js.map +1 -1
- package/build/cjs/common/SolanaPeerDeps.js +5 -5
- package/build/cjs/common/SolanaPeerDeps.js.map +1 -1
- package/build/cjs/common/card-form/TokenEx.js +7 -8
- package/build/cjs/common/card-form/TokenEx.js.map +1 -1
- package/build/cjs/common/card-form/tokenexHelpers.d.ts +1 -1
- package/build/cjs/common/card-form/tokenexHelpers.js +97 -150
- package/build/cjs/common/card-form/tokenexHelpers.js.map +1 -1
- package/build/cjs/common/index.js +1 -1
- package/build/cjs/common/types/Subtotal.js +175 -176
- package/build/cjs/common/types/Subtotal.js.map +1 -1
- package/build/cjs/common/types/nftCartItem.js +2 -2
- package/build/cjs/common/types/nftCartItem.js.map +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/useOverlay.js +13 -12
- package/build/cjs/useOverlay.js.map +1 -1
- package/build/esm/CoinflowApplePayButton.d.ts +1 -1
- package/build/esm/CoinflowApplePayButton.js +2 -3
- package/build/esm/CoinflowApplePayButton.js.map +1 -1
- package/build/esm/CoinflowGooglePayButton.js +1 -2
- package/build/esm/CoinflowGooglePayButton.js.map +1 -1
- package/build/esm/CoinflowIFrame.js +39 -51
- package/build/esm/CoinflowIFrame.js.map +1 -1
- package/build/esm/CoinflowPurchase.js +50 -38
- package/build/esm/CoinflowPurchase.js.map +1 -1
- package/build/esm/CoinflowPurchaseHistory.js +16 -8
- package/build/esm/CoinflowPurchaseHistory.js.map +1 -1
- package/build/esm/CoinflowPurchaseProtection.d.ts +1 -1
- package/build/esm/CoinflowPurchaseProtection.js +6 -7
- package/build/esm/CoinflowPurchaseProtection.js.map +1 -1
- package/build/esm/CoinflowWithdraw.js +16 -8
- package/build/esm/CoinflowWithdraw.js.map +1 -1
- package/build/esm/CoinflowWithdrawHistory.js +16 -8
- package/build/esm/CoinflowWithdrawHistory.js.map +1 -1
- package/build/esm/MobileWalletButton.d.ts +1 -1
- package/build/esm/MobileWalletButton.js +30 -22
- package/build/esm/MobileWalletButton.js.map +1 -1
- package/build/esm/card-form/CoinflowCardForm.js +41 -54
- package/build/esm/card-form/CoinflowCardForm.js.map +1 -1
- package/build/esm/card-form/CoinflowCardFormHeader.js +3 -3
- package/build/esm/card-form/CoinflowCardFormHeader.js.map +1 -1
- package/build/esm/card-form/useCardFormIframe.d.ts +5 -5
- package/build/esm/card-form/useCardFormIframe.js +56 -56
- package/build/esm/card-form/useCardFormIframe.js.map +1 -1
- package/build/esm/common/CoinflowLibMessageHandlers.d.ts +2 -1
- package/build/esm/common/CoinflowLibMessageHandlers.js +126 -191
- package/build/esm/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/esm/common/CoinflowTypes.d.ts +19 -8
- package/build/esm/common/CoinflowTypes.js +16 -17
- package/build/esm/common/CoinflowTypes.js.map +1 -1
- package/build/esm/common/CoinflowUtils.d.ts +2 -1
- package/build/esm/common/CoinflowUtils.js +63 -61
- package/build/esm/common/CoinflowUtils.js.map +1 -1
- package/build/esm/common/EventBus.js +8 -12
- package/build/esm/common/EventBus.js.map +1 -1
- package/build/esm/common/SolanaPeerDeps.js +2 -2
- package/build/esm/common/SolanaPeerDeps.js.map +1 -1
- package/build/esm/common/card-form/TokenEx.js +8 -9
- package/build/esm/common/card-form/TokenEx.js.map +1 -1
- package/build/esm/common/card-form/tokenexHelpers.d.ts +1 -1
- package/build/esm/common/card-form/tokenexHelpers.js +95 -148
- package/build/esm/common/card-form/tokenexHelpers.js.map +1 -1
- package/build/esm/common/types/Subtotal.js +175 -176
- package/build/esm/common/types/Subtotal.js.map +1 -1
- package/build/esm/common/types/nftCartItem.js +2 -2
- package/build/esm/common/types/nftCartItem.js.map +1 -1
- package/build/esm/useOverlay.js +11 -10
- package/build/esm/useOverlay.js.map +1 -1
- package/build/tsconfig.cjs.tsbuildinfo +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -70,6 +70,14 @@ Props:
|
|
|
70
70
|
|
|
71
71
|
# Changelog
|
|
72
72
|
|
|
73
|
+
## 5.10.0
|
|
74
|
+
|
|
75
|
+
- Added support for CashApp redirection
|
|
76
|
+
|
|
77
|
+
## 5.9.2
|
|
78
|
+
|
|
79
|
+
- Fixed typing for sessionKey being not present when passing the wallet object
|
|
80
|
+
|
|
73
81
|
## 5.9.1
|
|
74
82
|
|
|
75
83
|
- Added support for overriding the default account type (from merchant settings) used for chargeback protection via `chargebackProtectionAccountType` in the URL parameters.
|
|
@@ -2,4 +2,4 @@ import { CoinflowPurchaseProps } from './common';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { MobileWalletButtonProps } from './MobileWalletButton';
|
|
4
4
|
export declare function CoinflowApplePayButton(props: CoinflowPurchaseProps & MobileWalletButtonProps): React.JSX.Element;
|
|
5
|
-
export declare function AppleButtonOverlayLogo({ color
|
|
5
|
+
export declare function AppleButtonOverlayLogo({ color }: Pick<MobileWalletButtonProps, 'color'>): React.JSX.Element;
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowApplePayButton = CoinflowApplePayButton;
|
|
4
5
|
exports.AppleButtonOverlayLogo = AppleButtonOverlayLogo;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var MobileWalletButton_1 = require("./MobileWalletButton");
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const MobileWalletButton_1 = require("./MobileWalletButton");
|
|
8
8
|
function CoinflowApplePayButton(props) {
|
|
9
9
|
return (react_1.default.createElement(MobileWalletButton_1.MobileWalletButton, { props: props, route: 'apple-pay' },
|
|
10
10
|
react_1.default.createElement(AppleButtonOverlayLogo, { color: props.color })));
|
|
11
11
|
}
|
|
12
|
-
function AppleButtonOverlayLogo(
|
|
13
|
-
|
|
14
|
-
var fill = color === 'white' ? '#000' : '#FFF';
|
|
12
|
+
function AppleButtonOverlayLogo({ color, }) {
|
|
13
|
+
const fill = color === 'white' ? '#000' : '#FFF';
|
|
15
14
|
return (react_1.default.createElement("svg", { id: "svg-logo", viewBox: "0 0 35 15" },
|
|
16
15
|
react_1.default.createElement("svg", { id: "svg-logo", x: "0", y: "3.85", height: "7.3", width: "35", className: "logo", viewBox: "0 0 105 43", version: "1.1", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink" },
|
|
17
16
|
react_1.default.createElement("title", null, "Apple Logo"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowApplePayButton.js","sourceRoot":"","sources":["../../src/CoinflowApplePayButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowApplePayButton.js","sourceRoot":"","sources":["../../src/CoinflowApplePayButton.tsx"],"names":[],"mappings":";;;;;AACA,0DAA0B;AAC1B,6DAG8B;AAE9B,gCACE,KAAsD;IAEtD,OAAO,CACL,8BAAC,uCAAkB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW;QAClD,8BAAC,sBAAsB,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CAC3B,CACtB,CAAC;AACJ,CAAC;AAED,gCAAuC,EACrC,KAAK,GACkC;IACvC,MAAM,IAAI,GAAG,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,CACL,uCAAK,EAAE,EAAC,UAAU,EAAC,OAAO,EAAC,WAAW;QACpC,uCACE,EAAE,EAAC,UAAU,EACb,CAAC,EAAC,GAAG,EACL,CAAC,EAAC,MAAM,EACR,MAAM,EAAC,KAAK,EACZ,KAAK,EAAC,IAAI,EACV,SAAS,EAAC,MAAM,EAChB,OAAO,EAAC,YAAY,EACpB,OAAO,EAAC,KAAK,EACb,KAAK,EAAC,4BAA4B,EAClC,UAAU,EAAC,8BAA8B;YAEzC,0DAAyB;YACzB,qCAAG,MAAM,EAAC,MAAM,kBAAc,GAAG,EAAC,IAAI,EAAC,MAAM,eAAW,SAAS;gBAC/D,qCAAG,IAAI,EAAE,IAAI;oBACX,wCAAM,CAAC,EAAC,yMAAyM,GAAQ;oBACzN,wCAAM,CAAC,EAAC,6kBAA6kB,GAAQ;oBAC7lB,wCAAM,CAAC,EAAC,iXAAiX,GAAQ;oBACjY,wCAAM,CAAC,EAAC,0WAA0W,GAAQ;oBAC1X,wCAAM,CAAC,EAAC,sqBAAsqB,GAAQ,CACprB,CACF,CACA,CACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowGooglePayButton = CoinflowGooglePayButton;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var MobileWalletButton_1 = require("./MobileWalletButton");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const MobileWalletButton_1 = require("./MobileWalletButton");
|
|
7
7
|
function CoinflowGooglePayButton(props) {
|
|
8
8
|
return (react_1.default.createElement(MobileWalletButton_1.MobileWalletButton, { props: props, route: 'google-pay', overlayDisplayOverride: 'flex', alignItems: 'center' },
|
|
9
9
|
react_1.default.createElement(GooglePayLogo, { color: props.color })));
|
|
10
10
|
}
|
|
11
|
-
function GooglePayLogo(
|
|
12
|
-
var color = _a.color;
|
|
11
|
+
function GooglePayLogo({ color }) {
|
|
13
12
|
if (color === 'white') {
|
|
14
13
|
return react_1.default.createElement(GooglePayLogoLight, null);
|
|
15
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowGooglePayButton.js","sourceRoot":"","sources":["../../src/CoinflowGooglePayButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowGooglePayButton.js","sourceRoot":"","sources":["../../src/CoinflowGooglePayButton.tsx"],"names":[],"mappings":";;;;AACA,0DAA0B;AAC1B,6DAG8B;AAE9B,iCACE,KAAsD;IAEtD,OAAO,CACL,8BAAC,uCAAkB,IACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,YAAY,EACnB,sBAAsB,EAAE,MAAM,EAC9B,UAAU,EAAE,QAAQ;QAEpB,8BAAC,aAAa,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAI,CAClB,CACtB,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,EAAC,KAAK,EAAyC;IACpE,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACtB,OAAO,8BAAC,kBAAkB,OAAG,CAAC;IAChC,CAAC;SAAM,CAAC;QACN,OAAO,8BAAC,iBAAiB,OAAG,CAAC;IAC/B,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB;IACzB,OAAO,CACL,uCAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI;QAC5D,qCAAG,IAAI,EAAC,MAAM,eAAW,SAAS;YAChC,wCACE,CAAC,EAAC,89BAA89B,EACh+B,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,kIAAkI,EACpI,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,6JAA6J,EAC/J,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,sHAAsH,EACxH,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,mKAAmK,EACrK,IAAI,EAAC,SAAS,GACd;YACF,wCAAM,CAAC,EAAC,mBAAmB,GAAG,CAC5B,CACA,CACP,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,CACL,uCAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI;QAC5D,qCAAG,IAAI,EAAC,MAAM,eAAW,SAAS;YAChC,wCACE,CAAC,EAAC,89BAA89B,EACh+B,IAAI,EAAC,MAAM,GACX;YACF,wCACE,CAAC,EAAC,kIAAkI,EACpI,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,6JAA6J,EAC/J,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,sHAAsH,EACxH,IAAI,EAAC,SAAS,GACd;YACF,wCACE,CAAC,EAAC,mKAAmK,EACrK,IAAI,EAAC,SAAS,GACd,CACA,CACA,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,85 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CoinflowIFrame = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
exports.useRandomHandleHeightChangeId = useRandomHandleHeightChangeId;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var common_1 = require("./common");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const common_1 = require("./common");
|
|
8
8
|
function useRandomHandleHeightChangeId() {
|
|
9
|
-
return (0, react_1.useMemo)(
|
|
9
|
+
return (0, react_1.useMemo)(() => Math.random().toString(16).substring(2), []);
|
|
10
10
|
}
|
|
11
|
-
exports.CoinflowIFrame = (0, react_1.forwardRef)(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
exports.CoinflowIFrame = (0, react_1.forwardRef)((props, ref) => {
|
|
12
|
+
const IFrameRef = (0, react_1.useRef)(null);
|
|
13
|
+
const url = (0, react_1.useMemo)(() => {
|
|
14
14
|
return common_1.CoinflowUtils.getCoinflowUrl(props);
|
|
15
15
|
}, [props]);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (!((_a = IFrameRef === null || IFrameRef === void 0 ? void 0 : IFrameRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow))
|
|
16
|
+
const sendMessage = (0, react_1.useCallback)((message) => {
|
|
17
|
+
if (!IFrameRef?.current?.contentWindow)
|
|
19
18
|
throw new Error('Iframe not defined');
|
|
20
19
|
IFrameRef.current.contentWindow.postMessage(message, '*');
|
|
21
20
|
}, []);
|
|
22
|
-
(0, react_1.useImperativeHandle)(ref,
|
|
23
|
-
listenForMessage
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
window.addEventListener('message', handler);
|
|
43
|
-
}).finally(function () {
|
|
44
|
-
window.removeEventListener('message', handler);
|
|
45
|
-
})];
|
|
46
|
-
});
|
|
21
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
22
|
+
async listenForMessage(isResponseValid) {
|
|
23
|
+
let handler;
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
handler = ({ data, origin }) => {
|
|
26
|
+
if (!origin.includes(common_1.CoinflowUtils.getCoinflowBaseUrl(props.env)))
|
|
27
|
+
return;
|
|
28
|
+
if (data.startsWith('ERROR')) {
|
|
29
|
+
reject(new Error(data.replace('ERROR', '')));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!isResponseValid(data))
|
|
33
|
+
return;
|
|
34
|
+
resolve(data);
|
|
35
|
+
};
|
|
36
|
+
if (!window)
|
|
37
|
+
throw new Error('Window not defined');
|
|
38
|
+
window.addEventListener('message', handler);
|
|
39
|
+
}).finally(() => {
|
|
40
|
+
window.removeEventListener('message', handler);
|
|
47
41
|
});
|
|
48
42
|
},
|
|
49
|
-
sendAndReceiveMessage
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
sendMessage(message);
|
|
53
|
-
return [2 /*return*/, this.listenForMessage(isResponseValid)];
|
|
54
|
-
});
|
|
55
|
-
});
|
|
43
|
+
async sendAndReceiveMessage(message, isResponseValid) {
|
|
44
|
+
sendMessage(message);
|
|
45
|
+
return this.listenForMessage(isResponseValid);
|
|
56
46
|
},
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
var data = _a.data, origin = _a.origin;
|
|
47
|
+
}));
|
|
48
|
+
const handleIframeMessages = (0, react_1.useCallback)(({ data, origin }) => {
|
|
60
49
|
if (!origin.includes(common_1.CoinflowUtils.getCoinflowBaseUrl(props.env)))
|
|
61
50
|
return;
|
|
62
|
-
|
|
51
|
+
const promise = (0, common_1.handleIFrameMessage)(data, props, props.handleHeightChangeId);
|
|
63
52
|
if (!promise)
|
|
64
53
|
return;
|
|
65
|
-
promise.then(sendMessage).catch(
|
|
54
|
+
promise.then(sendMessage).catch(e => sendMessage('ERROR ' + e.message));
|
|
66
55
|
}, [props, sendMessage]);
|
|
67
|
-
(0, react_1.useEffect)(
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
68
57
|
if (!window)
|
|
69
58
|
throw new Error('Window not defined');
|
|
70
59
|
window.addEventListener('message', handleIframeMessages);
|
|
71
|
-
return
|
|
60
|
+
return () => {
|
|
72
61
|
window.removeEventListener('message', handleIframeMessages);
|
|
73
62
|
};
|
|
74
63
|
}, [handleIframeMessages]);
|
|
75
|
-
(0, react_1.useLayoutEffect)(
|
|
64
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
76
65
|
if (!IFrameRef.current)
|
|
77
66
|
return;
|
|
78
67
|
// @ts-expect-error TypeScript doesn't recognize credentialless as a valid attribute in its type definitions yet
|
|
79
68
|
IFrameRef.current.credentialless = true;
|
|
80
69
|
}, []);
|
|
81
|
-
|
|
82
|
-
return (0, react_1.useMemo)(
|
|
70
|
+
const { handleHeightChange } = props;
|
|
71
|
+
return (0, react_1.useMemo)(() => (react_1.default.createElement("iframe", { scrolling: handleHeightChange ? 'no' : 'yes', onLoad: () => {
|
|
83
72
|
if (IFrameRef.current)
|
|
84
73
|
IFrameRef.current.style.opacity = '1';
|
|
85
74
|
}, allow: 'payment;camera;clipboard-write', ref: IFrameRef, style: {
|
|
@@ -87,6 +76,6 @@ exports.CoinflowIFrame = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
87
76
|
height: '100%',
|
|
88
77
|
opacity: 0,
|
|
89
78
|
transition: 'opacity 300ms linear',
|
|
90
|
-
}, title: "withdraw", frameBorder: "0", src: url }))
|
|
79
|
+
}, title: "withdraw", frameBorder: "0", src: url })), [IFrameRef, handleHeightChange, url]);
|
|
91
80
|
});
|
|
92
81
|
//# sourceMappingURL=CoinflowIFrame.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":";;;;;AAAA,uDAQe;AACf,qCAKkB;AAalB;IACE,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC;AAEY,QAAA,cAAc,GAAG,IAAA,kBAAU,EACtC,CAAC,KAAkD,EAAE,GAAG,EAAE,EAAE;IAC1D,MAAM,SAAS,GAAG,IAAA,cAAM,EAA2B,IAAI,CAAC,CAAC;IAEzD,MAAM,GAAG,GAAG,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3B,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE,OAAO;QAE/B,gHAAgH;QAChH,SAAS,CAAC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAC1C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,EAAC,kBAAkB,EAAC,GAAG,KAAK,CAAC;IACnC,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,CACJ,0CACE,SAAS,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAC5C,MAAM,EAAE,GAAG,EAAE;YACX,IAAI,SAAS,CAAC,OAAO;gBAAE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,CAAC;QAC/D,CAAC,EACD,KAAK,EAAE,gCAAgC,EACvC,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,sBAAsB;SACnC,EACD,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,GAAG,EACf,GAAG,EAAE,GAAG,GACR,CACH,EACD,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,CAAC,CACrC,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1,43 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowPurchase = CoinflowPurchase;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var useOverlay_1 = require("./useOverlay");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
8
|
+
const useOverlay_1 = require("./useOverlay");
|
|
9
9
|
function useCoinflowPurchase(purchaseProps, version) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
10
|
+
const handleHeightChangeId = (0, CoinflowIFrame_1.useRandomHandleHeightChangeId)();
|
|
11
|
+
const iframeProps = (0, react_1.useMemo)(() => {
|
|
12
|
+
const walletPubkey = (0, common_1.getWalletPubkey)(purchaseProps);
|
|
13
|
+
return {
|
|
14
|
+
...purchaseProps,
|
|
15
|
+
walletPubkey,
|
|
16
|
+
route: `/purchase${version}/${purchaseProps.merchantId}`,
|
|
17
|
+
transaction: common_1.CoinflowUtils.getTransaction(purchaseProps),
|
|
18
|
+
handleHeightChangeId,
|
|
19
|
+
};
|
|
14
20
|
}, [handleHeightChangeId, purchaseProps, version]);
|
|
15
|
-
|
|
16
|
-
return
|
|
21
|
+
const messageHandlers = (0, react_1.useMemo)(() => {
|
|
22
|
+
return {
|
|
23
|
+
...(0, common_1.getHandlers)(purchaseProps),
|
|
24
|
+
handleHeightChange: purchaseProps.handleHeightChange,
|
|
25
|
+
};
|
|
17
26
|
}, [purchaseProps]);
|
|
18
|
-
return { iframeProps
|
|
27
|
+
return { iframeProps, messageHandlers };
|
|
19
28
|
}
|
|
20
29
|
function CoinflowPurchase(purchaseProps) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
const iframeRef = (0, react_1.useRef)(null);
|
|
31
|
+
const { iframeProps, messageHandlers } = useCoinflowPurchase(purchaseProps, '-v2');
|
|
32
|
+
const { showOverlay } = (0, useOverlay_1.useOverlay)(iframeRef);
|
|
33
|
+
const loaderBackground = iframeProps.loaderBackground || '#ffffff'; // white default bg
|
|
34
|
+
const invertedColor = invertHexColor(loaderBackground);
|
|
26
35
|
return (react_1.default.createElement("div", { style: styles.container(loaderBackground) },
|
|
27
|
-
react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame,
|
|
36
|
+
react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, { ref: iframeRef, ...iframeProps, ...messageHandlers }),
|
|
28
37
|
showOverlay && (react_1.default.createElement(LoaderOverlay, { loaderBackground: loaderBackground, invertedColor: invertedColor }))));
|
|
29
38
|
}
|
|
30
|
-
function LoaderOverlay(
|
|
31
|
-
var loaderBackground = _a.loaderBackground, invertedColor = _a.invertedColor;
|
|
39
|
+
function LoaderOverlay({ loaderBackground, invertedColor, }) {
|
|
32
40
|
return (react_1.default.createElement("div", { style: styles.overlay(loaderBackground) },
|
|
33
41
|
react_1.default.createElement(LoaderGrid, { columns: 2 },
|
|
34
42
|
react_1.default.createElement(Loader, { loaderBackground: invertedColor }),
|
|
35
43
|
react_1.default.createElement(Loader, { loaderBackground: invertedColor })),
|
|
36
44
|
react_1.default.createElement(LoaderGrid, { columns: 1 },
|
|
37
45
|
react_1.default.createElement(Loader, { height: 80, loaderBackground: invertedColor })),
|
|
38
|
-
|
|
46
|
+
[...Array(3)].map((_, index) => (react_1.default.createElement(LoaderRow, { key: index },
|
|
39
47
|
react_1.default.createElement(Loader, { width: index < 2 ? 80 : 120, height: index < 2 ? 15 : 20, loaderBackground: invertedColor }),
|
|
40
|
-
react_1.default.createElement(Loader, { width: index < 2 ? 60 : 100, height: index < 2 ? 15 : 20, loaderBackground: invertedColor })))
|
|
48
|
+
react_1.default.createElement(Loader, { width: index < 2 ? 60 : 100, height: index < 2 ? 15 : 20, loaderBackground: invertedColor })))),
|
|
41
49
|
react_1.default.createElement(LoaderGrid, { columns: 1 },
|
|
42
50
|
react_1.default.createElement(Loader, { height: 60, loaderBackground: invertedColor })),
|
|
43
51
|
react_1.default.createElement(LoaderGrid, { columns: 1, width: "50%" },
|
|
@@ -45,33 +53,33 @@ function LoaderOverlay(_a) {
|
|
|
45
53
|
react_1.default.createElement(LoaderGrid, { columns: 1, width: "40%" },
|
|
46
54
|
react_1.default.createElement(Loader, { height: 6, loaderBackground: invertedColor }))));
|
|
47
55
|
}
|
|
48
|
-
function LoaderGrid(
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
function LoaderGrid({ children, columns, width = '100%', }) {
|
|
57
|
+
return (react_1.default.createElement("div", { style: {
|
|
58
|
+
...styles.grid,
|
|
59
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`,
|
|
60
|
+
width,
|
|
61
|
+
} }, children));
|
|
51
62
|
}
|
|
52
|
-
function LoaderRow(
|
|
53
|
-
var children = _a.children;
|
|
63
|
+
function LoaderRow({ children }) {
|
|
54
64
|
return react_1.default.createElement("div", { style: styles.row }, children);
|
|
55
65
|
}
|
|
56
|
-
function Loader(
|
|
57
|
-
var loaderBackground = _a.loaderBackground, _b = _a.height, height = _b === void 0 ? 40 : _b, width = _a.width;
|
|
66
|
+
function Loader({ loaderBackground, height = 40, width, }) {
|
|
58
67
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
59
68
|
react_1.default.createElement("div", { style: styles.loader(loaderBackground, height, width) }),
|
|
60
69
|
react_1.default.createElement("style", null, styles.keyframes)));
|
|
61
70
|
}
|
|
62
71
|
function invertHexColor(hex) {
|
|
63
|
-
var _a;
|
|
64
72
|
hex = hex.replace(/^#/, '');
|
|
65
|
-
|
|
66
|
-
return
|
|
73
|
+
const rgb = hex.match(/.{2}/g)?.map(val => 255 - parseInt(val, 16)) || [];
|
|
74
|
+
return `#${rgb.map(val => val.toString(16).padStart(2, '0')).join('')}`;
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
container:
|
|
76
|
+
const styles = {
|
|
77
|
+
container: (bg) => ({
|
|
70
78
|
position: 'relative',
|
|
71
79
|
height: '100%',
|
|
72
80
|
backgroundColor: bg,
|
|
73
|
-
})
|
|
74
|
-
overlay:
|
|
81
|
+
}),
|
|
82
|
+
overlay: (bg) => ({
|
|
75
83
|
backgroundColor: bg,
|
|
76
84
|
display: 'flex',
|
|
77
85
|
color: 'gray',
|
|
@@ -86,7 +94,7 @@ var styles = {
|
|
|
86
94
|
gap: '20px',
|
|
87
95
|
zIndex: 10,
|
|
88
96
|
padding: '20px',
|
|
89
|
-
})
|
|
97
|
+
}),
|
|
90
98
|
grid: {
|
|
91
99
|
display: 'grid',
|
|
92
100
|
gap: '20px',
|
|
@@ -97,13 +105,18 @@ var styles = {
|
|
|
97
105
|
justifyContent: 'space-between',
|
|
98
106
|
width: '100%',
|
|
99
107
|
},
|
|
100
|
-
loader:
|
|
101
|
-
width: width ?
|
|
102
|
-
height:
|
|
108
|
+
loader: (bg, height, width) => ({
|
|
109
|
+
width: width ? `${width}px` : '100%',
|
|
110
|
+
height: `${height}px`,
|
|
103
111
|
backgroundColor: bg,
|
|
104
112
|
borderRadius: '4px',
|
|
105
113
|
animation: 'pulse 1.5s infinite',
|
|
106
|
-
})
|
|
107
|
-
keyframes:
|
|
114
|
+
}),
|
|
115
|
+
keyframes: `
|
|
116
|
+
@keyframes pulse {
|
|
117
|
+
0%, 100% { opacity: 0.07; }
|
|
118
|
+
50% { opacity: 0.03; }
|
|
119
|
+
}
|
|
120
|
+
`,
|
|
108
121
|
};
|
|
109
122
|
//# 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":";;;;AAAA,uDAA6C;AAC7C,qCAOkB;AAClB,qDAI0B;AAC1B,6CAAwC;AAExC,SAAS,mBAAmB,CAC1B,aAAoC,EACpC,OAAe;IAEf,MAAM,oBAAoB,GAAG,IAAA,8CAA6B,GAAE,CAAC;IAC7D,MAAM,WAAW,GAAG,IAAA,eAAO,EAAsB,GAAG,EAAE;QACpD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,aAAa;YAChB,YAAY;YACZ,KAAK,EAAE,YAAY,OAAO,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;AAC1E,CAAC;AAED,MAAM,MAAM,GAAG;IACb,SAAS,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC;QAC1B,QAAQ,EAAE,UAAmB;QAC7B,MAAM,EAAE,MAAM;QACd,eAAe,EAAE,EAAE;KACpB,CAAC;IACF,OAAO,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC;QACxB,eAAe,EAAE,EAAE;QACnB,OAAO,EAAE,MAAM;QACf,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,UAAmB;QAC7B,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,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;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,CAAC,EAAU,EAAE,MAAc,EAAE,KAAc,EAAE,EAAE,CAAC,CAAC;QACvD,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM;QACpC,MAAM,EAAE,GAAG,MAAM,IAAI;QACrB,eAAe,EAAE,EAAE;QACnB,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,qBAAqB;KACjC,CAAC;IACF,SAAS,EAAE;;;;;GAKV;CACF,CAAC"}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowPurchaseHistory = CoinflowPurchaseHistory;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var common_1 = require("./common");
|
|
5
|
+
const CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
6
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
const common_1 = require("./common");
|
|
8
8
|
function CoinflowPurchaseHistory(props) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
9
|
+
const handleHeightChangeId = (0, CoinflowIFrame_1.useRandomHandleHeightChangeId)();
|
|
10
|
+
const iframeProps = (0, react_1.useMemo)(() => {
|
|
11
|
+
const walletPubkey = (0, common_1.getWalletPubkey)(props);
|
|
12
|
+
return {
|
|
13
|
+
...props,
|
|
14
|
+
walletPubkey,
|
|
15
|
+
route: `/history/purchase/${props.merchantId}`,
|
|
16
|
+
transaction: undefined,
|
|
17
|
+
handleHeightChangeId,
|
|
18
|
+
};
|
|
13
19
|
}, [handleHeightChangeId, props]);
|
|
14
|
-
|
|
15
|
-
return
|
|
20
|
+
const messageHandlers = (0, react_1.useMemo)(() => {
|
|
21
|
+
return {
|
|
22
|
+
...(0, common_1.getHandlers)(props),
|
|
23
|
+
handleHeightChange: props.handleHeightChange,
|
|
24
|
+
};
|
|
16
25
|
}, [props]);
|
|
17
|
-
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame,
|
|
26
|
+
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, { ...iframeProps, ...messageHandlers });
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=CoinflowPurchaseHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowPurchaseHistory.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseHistory.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+E;AAC/E,uDAAqC;AACrC,qCAMkB;AAElB,iCAAwC,KAA2B;IACjE,MAAM,oBAAoB,GAAG,IAAA,8CAA6B,GAAE,CAAC;IAC7D,MAAM,WAAW,GAAG,IAAA,eAAO,EAAsB,GAAG,EAAE;QACpD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,KAAK,CAAC,CAAC;QAC5C,OAAO;YACL,GAAG,KAAK;YACR,YAAY;YACZ,KAAK,EAAE,qBAAqB,KAAK,CAAC,UAAU,EAAE;YAC9C,WAAW,EAAE,SAAS;YACtB,oBAAoB;SACrB,CAAC;IACJ,CAAC,EAAE,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC,CAAC;IAElC,MAAM,eAAe,GAAG,IAAA,eAAO,EAAwB,GAAG,EAAE;QAC1D,OAAO;YACL,GAAG,IAAA,oBAAW,EAAC,KAAK,CAAC;YACrB,kBAAkB,EAAE,KAAK,CAAC,kBAAkB;SAC7C,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,8BAAC,+BAAc,OAAK,WAAW,KAAM,eAAe,GAAI,CAAC;AAClE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoinflowEnvs } from './common';
|
|
2
|
-
export declare function CoinflowPurchaseProtection({ coinflowEnv, merchantId
|
|
2
|
+
export declare function CoinflowPurchaseProtection({ coinflowEnv, merchantId }: {
|
|
3
3
|
coinflowEnv: CoinflowEnvs;
|
|
4
4
|
merchantId: string;
|
|
5
5
|
}): null;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowPurchaseProtection = CoinflowPurchaseProtection;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var coinflowEnv = _a.coinflowEnv, merchantId = _a.merchantId;
|
|
10
|
-
var appId = (0, react_1.useMemo)(function () {
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const web_client_sdk_1 = tslib_1.__importDefault(require("@nsure-ai/web-client-sdk"));
|
|
8
|
+
function CoinflowPurchaseProtection({ coinflowEnv, merchantId, }) {
|
|
9
|
+
const appId = (0, react_1.useMemo)(() => {
|
|
11
10
|
return coinflowEnv === 'prod'
|
|
12
11
|
? '9JBW2RHC7JNJN8ZQ'
|
|
13
12
|
: 'SANDBOX_CTCE4XK53ZW0R7V1';
|
|
14
13
|
}, [coinflowEnv]);
|
|
15
|
-
|
|
16
|
-
(0, react_1.useEffect)(
|
|
14
|
+
const [partnerId, setPartnerId] = (0, react_1.useState)(undefined);
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
17
16
|
new common_1.CoinflowUtils(coinflowEnv)
|
|
18
17
|
.getNSurePartnerId(merchantId)
|
|
19
|
-
.then(
|
|
18
|
+
.then(partnerId => setPartnerId(partnerId));
|
|
20
19
|
}, [merchantId, coinflowEnv]);
|
|
21
|
-
(0, react_1.useEffect)(
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
22
21
|
if (partnerId) {
|
|
23
22
|
web_client_sdk_1.default.init(appId, partnerId);
|
|
24
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowPurchaseProtection.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseProtection.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowPurchaseProtection.js","sourceRoot":"","sources":["../../src/CoinflowPurchaseProtection.tsx"],"names":[],"mappings":";;;;AAAA,iCAAmD;AACnD,qCAAqD;AACrD,sFAAgD;AAEhD,oCAA2C,EACzC,WAAW,EACX,UAAU,GAIX;IACC,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QACzB,OAAO,WAAW,KAAK,MAAM;YAC3B,CAAC,CAAC,kBAAkB;YACpB,CAAC,CAAC,0BAA0B,CAAC;IACjC,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAClB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAqB,SAAS,CAAC,CAAC;IAC1E,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,sBAAa,CAAC,WAAW,CAAC;aAC3B,iBAAiB,CAAC,UAAU,CAAC;aAC7B,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAChD,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAC9B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,SAAS,EAAE,CAAC;YACd,wBAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAClC,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IACvB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
3
4
|
exports.CoinflowWithdraw = CoinflowWithdraw;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var common_1 = require("./common");
|
|
5
|
+
const react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const CoinflowIFrame_1 = require("./CoinflowIFrame");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
8
|
function CoinflowWithdraw(withdrawProps) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
9
|
+
const handleHeightChangeId = (0, CoinflowIFrame_1.useRandomHandleHeightChangeId)();
|
|
10
|
+
const iframeProps = (0, react_1.useMemo)(() => {
|
|
11
|
+
const walletPubkey = (0, common_1.getWalletPubkey)(withdrawProps);
|
|
12
|
+
return {
|
|
13
|
+
...withdrawProps,
|
|
14
|
+
walletPubkey,
|
|
15
|
+
route: `/withdraw/${withdrawProps.merchantId}`,
|
|
16
|
+
transaction: undefined,
|
|
17
|
+
handleHeightChangeId,
|
|
18
|
+
};
|
|
13
19
|
}, [handleHeightChangeId, withdrawProps]);
|
|
14
|
-
|
|
15
|
-
return
|
|
20
|
+
const messageHandlers = (0, react_1.useMemo)(() => {
|
|
21
|
+
return {
|
|
22
|
+
...(0, common_1.getHandlers)(withdrawProps),
|
|
23
|
+
handleHeightChange: withdrawProps.handleHeightChange,
|
|
24
|
+
};
|
|
16
25
|
}, [withdrawProps]);
|
|
17
|
-
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame,
|
|
26
|
+
return react_1.default.createElement(CoinflowIFrame_1.CoinflowIFrame, { ...iframeProps, ...messageHandlers });
|
|
18
27
|
}
|
|
19
28
|
//# sourceMappingURL=CoinflowWithdraw.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CoinflowWithdraw.js","sourceRoot":"","sources":["../../src/CoinflowWithdraw.tsx"],"names":[],"mappings":";;;;AAAA,uDAAqC;AACrC,qDAA+E;AAC/E,qCAMkB;AAElB,0BAAiC,aAAoC;IACnE,MAAM,oBAAoB,GAAG,IAAA,8CAA6B,GAAE,CAAC;IAC7D,MAAM,WAAW,GAAG,IAAA,eAAO,EAAsB,GAAG,EAAE;QACpD,MAAM,YAAY,GAAG,IAAA,wBAAe,EAAC,aAAa,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,aAAa;YAChB,YAAY;YACZ,KAAK,EAAE,aAAa,aAAa,CAAC,UAAU,EAAE;YAC9C,WAAW,EAAE,SAAS;YACtB,oBAAoB;SACrB,CAAC;IACJ,CAAC,EAAE,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAAC,CAAC;IAE1C,MAAM,eAAe,GAAG,IAAA,eAAO,EAAwB,GAAG,EAAE;QAC1D,OAAO;YACL,GAAG,IAAA,oBAAW,EAAC,aAAa,CAAC;YAC7B,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;SACrD,CAAC;IACJ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,OAAO,8BAAC,+BAAc,OAAK,WAAW,KAAM,eAAe,GAAI,CAAC;AAClE,CAAC"}
|