@coinflowlabs/angular 0.1.3 → 0.2.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/esm2022/lib/common/CoinflowLibMessageHandlers.mjs +2 -1
- package/esm2022/lib/common/CoinflowTypes.mjs +7 -1
- package/esm2022/lib/common/CoinflowUtils.mjs +65 -2
- package/esm2022/lib/common/card-form/TokenEx.mjs +11 -0
- package/esm2022/lib/common/card-form/tokenexHelpers.mjs +153 -0
- package/esm2022/lib/common/index.mjs +3 -1
- package/fesm2022/coinflowlabs-angular.mjs +232 -1
- package/fesm2022/coinflowlabs-angular.mjs.map +1 -1
- package/lib/common/CoinflowTypes.d.ts +26 -7
- package/lib/common/CoinflowUtils.d.ts +13 -2
- package/lib/common/card-form/TokenEx.d.ts +154 -0
- package/lib/common/card-form/tokenexHelpers.d.ts +28 -0
- package/lib/common/index.d.ts +2 -0
- package/package.json +4 -3
|
@@ -34,7 +34,7 @@ export interface CustomerInfo {
|
|
|
34
34
|
lng?: string;
|
|
35
35
|
}
|
|
36
36
|
/** Coinflow Types **/
|
|
37
|
-
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';
|
|
37
|
+
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base' | 'arbitrum';
|
|
38
38
|
export type CoinflowEnvs = 'prod' | 'staging' | 'staging-live' | 'sandbox' | 'local';
|
|
39
39
|
export interface CoinflowTypes {
|
|
40
40
|
merchantId: string;
|
|
@@ -113,7 +113,10 @@ export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
113
113
|
export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
114
114
|
blockchain: 'base';
|
|
115
115
|
}
|
|
116
|
-
export
|
|
116
|
+
export interface CoinflowArbitrumHistoryProps extends CoinflowEvmHistoryProps {
|
|
117
|
+
blockchain: 'arbitrum';
|
|
118
|
+
}
|
|
119
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps;
|
|
117
120
|
/** Transactions **/
|
|
118
121
|
export type NearFtTransferCallAction = {
|
|
119
122
|
methodName: 'ft_transfer_call';
|
|
@@ -147,6 +150,11 @@ export interface ChargebackProtectionItem {
|
|
|
147
150
|
*/
|
|
148
151
|
rawProductData?: RawProductData;
|
|
149
152
|
}
|
|
153
|
+
export declare enum ThreeDsChallengePreference {
|
|
154
|
+
NoPreference = "NoPreference",
|
|
155
|
+
Frictionless = "Frictionless",
|
|
156
|
+
Challenge = "Challenge"
|
|
157
|
+
}
|
|
150
158
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
151
159
|
amount?: number | string;
|
|
152
160
|
onSuccess?: OnSuccessMethod;
|
|
@@ -170,6 +178,7 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
170
178
|
* The origin array would then be: [https://foo.com,https://bar.com]
|
|
171
179
|
*/
|
|
172
180
|
origins?: string[];
|
|
181
|
+
threeDsChallengePreference?: ThreeDsChallengePreference;
|
|
173
182
|
}
|
|
174
183
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
175
184
|
wallet: SolanaWallet;
|
|
@@ -206,7 +215,10 @@ export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
|
206
215
|
export interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {
|
|
207
216
|
blockchain: 'base';
|
|
208
217
|
}
|
|
209
|
-
export
|
|
218
|
+
export interface CoinflowArbitrumPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
219
|
+
blockchain: 'arbitrum';
|
|
220
|
+
}
|
|
221
|
+
export type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowNearPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps | CoinflowArbitrumPurchaseProps;
|
|
210
222
|
/** Withdraw **/
|
|
211
223
|
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
212
224
|
onSuccess?: OnSuccessMethod;
|
|
@@ -217,7 +229,7 @@ export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
|
217
229
|
bankAccountLinkRedirect?: string;
|
|
218
230
|
additionalWallets?: {
|
|
219
231
|
wallet: string;
|
|
220
|
-
blockchain: 'solana' | 'eth' | 'near' | 'polygon';
|
|
232
|
+
blockchain: 'solana' | 'eth' | 'near' | 'polygon' | 'base' | 'arbitrum';
|
|
221
233
|
}[];
|
|
222
234
|
lockAmount?: boolean;
|
|
223
235
|
transactionSigner?: string;
|
|
@@ -254,7 +266,10 @@ export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
|
254
266
|
export interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
255
267
|
blockchain: 'base';
|
|
256
268
|
}
|
|
257
|
-
export
|
|
269
|
+
export interface CoinflowArbitrumWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
270
|
+
blockchain: 'arbitrum';
|
|
271
|
+
}
|
|
272
|
+
export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps | CoinflowArbitrumWithdrawProps;
|
|
258
273
|
export interface CommonEvmRedeem {
|
|
259
274
|
waitForHash?: boolean;
|
|
260
275
|
}
|
|
@@ -287,8 +302,12 @@ export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
|
287
302
|
items: ReservoirItems;
|
|
288
303
|
taker?: string;
|
|
289
304
|
}
|
|
290
|
-
export
|
|
291
|
-
|
|
305
|
+
export interface TokenRedeem extends CommonEvmRedeem {
|
|
306
|
+
type: 'token';
|
|
307
|
+
destination: string;
|
|
308
|
+
}
|
|
309
|
+
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
|
|
310
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
292
311
|
walletPubkey: string | null | undefined;
|
|
293
312
|
route: string;
|
|
294
313
|
routePrefix?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps } from './CoinflowTypes';
|
|
1
|
+
import { CoinflowBlockchain, CoinflowEnvs, CoinflowIFrameProps, CoinflowPurchaseProps, SolanaWallet } from './CoinflowTypes';
|
|
2
2
|
export declare class CoinflowUtils {
|
|
3
3
|
env: CoinflowEnvs;
|
|
4
4
|
url: string;
|
|
@@ -9,7 +9,7 @@ export declare class CoinflowUtils {
|
|
|
9
9
|
}>;
|
|
10
10
|
static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
|
|
11
11
|
static getCoinflowApiUrl(env?: CoinflowEnvs): string;
|
|
12
|
-
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, }: CoinflowIFrameProps): string;
|
|
12
|
+
static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, }: CoinflowIFrameProps): string;
|
|
13
13
|
static getTransaction(props: CoinflowPurchaseProps): string | undefined;
|
|
14
14
|
static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
|
|
15
15
|
solana: T;
|
|
@@ -17,5 +17,16 @@ export declare class CoinflowUtils {
|
|
|
17
17
|
eth: T;
|
|
18
18
|
polygon: T;
|
|
19
19
|
base: T;
|
|
20
|
+
arbitrum: T;
|
|
20
21
|
}): T;
|
|
22
|
+
static getWalletFromUserId({ userId, merchantId, env, }: {
|
|
23
|
+
userId: string;
|
|
24
|
+
merchantId: string;
|
|
25
|
+
env: CoinflowEnvs;
|
|
26
|
+
}): Promise<SolanaWallet>;
|
|
27
|
+
static getWalletFromEmail({ email, merchantId, env, }: {
|
|
28
|
+
email: string;
|
|
29
|
+
merchantId: string;
|
|
30
|
+
env: CoinflowEnvs;
|
|
31
|
+
}): Promise<SolanaWallet>;
|
|
21
32
|
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { CardType, CoinflowEnvs } from '../CoinflowTypes';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export declare const TokenExCardNumberIframeId = "tokenExCardNumber";
|
|
4
|
+
export declare const TokenExCvvContainerID = "tokenExCardCvv";
|
|
5
|
+
export interface TokenExIframe extends ReturnType<typeof TokenEx.Iframe> {
|
|
6
|
+
tokenize: () => Promise<TokenizationResponse>;
|
|
7
|
+
}
|
|
8
|
+
export declare const CARD_TYPE_MAPPING: Record<CardType, string>;
|
|
9
|
+
export interface TokenExIFrameConfiguration {
|
|
10
|
+
origin: string;
|
|
11
|
+
timestamp: string;
|
|
12
|
+
tokenExID: string;
|
|
13
|
+
tokenScheme: string;
|
|
14
|
+
authenticationKey: string;
|
|
15
|
+
pci: true;
|
|
16
|
+
token?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CardFormInputStyles {
|
|
19
|
+
base: CSSProperties | string;
|
|
20
|
+
placeholder?: CSSProperties | string;
|
|
21
|
+
focus?: CSSProperties | string;
|
|
22
|
+
error?: CSSProperties | string;
|
|
23
|
+
}
|
|
24
|
+
export type CoinflowCardTokenResponse = {
|
|
25
|
+
token: string;
|
|
26
|
+
};
|
|
27
|
+
export interface CoinflowCardNumberInputProps {
|
|
28
|
+
env: CoinflowEnvs;
|
|
29
|
+
css: CardFormInputStyles & {
|
|
30
|
+
cvv: CardFormInputStyles;
|
|
31
|
+
};
|
|
32
|
+
debug?: boolean;
|
|
33
|
+
origins?: string[];
|
|
34
|
+
font?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface CoinflowCvvOnlyInputProps {
|
|
37
|
+
token: string;
|
|
38
|
+
cardType: CardType;
|
|
39
|
+
env: CoinflowEnvs;
|
|
40
|
+
css: CardFormInputStyles & {
|
|
41
|
+
cvv: CardFormInputStyles;
|
|
42
|
+
};
|
|
43
|
+
debug?: boolean;
|
|
44
|
+
origins?: string[];
|
|
45
|
+
font?: string;
|
|
46
|
+
}
|
|
47
|
+
export interface TokenizationResponse {
|
|
48
|
+
cardType: string;
|
|
49
|
+
cvvIncluded: true;
|
|
50
|
+
firstSix: string;
|
|
51
|
+
lastFour: string;
|
|
52
|
+
referenceNumber: string;
|
|
53
|
+
token: string;
|
|
54
|
+
tokenHMAC: string;
|
|
55
|
+
}
|
|
56
|
+
declare global {
|
|
57
|
+
namespace TokenEx {
|
|
58
|
+
interface FraudServicesConfig {
|
|
59
|
+
useKount?: boolean;
|
|
60
|
+
kount?: {
|
|
61
|
+
merchantId?: string;
|
|
62
|
+
mode?: string;
|
|
63
|
+
anId?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
interface Config {
|
|
67
|
+
debug?: boolean;
|
|
68
|
+
enablePrettyFormat?: boolean;
|
|
69
|
+
maskInput?: boolean;
|
|
70
|
+
enableValidateOnBlur?: boolean;
|
|
71
|
+
enableAriaRequired?: boolean;
|
|
72
|
+
pci?: boolean;
|
|
73
|
+
cvvOnly?: boolean;
|
|
74
|
+
allowUnknownCardTypes?: boolean;
|
|
75
|
+
enableAutoComplete?: boolean;
|
|
76
|
+
returnAutoCompleteValues?: boolean;
|
|
77
|
+
returnKhash?: boolean;
|
|
78
|
+
returnWhash?: boolean;
|
|
79
|
+
enforceLuhnCompliance?: boolean;
|
|
80
|
+
use3DS?: boolean;
|
|
81
|
+
enableValidateOnKeyUp?: boolean;
|
|
82
|
+
enableValidateOnCvvKeyUp?: boolean;
|
|
83
|
+
expiresInSeconds?: number;
|
|
84
|
+
useExtendedBIN?: boolean;
|
|
85
|
+
inlineIframeJavaScript?: boolean;
|
|
86
|
+
iframeVersion?: number;
|
|
87
|
+
authenticationKey?: string;
|
|
88
|
+
origin?: string;
|
|
89
|
+
tokenExID?: string;
|
|
90
|
+
timestamp?: string;
|
|
91
|
+
tokenScheme?: string;
|
|
92
|
+
token?: string;
|
|
93
|
+
customDataLabel?: string;
|
|
94
|
+
customCvvDataLabel?: string;
|
|
95
|
+
title?: string;
|
|
96
|
+
cvvTitle?: string;
|
|
97
|
+
inputTitle?: string;
|
|
98
|
+
cvvInputTitle?: string;
|
|
99
|
+
cardMaxLengths?: {
|
|
100
|
+
visa?: number;
|
|
101
|
+
mastercard?: number;
|
|
102
|
+
americanExpress?: number;
|
|
103
|
+
discover?: number;
|
|
104
|
+
jcb?: number;
|
|
105
|
+
diners?: number;
|
|
106
|
+
};
|
|
107
|
+
fraudServices?: FraudServicesConfig;
|
|
108
|
+
threeDSMethodNotificationUrl?: string;
|
|
109
|
+
customDataTypes?: string | object;
|
|
110
|
+
cvvContainerID?: string;
|
|
111
|
+
cvvPlaceholder?: string;
|
|
112
|
+
cardType?: string;
|
|
113
|
+
forterSiteId?: string;
|
|
114
|
+
forterUsername?: string;
|
|
115
|
+
customRegEx?: string;
|
|
116
|
+
placeholder?: string;
|
|
117
|
+
inputType?: string;
|
|
118
|
+
inputMode?: string;
|
|
119
|
+
font?: string;
|
|
120
|
+
cvv?: boolean;
|
|
121
|
+
styles: {
|
|
122
|
+
base: string;
|
|
123
|
+
focus: string;
|
|
124
|
+
error: string;
|
|
125
|
+
placeholder: string;
|
|
126
|
+
cvv: {
|
|
127
|
+
base: string;
|
|
128
|
+
focus: string;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
error: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface IframeAPI {
|
|
135
|
+
load(): void;
|
|
136
|
+
on: (event: string, callback: (data?: any) => void) => void;
|
|
137
|
+
tokenize(): void;
|
|
138
|
+
validate(): void;
|
|
139
|
+
reset(): void;
|
|
140
|
+
blur(): void;
|
|
141
|
+
cvvBlur(): void;
|
|
142
|
+
focus(): void;
|
|
143
|
+
cvvFocus(): void;
|
|
144
|
+
remove(): void;
|
|
145
|
+
toggleMask(): void;
|
|
146
|
+
toggleCvvMask(): void;
|
|
147
|
+
setPAN(pan: string): void;
|
|
148
|
+
binLookup(): void;
|
|
149
|
+
validateConfig(): void;
|
|
150
|
+
setFraudServicesRequestDetails(data: string): void;
|
|
151
|
+
}
|
|
152
|
+
function Iframe(containerID: string, configuration: Config): IframeAPI;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TokenExIframe, TokenExIFrameConfiguration } from './TokenEx';
|
|
2
|
+
import { CardType, CoinflowEnvs } from '../CoinflowTypes';
|
|
3
|
+
export interface DoInitializeTokenExIframeArgs {
|
|
4
|
+
css: string;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
font?: string;
|
|
7
|
+
origins: string[] | undefined;
|
|
8
|
+
tokenExScriptLoaded: boolean;
|
|
9
|
+
env: CoinflowEnvs;
|
|
10
|
+
setCachedToken: (s: string | undefined) => void;
|
|
11
|
+
setLoaded: (b: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export interface DoInitializeCvvOnlyTokenExIframeArgs extends DoInitializeTokenExIframeArgs {
|
|
14
|
+
token: string;
|
|
15
|
+
cardType: CardType;
|
|
16
|
+
}
|
|
17
|
+
export declare function getIframeConfig({ token, origins, env, }: {
|
|
18
|
+
token?: string;
|
|
19
|
+
origins: string[] | undefined;
|
|
20
|
+
env: CoinflowEnvs;
|
|
21
|
+
}): Promise<TokenExIFrameConfiguration>;
|
|
22
|
+
export declare function setTokenExScriptTag({ env, setTokenExScriptLoaded, }: {
|
|
23
|
+
env: CoinflowEnvs;
|
|
24
|
+
setTokenExScriptLoaded: (b: boolean) => void;
|
|
25
|
+
}): void;
|
|
26
|
+
export declare function doInitializeCvvOnlyTokenExIframe(args: DoInitializeCvvOnlyTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
|
27
|
+
export declare function doInitializeTokenExIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
|
28
|
+
export declare function doInitializeTokenExCardOnlyIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
|
package/lib/common/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^17.3.0",
|
|
6
6
|
"@angular/core": "^17.3.0",
|
|
7
7
|
"@coinflowlabs/lib-common": "*",
|
|
8
8
|
"@solana/web3.js": ">=1.54.0",
|
|
9
9
|
"bs58": "~5.0.0",
|
|
10
|
-
"lz-string": "^1.5.0"
|
|
10
|
+
"lz-string": "^1.5.0",
|
|
11
|
+
"tweetnacl": "^1.0.3"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"tslib": "^2.
|
|
14
|
+
"tslib": "^2.7.0"
|
|
14
15
|
},
|
|
15
16
|
"peerDependenciesMeta": {
|
|
16
17
|
"@coinflowlabs/lib-common": {
|