@coinflowlabs/react 4.5.1 → 5.0.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 +19 -3
- package/build/cjs/card-form/CoinflowCardForm.d.ts +4 -4
- package/build/cjs/card-form/CoinflowCardForm.js +12 -9
- package/build/cjs/card-form/CoinflowCardForm.js.map +1 -1
- package/build/cjs/card-form/CoinflowCardFormHeader.d.ts +3 -3
- package/build/cjs/card-form/CoinflowCardFormHeader.js +4 -5
- package/build/cjs/card-form/CoinflowCardFormHeader.js.map +1 -1
- package/build/cjs/card-form/useCardFormIframe.d.ts +4 -2
- package/build/cjs/card-form/useCardFormIframe.js +16 -11
- package/build/cjs/card-form/useCardFormIframe.js.map +1 -1
- package/build/cjs/common/CoinflowLibMessageHandlers.d.ts +2 -2
- package/build/cjs/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/cjs/common/CoinflowTypes.d.ts +14 -6
- package/build/cjs/common/CoinflowTypes.js.map +1 -1
- package/build/cjs/common/CoinflowUtils.d.ts +2 -15
- package/build/cjs/common/CoinflowUtils.js +18 -111
- package/build/cjs/common/CoinflowUtils.js.map +1 -1
- package/build/cjs/common/Subtotal.d.ts +37 -0
- package/build/cjs/common/Subtotal.js +11 -0
- package/build/cjs/common/Subtotal.js.map +1 -0
- package/build/cjs/common/card-form/TokenEx.d.ts +19 -2
- package/build/cjs/common/card-form/tokenexHelpers.d.ts +14 -7
- package/build/cjs/common/card-form/tokenexHelpers.js +20 -20
- package/build/cjs/common/card-form/tokenexHelpers.js.map +1 -1
- package/build/cjs/common/index.d.ts +1 -0
- package/build/cjs/common/index.js +1 -0
- package/build/cjs/common/index.js.map +1 -1
- package/build/esm/card-form/CoinflowCardForm.d.ts +4 -4
- package/build/esm/card-form/CoinflowCardForm.js +12 -9
- package/build/esm/card-form/CoinflowCardForm.js.map +1 -1
- package/build/esm/card-form/CoinflowCardFormHeader.d.ts +3 -3
- package/build/esm/card-form/CoinflowCardFormHeader.js +4 -5
- package/build/esm/card-form/CoinflowCardFormHeader.js.map +1 -1
- package/build/esm/card-form/useCardFormIframe.d.ts +4 -2
- package/build/esm/card-form/useCardFormIframe.js +16 -11
- package/build/esm/card-form/useCardFormIframe.js.map +1 -1
- package/build/esm/common/CoinflowLibMessageHandlers.d.ts +2 -2
- package/build/esm/common/CoinflowLibMessageHandlers.js.map +1 -1
- package/build/esm/common/CoinflowTypes.d.ts +14 -6
- package/build/esm/common/CoinflowTypes.js.map +1 -1
- package/build/esm/common/CoinflowUtils.d.ts +2 -15
- package/build/esm/common/CoinflowUtils.js +18 -111
- package/build/esm/common/CoinflowUtils.js.map +1 -1
- package/build/esm/common/Subtotal.d.ts +37 -0
- package/build/esm/common/Subtotal.js +8 -0
- package/build/esm/common/Subtotal.js.map +1 -0
- package/build/esm/common/card-form/TokenEx.d.ts +19 -2
- package/build/esm/common/card-form/tokenexHelpers.d.ts +14 -7
- package/build/esm/common/card-form/tokenexHelpers.js +21 -21
- package/build/esm/common/card-form/tokenexHelpers.js.map +1 -1
- package/build/esm/common/index.d.ts +1 -0
- package/build/esm/common/index.js +1 -0
- package/build/esm/common/index.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -6
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ const connection = useConnection();
|
|
|
40
40
|
|
|
41
41
|
Props:
|
|
42
42
|
|
|
43
|
+
- `subtotal` (optional): Fix the amount of purchase
|
|
43
44
|
- `wallet`: The Solana Wallet Adapter Wallet
|
|
44
45
|
- `merchantId`: Your Merchant ID (Contact Coinflow support for this)
|
|
45
46
|
- `connection`: Solana Connection
|
|
@@ -47,12 +48,9 @@ Props:
|
|
|
47
48
|
- For testing set to `staging`
|
|
48
49
|
- `onSuccess` (optional): function to run when the purchase process is successful
|
|
49
50
|
- `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
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
52
|
- `planCode` (optional): When a subscription is being purchased, the code of the subscription plan.
|
|
54
53
|
- `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
54
|
- `webhookInfo` (optional): Product or transaction based information that you want transmitted when you receive webhooks regarding the purchase
|
|
57
55
|
- `email` (optional): Set the default email to use in email entry fields
|
|
58
56
|
- `chargebackProtectionData` (optional):
|
|
@@ -72,6 +70,24 @@ Props:
|
|
|
72
70
|
|
|
73
71
|
# Changelog
|
|
74
72
|
|
|
73
|
+
## 5.0.0
|
|
74
|
+
|
|
75
|
+
- Deprecating `amount` and `token` in favor of subtotal which can be accessed via the following ways:
|
|
76
|
+
- Added multi-currency support for presentment
|
|
77
|
+
- SEPA and UK Faster Payments support
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
{cents: number; currency: 'USD' | 'EUR' | 'GBP' | 'BRL';}
|
|
81
|
+
```
|
|
82
|
+
or
|
|
83
|
+
```js
|
|
84
|
+
{address: string; amount: number;}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 4.5.2
|
|
88
|
+
|
|
89
|
+
- Updating optional peer dependencies to play nice with various bundlers
|
|
90
|
+
|
|
75
91
|
## 4.5.1
|
|
76
92
|
|
|
77
93
|
- Added sessionKey authentication mechanism to `CoinflowWithdraw`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { CoinflowCardNumberInputProps, CoinflowCvvOnlyInputProps } from '../common';
|
|
2
|
+
import { MerchantIdOrCheckoutJwt, CoinflowCardNumberInputProps, CoinflowCvvOnlyInputProps } from '../common';
|
|
3
3
|
/**
|
|
4
4
|
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive the tokenized card number.
|
|
5
5
|
*
|
|
@@ -36,7 +36,7 @@ import { CoinflowCardNumberInputProps, CoinflowCvvOnlyInputProps } from '../comm
|
|
|
36
36
|
*
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
|
-
export declare const CoinflowCardNumberInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<CoinflowCardNumberInputProps & React.RefAttributes<unknown>>>;
|
|
39
|
+
export declare const CoinflowCardNumberInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<(CoinflowCardNumberInputProps & MerchantIdOrCheckoutJwt) & React.RefAttributes<unknown>>>;
|
|
40
40
|
/**
|
|
41
41
|
* The CVV number input for creating a new tokenized card
|
|
42
42
|
*/
|
|
@@ -78,7 +78,7 @@ export declare const CoinflowCvvInput: React.MemoExoticComponent<() => React.JSX
|
|
|
78
78
|
*
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
export declare const CoinflowCvvOnlyInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<CoinflowCvvOnlyInputProps & React.RefAttributes<unknown>>>;
|
|
81
|
+
export declare const CoinflowCvvOnlyInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<(CoinflowCvvOnlyInputProps & MerchantIdOrCheckoutJwt) & React.RefAttributes<unknown>>>;
|
|
82
82
|
/**
|
|
83
83
|
* Allows merchants to collect card information from their customers in a PCI-compliant way and receive the tokenized card number.
|
|
84
84
|
* The `CoinflowCardOnlyInput` is used for collecting a debit card for users to be able to withdraw their funds directly to.
|
|
@@ -115,4 +115,4 @@ export declare const CoinflowCvvOnlyInput: React.MemoExoticComponent<React.Forwa
|
|
|
115
115
|
*
|
|
116
116
|
* ```
|
|
117
117
|
*/
|
|
118
|
-
export declare const CoinflowCardOnlyInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<CoinflowCvvOnlyInputProps & React.RefAttributes<unknown>>>;
|
|
118
|
+
export declare const CoinflowCardOnlyInput: React.MemoExoticComponent<React.ForwardRefExoticComponent<(CoinflowCvvOnlyInputProps & MerchantIdOrCheckoutJwt) & React.RefAttributes<unknown>>>;
|
|
@@ -9,7 +9,8 @@ var CoinflowCardNumberInputComponent = (0, react_1.forwardRef)(function (props,
|
|
|
9
9
|
var css = (0, react_1.useMemo)(function () {
|
|
10
10
|
return JSON.stringify(props.css);
|
|
11
11
|
}, [props.css]);
|
|
12
|
-
var
|
|
12
|
+
var origins = JSON.stringify(props.origins);
|
|
13
|
+
var _a = (0, useCardFormIframe_1.useCardFormIframe)(props), tokenExIframe = _a.tokenExIframe, initializeTokenExIframe = _a.initializeTokenExIframe;
|
|
13
14
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
14
15
|
getToken: function () {
|
|
15
16
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -25,10 +26,10 @@ var CoinflowCardNumberInputComponent = (0, react_1.forwardRef)(function (props,
|
|
|
25
26
|
initializeTokenExIframe({
|
|
26
27
|
css: css,
|
|
27
28
|
debug: props.debug,
|
|
28
|
-
origins:
|
|
29
|
+
origins: JSON.parse(origins),
|
|
29
30
|
font: props.font,
|
|
30
31
|
});
|
|
31
|
-
}, [
|
|
32
|
+
}, [css, props.debug, props.font, origins, initializeTokenExIframe]);
|
|
32
33
|
return react_1.default.createElement("div", { id: common_1.TokenExCardNumberIframeId });
|
|
33
34
|
});
|
|
34
35
|
/**
|
|
@@ -76,7 +77,8 @@ var CoinflowCvvOnlyInputComponent = (0, react_1.forwardRef)(function (props, ref
|
|
|
76
77
|
var css = (0, react_1.useMemo)(function () {
|
|
77
78
|
return JSON.stringify(props.css);
|
|
78
79
|
}, [props.css]);
|
|
79
|
-
var
|
|
80
|
+
var origins = JSON.stringify(props.origins);
|
|
81
|
+
var _a = (0, useCardFormIframe_1.useCardFormIframe)(props), tokenExIframe = _a.tokenExIframe, initializeCvvOnlyTokenExIframe = _a.initializeCvvOnlyTokenExIframe;
|
|
80
82
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
81
83
|
getToken: function () {
|
|
82
84
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -94,7 +96,7 @@ var CoinflowCvvOnlyInputComponent = (0, react_1.forwardRef)(function (props, ref
|
|
|
94
96
|
debug: props.debug,
|
|
95
97
|
token: props.token,
|
|
96
98
|
cardType: props.cardType,
|
|
97
|
-
origins:
|
|
99
|
+
origins: JSON.parse(origins),
|
|
98
100
|
font: props.font,
|
|
99
101
|
});
|
|
100
102
|
}, [
|
|
@@ -103,7 +105,7 @@ var CoinflowCvvOnlyInputComponent = (0, react_1.forwardRef)(function (props, ref
|
|
|
103
105
|
props.debug,
|
|
104
106
|
props.token,
|
|
105
107
|
props.cardType,
|
|
106
|
-
|
|
108
|
+
origins,
|
|
107
109
|
props.font,
|
|
108
110
|
]);
|
|
109
111
|
return (0, react_1.useMemo)(function () { return react_1.default.createElement("div", { id: common_1.TokenExCvvContainerID }); }, []);
|
|
@@ -150,7 +152,8 @@ var CoinflowCardOnlyInputComponent = (0, react_1.forwardRef)(function (props, re
|
|
|
150
152
|
var css = (0, react_1.useMemo)(function () {
|
|
151
153
|
return JSON.stringify(props.css);
|
|
152
154
|
}, [props.css]);
|
|
153
|
-
var
|
|
155
|
+
var origins = JSON.stringify(props.origins);
|
|
156
|
+
var _a = (0, useCardFormIframe_1.useCardFormIframe)(props), tokenExIframe = _a.tokenExIframe, initializeTokenExCardOnlyIframe = _a.initializeTokenExCardOnlyIframe;
|
|
154
157
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
155
158
|
getToken: function () {
|
|
156
159
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -166,14 +169,14 @@ var CoinflowCardOnlyInputComponent = (0, react_1.forwardRef)(function (props, re
|
|
|
166
169
|
initializeTokenExCardOnlyIframe({
|
|
167
170
|
css: css,
|
|
168
171
|
debug: props.debug,
|
|
169
|
-
origins:
|
|
172
|
+
origins: JSON.parse(origins),
|
|
170
173
|
font: props.font,
|
|
171
174
|
});
|
|
172
175
|
}, [
|
|
173
176
|
initializeTokenExCardOnlyIframe,
|
|
174
177
|
props.debug,
|
|
175
178
|
css,
|
|
176
|
-
|
|
179
|
+
origins,
|
|
177
180
|
props.font,
|
|
178
181
|
]);
|
|
179
182
|
return react_1.default.createElement("div", { id: common_1.TokenExCardNumberIframeId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowCardForm.js","sourceRoot":"","sources":["../../../src/card-form/CoinflowCardForm.tsx"],"names":[],"mappings":";;;;AAAA,qDAMe;AACf,yDAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"CoinflowCardForm.js","sourceRoot":"","sources":["../../../src/card-form/CoinflowCardForm.tsx"],"names":[],"mappings":";;;;AAAA,qDAMe;AACf,yDAAsD;AACtD,oCAOmB;AAEnB,IAAM,gCAAgC,GAAG,IAAA,kBAAU,EACjD,UAAC,KAA6D,EAAE,GAAG;IACjE,IAAM,GAAG,GAAG,IAAA,eAAO,EAAC;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAEhB,IAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAExC,IAAA,KAA2C,IAAA,qCAAiB,EAAC,KAAK,CAAC,EAAlE,aAAa,mBAAA,EAAE,uBAAuB,6BAA4B,CAAC;IAE1E,IAAA,2BAAmB,EAAC,GAAG,EAAE,cAAM,OAAA,CAAC;QACxB,QAAQ;;;oBACZ,IAAI,CAAC,aAAa;wBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,sBAAO,aAAa,CAAC,QAAQ,EAAE,EAAC;;;SACjC;KACF,CAAC,EAL6B,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3B,IAAA,2BAAmB,EAAC,GAAG,EAAE,cAAM,OAAA,CAAC;QACxB,QAAQ;;;oBACZ,IAAI,CAAC,aAAa;wBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBAC3D,sBAAO,aAAa,CAAC,QAAQ,EAAE,EAAC;;;SACjC;KACF,CAAC,EAL6B,CAK7B,CAAC,CAAC;IAEJ,IAAA,iBAAS,EAAC;QACR,+BAA+B,CAAC;YAC9B,GAAG,KAAA;YACH,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;YAC5B,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC,EAAE;QACD,+BAA+B;QAC/B,KAAK,CAAC,KAAK;QACX,GAAG;QACH,OAAO;QACP,KAAK,CAAC,IAAI;KACX,CAAC,CAAC;IAEH,OAAO,uCAAK,EAAE,EAAE,kCAAyB,GAAI,CAAC;AAChD,CAAC,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACU,QAAA,qBAAqB,GAAG,IAAA,YAAI,EAAC,8BAA8B,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoinflowEnvs } from '../common';
|
|
2
|
-
export declare function CoinflowCardFormHeader(
|
|
1
|
+
import { CoinflowEnvs, MerchantIdOrCheckoutJwt } from '../common';
|
|
2
|
+
export declare function CoinflowCardFormHeader(props: {
|
|
3
3
|
env: CoinflowEnvs;
|
|
4
|
-
}): null;
|
|
4
|
+
} & MerchantIdOrCheckoutJwt): null;
|
|
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CoinflowCardFormHeader = CoinflowCardFormHeader;
|
|
4
4
|
var react_1 = require("react");
|
|
5
5
|
var useCardFormIframe_1 = require("./useCardFormIframe");
|
|
6
|
-
function CoinflowCardFormHeader(
|
|
7
|
-
var
|
|
8
|
-
var setTokenExScriptTag = (0, useCardFormIframe_1.useCardFormIframe)(env).setTokenExScriptTag;
|
|
6
|
+
function CoinflowCardFormHeader(props) {
|
|
7
|
+
var setTokenExScriptTag = (0, useCardFormIframe_1.useCardFormIframe)(props).setTokenExScriptTag;
|
|
9
8
|
(0, react_1.useEffect)(function () {
|
|
10
|
-
setTokenExScriptTag({ env: env, setTokenExScriptLoaded: function () { } });
|
|
11
|
-
}, [env, setTokenExScriptTag]);
|
|
9
|
+
setTokenExScriptTag({ env: props.env, setTokenExScriptLoaded: function () { } });
|
|
10
|
+
}, [props.env, setTokenExScriptTag]);
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=CoinflowCardFormHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowCardFormHeader.js","sourceRoot":"","sources":["../../../src/card-form/CoinflowCardFormHeader.tsx"],"names":[],"mappings":";;AAIA,
|
|
1
|
+
{"version":3,"file":"CoinflowCardFormHeader.js","sourceRoot":"","sources":["../../../src/card-form/CoinflowCardFormHeader.tsx"],"names":[],"mappings":";;AAIA,wDAUC;AAdD,+BAAgC;AAChC,yDAAsD;AAGtD,SAAgB,sBAAsB,CACpC,KAAoD;IAE7C,IAAA,mBAAmB,GAAI,IAAA,qCAAiB,EAAC,KAAK,CAAC,oBAA5B,CAA6B;IAEvD,IAAA,iBAAS,EAAC;QACR,mBAAmB,CAAC,EAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,sBAAsB,EAAE,cAAO,CAAC,EAAC,CAAC,CAAC;IAC1E,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAErC,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { CoinflowEnvs, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, setTokenExScriptTag, TokenExIframe } from '../common';
|
|
2
|
-
export declare function useCardFormIframe(env
|
|
1
|
+
import { CoinflowEnvs, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, setTokenExScriptTag, TokenExIframe, MerchantIdOrCheckoutJwt } from '../common';
|
|
2
|
+
export declare function useCardFormIframe({ env, merchantId, checkoutJwt, }: {
|
|
3
|
+
env: CoinflowEnvs;
|
|
4
|
+
} & MerchantIdOrCheckoutJwt): {
|
|
3
5
|
tokenExIframe: TokenExIframe | undefined;
|
|
4
6
|
initializeTokenExIframe: (args: Omit<Parameters<typeof doInitializeTokenExIframe>[0], "env" | "tokenExScriptLoaded" | "setCachedToken" | "setLoaded">) => Promise<TokenExIframe | undefined>;
|
|
5
7
|
initializeCvvOnlyTokenExIframe: (args: Omit<Parameters<typeof doInitializeCvvOnlyTokenExIframe>[0], "env" | "tokenExScriptLoaded" | "setCachedToken" | "setLoaded">) => Promise<TokenExIframe | undefined>;
|
|
@@ -4,12 +4,17 @@ exports.useCardFormIframe = useCardFormIframe;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = require("react");
|
|
6
6
|
var common_1 = require("../common");
|
|
7
|
-
function useCardFormIframe(
|
|
7
|
+
function useCardFormIframe(_a) {
|
|
8
8
|
var _this = this;
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
var env = _a.env,
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
merchantId = _a.merchantId,
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
checkoutJwt = _a.checkoutJwt;
|
|
14
|
+
var _b = (0, react_1.useState)(false), loaded = _b[0], setLoaded = _b[1];
|
|
15
|
+
var _c = (0, react_1.useState)(false), tokenExScriptLoaded = _c[0], setTokenExScriptLoaded = _c[1];
|
|
16
|
+
var _d = (0, react_1.useState)(undefined), tokenExIframe = _d[0], setTokenExIframe = _d[1];
|
|
17
|
+
var _e = (0, react_1.useState)(undefined), cachedToken = _e[0], setCachedToken = _e[1];
|
|
13
18
|
(0, react_1.useEffect)(function () {
|
|
14
19
|
(0, common_1.setTokenExScriptTag)({ env: env, setTokenExScriptLoaded: setTokenExScriptLoaded });
|
|
15
20
|
}, [env, setTokenExScriptLoaded]);
|
|
@@ -17,38 +22,38 @@ function useCardFormIframe(env) {
|
|
|
17
22
|
var iframe;
|
|
18
23
|
return tslib_1.__generator(this, function (_a) {
|
|
19
24
|
switch (_a.label) {
|
|
20
|
-
case 0: return [4 /*yield*/, (0, common_1.doInitializeCvvOnlyTokenExIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, env: env,
|
|
25
|
+
case 0: return [4 /*yield*/, (0, common_1.doInitializeCvvOnlyTokenExIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, setCachedToken: setCachedToken, setLoaded: setLoaded, env: env, merchantId: merchantId, checkoutJwt: checkoutJwt }))];
|
|
21
26
|
case 1:
|
|
22
27
|
iframe = _a.sent();
|
|
23
28
|
setTokenExIframe(iframe);
|
|
24
29
|
return [2 /*return*/, iframe];
|
|
25
30
|
}
|
|
26
31
|
});
|
|
27
|
-
}); }, [env, tokenExScriptLoaded]);
|
|
32
|
+
}); }, [checkoutJwt, env, merchantId, tokenExScriptLoaded]);
|
|
28
33
|
var initializeTokenExIframe = (0, react_1.useCallback)(function (args) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
29
34
|
var iframe;
|
|
30
35
|
return tslib_1.__generator(this, function (_a) {
|
|
31
36
|
switch (_a.label) {
|
|
32
|
-
case 0: return [4 /*yield*/, (0, common_1.doInitializeTokenExIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, env: env,
|
|
37
|
+
case 0: return [4 /*yield*/, (0, common_1.doInitializeTokenExIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, setCachedToken: setCachedToken, setLoaded: setLoaded, env: env, merchantId: merchantId, checkoutJwt: checkoutJwt }))];
|
|
33
38
|
case 1:
|
|
34
39
|
iframe = _a.sent();
|
|
35
40
|
setTokenExIframe(iframe);
|
|
36
41
|
return [2 /*return*/, iframe];
|
|
37
42
|
}
|
|
38
43
|
});
|
|
39
|
-
}); }, [env, tokenExScriptLoaded]);
|
|
44
|
+
}); }, [checkoutJwt, env, merchantId, tokenExScriptLoaded]);
|
|
40
45
|
var initializeTokenExCardOnlyIframe = (0, react_1.useCallback)(function (args) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
41
46
|
var iframe;
|
|
42
47
|
return tslib_1.__generator(this, function (_a) {
|
|
43
48
|
switch (_a.label) {
|
|
44
|
-
case 0: return [4 /*yield*/, (0, common_1.doInitializeTokenExCardOnlyIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, env: env,
|
|
49
|
+
case 0: return [4 /*yield*/, (0, common_1.doInitializeTokenExCardOnlyIframe)(tslib_1.__assign(tslib_1.__assign({}, args), { tokenExScriptLoaded: tokenExScriptLoaded, setCachedToken: setCachedToken, setLoaded: setLoaded, env: env, merchantId: merchantId, checkoutJwt: checkoutJwt }))];
|
|
45
50
|
case 1:
|
|
46
51
|
iframe = _a.sent();
|
|
47
52
|
setTokenExIframe(iframe);
|
|
48
53
|
return [2 /*return*/, iframe];
|
|
49
54
|
}
|
|
50
55
|
});
|
|
51
|
-
}); }, [env, tokenExScriptLoaded]);
|
|
56
|
+
}); }, [checkoutJwt, env, merchantId, tokenExScriptLoaded]);
|
|
52
57
|
(0, react_1.useEffect)(function () {
|
|
53
58
|
if (!tokenExIframe)
|
|
54
59
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCardFormIframe.js","sourceRoot":"","sources":["../../../src/card-form/useCardFormIframe.tsx"],"names":[],"mappings":";;
|
|
1
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
Loaded = "loaded"
|
|
28
28
|
}
|
|
29
|
-
export declare function getWalletPubkey(input: CoinflowPurchaseProps): string | null | undefined;
|
|
29
|
+
export declare function getWalletPubkey(input: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): string | null | undefined;
|
|
30
30
|
export declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers): Promise<string> | void;
|
|
31
|
-
export declare function getHandlers(props: CoinflowPurchaseProps): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
|
|
31
|
+
export declare function getHandlers(props: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain' | 'onSuccess'>): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
|
|
32
32
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";;AAwCA,0CA6BC;AAED,kDAqCC;AAED,kCAmEC;;AAxKD,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,yCAAiB,CAAA;AACnB,CAAC,EAPI,oBAAoB,KAApB,oBAAoB,QAOxB;AAED,SAAgB,eAAe,CAC7B,
|
|
1
|
+
{"version":3,"file":"CoinflowLibMessageHandlers.js","sourceRoot":"","sources":["../../../src/common/CoinflowLibMessageHandlers.ts"],"names":[],"mappings":";;AAwCA,0CA6BC;AAED,kDAqCC;AAED,kCAmEC;;AAxKD,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,yCAAiB,CA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|
+
import { Subtotal } from './Subtotal';
|
|
2
3
|
export declare enum SettlementType {
|
|
3
4
|
Credits = "Credits",
|
|
4
5
|
USDC = "USDC",
|
|
@@ -131,7 +132,7 @@ export type NearFtTransferCallAction = {
|
|
|
131
132
|
};
|
|
132
133
|
type Bytes = ArrayLike<number>;
|
|
133
134
|
type BytesLike = Bytes | string;
|
|
134
|
-
type RawProductData =
|
|
135
|
+
type RawProductData = any;
|
|
135
136
|
/** Purchase **/
|
|
136
137
|
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
137
138
|
export interface ChargebackProtectionItem {
|
|
@@ -161,9 +162,11 @@ export declare enum ThreeDsChallengePreference {
|
|
|
161
162
|
Challenge = "Challenge"
|
|
162
163
|
}
|
|
163
164
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
164
|
-
|
|
165
|
+
subtotal?: Subtotal;
|
|
165
166
|
onSuccess?: OnSuccessMethod;
|
|
166
|
-
webhookInfo?:
|
|
167
|
+
webhookInfo?: {
|
|
168
|
+
[key: string]: any;
|
|
169
|
+
};
|
|
167
170
|
email?: string;
|
|
168
171
|
chargebackProtectionData?: ChargebackProtectionData;
|
|
169
172
|
planCode?: string;
|
|
@@ -172,6 +175,12 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
172
175
|
customerInfo?: CustomerInfo;
|
|
173
176
|
settlementType?: SettlementType;
|
|
174
177
|
authOnly?: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* The DeviceID gotten from the Coinflow SDK:
|
|
180
|
+
* https://docs.coinflow.cash/docs/implement-chargeback-protection#how-to-add-chargeback-protection
|
|
181
|
+
*
|
|
182
|
+
* window?.nSureSDK?.getDeviceId()
|
|
183
|
+
*/
|
|
175
184
|
deviceId?: string;
|
|
176
185
|
jwtToken?: string;
|
|
177
186
|
/**
|
|
@@ -188,6 +197,7 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
188
197
|
*/
|
|
189
198
|
origins?: string[];
|
|
190
199
|
threeDsChallengePreference?: ThreeDsChallengePreference;
|
|
200
|
+
destinationAuthKey?: string;
|
|
191
201
|
}
|
|
192
202
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
193
203
|
wallet: SolanaWallet;
|
|
@@ -196,7 +206,6 @@ export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps
|
|
|
196
206
|
debugTx?: boolean;
|
|
197
207
|
connection: Connection;
|
|
198
208
|
blockchain: 'solana';
|
|
199
|
-
token?: PublicKey | string;
|
|
200
209
|
rent?: {
|
|
201
210
|
lamports: string | number;
|
|
202
211
|
};
|
|
@@ -217,7 +226,6 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
|
217
226
|
}
|
|
218
227
|
export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
219
228
|
transaction?: EvmTransactionData;
|
|
220
|
-
token?: string;
|
|
221
229
|
wallet: EthWallet;
|
|
222
230
|
}
|
|
223
231
|
export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
@@ -333,7 +341,7 @@ export interface TokenRedeem extends CommonEvmRedeem {
|
|
|
333
341
|
destination: string;
|
|
334
342
|
}
|
|
335
343
|
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
|
|
336
|
-
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | '
|
|
344
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'subtotal' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference' | 'supportEmail'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'destinationAuthKey'> {
|
|
337
345
|
walletPubkey: string | null | undefined;
|
|
338
346
|
sessionKey?: string;
|
|
339
347
|
route: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CoinflowTypes.js","sourceRoot":"","sources":["../../../src/common/CoinflowTypes.ts"],"names":[],"mappings":";;;AASA,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;AA+ND,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IACpC,2DAA6B,CAAA;IAC7B,2DAA6B,CAAA;IAC7B,qDAAuB,CAAA;AACzB,CAAC,EAJW,0BAA0B,0CAA1B,0BAA0B,QAIrC;AAuSD,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,yBAAa,CAAA;IACb,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps
|
|
1
|
+
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps } from './CoinflowTypes';
|
|
2
2
|
export declare class CoinflowUtils {
|
|
3
3
|
env: CoinflowEnvs;
|
|
4
4
|
url: string;
|
|
5
5
|
constructor(env?: CoinflowEnvs);
|
|
6
6
|
getNSurePartnerId(merchantId: string): Promise<string | undefined>;
|
|
7
|
-
getCreditBalance(publicKey: string, merchantId: string, blockchain: 'solana' | 'near'): Promise<{
|
|
8
|
-
cents: number;
|
|
9
|
-
}>;
|
|
10
7
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
11
8
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
12
|
-
static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env,
|
|
9
|
+
static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, subtotal, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, destinationAuthKey, }: CoinflowIFrameProps): string;
|
|
13
10
|
static getTransaction(props: CoinflowPurchaseProps): string | undefined;
|
|
14
11
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
15
12
|
solana: T;
|
|
@@ -20,14 +17,4 @@ export declare class CoinflowUtils {
|
|
|
20
17
|
arbitrum: T;
|
|
21
18
|
user: T;
|
|
22
19
|
}): T;
|
|
23
|
-
static getWalletFromUserId({ userId, merchantId, env, }: {
|
|
24
|
-
userId: string;
|
|
25
|
-
merchantId: string;
|
|
26
|
-
env: CoinflowEnvs;
|
|
27
|
-
}): Promise<SolanaWallet>;
|
|
28
|
-
static getWalletFromEmail({ email, merchantId, env, }: {
|
|
29
|
-
email: string;
|
|
30
|
-
merchantId: string;
|
|
31
|
-
env: CoinflowEnvs;
|
|
32
|
-
}): Promise<SolanaWallet>;
|
|
33
20
|
}
|