@coinflowlabs/angular 0.3.0 → 0.3.2
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/card-form/coinflow-card-number-input.component.mjs +12 -2
- package/esm2022/lib/card-form/coinflow-card-number-only-input.component.mjs +12 -2
- package/esm2022/lib/card-form/coinflow-cvv-only-input.component.mjs +12 -2
- package/esm2022/lib/common/CoinflowLibMessageHandlers.mjs +71 -31
- package/esm2022/lib/common/CoinflowTypes.mjs +1 -1
- package/esm2022/lib/common/CoinflowUtils.mjs +4 -66
- package/fesm2022/coinflowlabs-angular.mjs +106 -98
- package/fesm2022/coinflowlabs-angular.mjs.map +1 -1
- package/lib/card-form/coinflow-card-number-input.component.d.ts +5 -1
- package/lib/card-form/coinflow-card-number-only-input.component.d.ts +5 -1
- package/lib/card-form/coinflow-cvv-only-input.component.d.ts +5 -1
- package/lib/common/CoinflowLibMessageHandlers.d.ts +4 -4
- package/lib/common/CoinflowTypes.d.ts +39 -13
- package/lib/common/CoinflowUtils.d.ts +2 -15
- package/package.json +2 -2
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
1
2
|
import { CoinflowCardNumberInputProps } from '../common';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class CoinflowCardNumberOnlyInput {
|
|
4
|
+
export declare class CoinflowCardNumberOnlyInput implements OnDestroy {
|
|
4
5
|
private cardFormService;
|
|
5
6
|
args: CoinflowCardNumberInputProps;
|
|
6
7
|
private iframe;
|
|
7
8
|
private onScriptLoaded;
|
|
9
|
+
private initializeTokenEx;
|
|
10
|
+
reinitialize(): void;
|
|
8
11
|
ngOnInit(): void;
|
|
12
|
+
ngOnDestroy(): void;
|
|
9
13
|
tokenize(): Promise<import("../common").TokenizationResponse>;
|
|
10
14
|
protected readonly TokenExCardNumberIframeId = "tokenExCardNumber";
|
|
11
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<CoinflowCardNumberOnlyInput, never>;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { OnDestroy } from '@angular/core';
|
|
1
2
|
import { CoinflowCvvOnlyInputProps } from '../common';
|
|
2
3
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class CoinflowCvvOnlyInputComponent {
|
|
4
|
+
export declare class CoinflowCvvOnlyInputComponent implements OnDestroy {
|
|
4
5
|
private cardFormService;
|
|
5
6
|
args: CoinflowCvvOnlyInputProps;
|
|
6
7
|
private iframe;
|
|
7
8
|
private onScriptLoaded;
|
|
9
|
+
private initializeTokenEx;
|
|
10
|
+
reinitialize(): void;
|
|
8
11
|
ngOnInit(): void;
|
|
12
|
+
ngOnDestroy(): void;
|
|
9
13
|
tokenize(): Promise<import("../common").TokenizationResponse>;
|
|
10
14
|
protected readonly TokenExCvvContainerID = "tokenExCardCvv";
|
|
11
15
|
static ɵfac: i0.ɵɵFactoryDeclaration<CoinflowCvvOnlyInputComponent, never>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoinflowPurchaseProps,
|
|
1
|
+
import { CoinflowPurchaseProps, OnSuccessMethod } from './CoinflowTypes';
|
|
2
2
|
export type WalletCall = {
|
|
3
3
|
method: IFrameMessageMethods;
|
|
4
4
|
data: string;
|
|
@@ -24,9 +24,9 @@ declare enum IFrameMessageMethods {
|
|
|
24
24
|
SendTransaction = "sendTransaction",
|
|
25
25
|
HeightChange = "heightChange",
|
|
26
26
|
Success = "success",
|
|
27
|
-
|
|
27
|
+
Loaded = "loaded"
|
|
28
28
|
}
|
|
29
|
-
export declare function getWalletPubkey(input:
|
|
29
|
+
export declare function getWalletPubkey(input: CoinflowPurchaseProps): string | null | undefined;
|
|
30
30
|
export declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers): Promise<string> | void;
|
|
31
|
-
export declare function getHandlers(props:
|
|
31
|
+
export declare function getHandlers(props: CoinflowPurchaseProps): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
|
|
32
32
|
export {};
|
|
@@ -97,12 +97,17 @@ export interface CoinflowSolanaHistoryProps extends CoinflowTypes {
|
|
|
97
97
|
connection: Connection;
|
|
98
98
|
blockchain: 'solana';
|
|
99
99
|
}
|
|
100
|
+
export interface CoinflowSessionKeyHistoryProps extends CoinflowTypes {
|
|
101
|
+
sessionKey: string;
|
|
102
|
+
blockchain?: undefined;
|
|
103
|
+
}
|
|
100
104
|
export interface CoinflowNearHistoryProps extends CoinflowTypes {
|
|
101
105
|
wallet: NearWallet;
|
|
102
106
|
blockchain: 'near';
|
|
103
107
|
}
|
|
104
108
|
export interface CoinflowEvmHistoryProps extends CoinflowTypes {
|
|
105
109
|
wallet: EthWallet;
|
|
110
|
+
blockchain: 'eth' | 'polygon' | 'base' | 'arbitrum';
|
|
106
111
|
}
|
|
107
112
|
export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
|
|
108
113
|
blockchain: 'eth';
|
|
@@ -116,7 +121,7 @@ export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
|
116
121
|
export interface CoinflowArbitrumHistoryProps extends CoinflowEvmHistoryProps {
|
|
117
122
|
blockchain: 'arbitrum';
|
|
118
123
|
}
|
|
119
|
-
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps;
|
|
124
|
+
export type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowNearHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps | CoinflowSessionKeyHistoryProps;
|
|
120
125
|
/** Transactions **/
|
|
121
126
|
export type NearFtTransferCallAction = {
|
|
122
127
|
methodName: 'ft_transfer_call';
|
|
@@ -126,7 +131,7 @@ export type NearFtTransferCallAction = {
|
|
|
126
131
|
};
|
|
127
132
|
type Bytes = ArrayLike<number>;
|
|
128
133
|
type BytesLike = Bytes | string;
|
|
129
|
-
type RawProductData =
|
|
134
|
+
type RawProductData = any;
|
|
130
135
|
/** Purchase **/
|
|
131
136
|
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
132
137
|
export interface ChargebackProtectionItem {
|
|
@@ -158,7 +163,9 @@ export declare enum ThreeDsChallengePreference {
|
|
|
158
163
|
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
159
164
|
amount?: number | string;
|
|
160
165
|
onSuccess?: OnSuccessMethod;
|
|
161
|
-
webhookInfo?:
|
|
166
|
+
webhookInfo?: {
|
|
167
|
+
[key: string]: any;
|
|
168
|
+
};
|
|
162
169
|
email?: string;
|
|
163
170
|
chargebackProtectionData?: ChargebackProtectionData;
|
|
164
171
|
planCode?: string;
|
|
@@ -167,6 +174,12 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
167
174
|
customerInfo?: CustomerInfo;
|
|
168
175
|
settlementType?: SettlementType;
|
|
169
176
|
authOnly?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The DeviceID gotten from the Coinflow SDK:
|
|
179
|
+
* https://docs.coinflow.cash/docs/implement-chargeback-protection#how-to-add-chargeback-protection
|
|
180
|
+
*
|
|
181
|
+
* window?.nSureSDK?.getDeviceId()
|
|
182
|
+
*/
|
|
170
183
|
deviceId?: string;
|
|
171
184
|
jwtToken?: string;
|
|
172
185
|
/**
|
|
@@ -183,6 +196,7 @@ export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
|
183
196
|
*/
|
|
184
197
|
origins?: string[];
|
|
185
198
|
threeDsChallengePreference?: ThreeDsChallengePreference;
|
|
199
|
+
destinationAuthKey?: string;
|
|
186
200
|
}
|
|
187
201
|
export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
188
202
|
wallet: SolanaWallet;
|
|
@@ -252,33 +266,45 @@ export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
|
252
266
|
*/
|
|
253
267
|
origins?: string[];
|
|
254
268
|
}
|
|
255
|
-
export
|
|
269
|
+
export type WalletTypes = SolanaWallet | NearWallet | EthWallet;
|
|
270
|
+
export interface SolanaWalletProps {
|
|
256
271
|
wallet: SolanaWallet;
|
|
257
272
|
connection: Connection;
|
|
258
273
|
blockchain: 'solana';
|
|
259
274
|
}
|
|
260
|
-
export
|
|
275
|
+
export type CoinflowSolanaWithdrawProps = CoinflowCommonWithdrawProps & SolanaWalletProps;
|
|
276
|
+
export interface NearWalletProps {
|
|
261
277
|
wallet: NearWallet;
|
|
262
278
|
blockchain: 'near';
|
|
263
279
|
}
|
|
264
|
-
export
|
|
280
|
+
export type CoinflowNearWithdrawProps = CoinflowCommonWithdrawProps & NearWalletProps;
|
|
281
|
+
interface EvmWalletProps {
|
|
265
282
|
wallet: EthWallet;
|
|
266
283
|
usePermit?: boolean;
|
|
267
284
|
}
|
|
268
|
-
|
|
285
|
+
type CoinflowEvmWithdrawProps = CoinflowCommonWithdrawProps & EvmWalletProps;
|
|
286
|
+
export interface EthWalletProps {
|
|
269
287
|
blockchain: 'eth';
|
|
270
|
-
usePermit?: boolean;
|
|
271
288
|
}
|
|
272
|
-
export
|
|
289
|
+
export type CoinflowEthWithdrawProps = CoinflowEvmWithdrawProps & EthWalletProps;
|
|
290
|
+
export interface PolygonWalletProps {
|
|
273
291
|
blockchain: 'polygon';
|
|
274
292
|
}
|
|
275
|
-
export
|
|
293
|
+
export type CoinflowPolygonWithdrawProps = CoinflowEvmWithdrawProps & PolygonWalletProps;
|
|
294
|
+
export interface BaseWalletProps {
|
|
276
295
|
blockchain: 'base';
|
|
277
296
|
}
|
|
278
|
-
export
|
|
297
|
+
export type CoinflowBaseWithdrawProps = CoinflowEvmWithdrawProps & BaseWalletProps;
|
|
298
|
+
export interface ArbitrumWalletProps {
|
|
279
299
|
blockchain: 'arbitrum';
|
|
280
300
|
}
|
|
281
|
-
export type
|
|
301
|
+
export type CoinflowArbitrumWithdrawProps = CoinflowEvmWithdrawProps & ArbitrumWalletProps;
|
|
302
|
+
export interface CoinflowSessionKeyWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
303
|
+
sessionKey: string;
|
|
304
|
+
signer: SolanaWalletProps | NearWalletProps | EthWalletProps | PolygonWalletProps | BaseWalletProps | ArbitrumWalletProps;
|
|
305
|
+
blockchain?: undefined;
|
|
306
|
+
}
|
|
307
|
+
export type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowNearWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps | CoinflowArbitrumWithdrawProps | CoinflowSessionKeyWithdrawProps;
|
|
282
308
|
export interface CommonEvmRedeem {
|
|
283
309
|
waitForHash?: boolean;
|
|
284
310
|
}
|
|
@@ -316,7 +342,7 @@ export interface TokenRedeem extends CommonEvmRedeem {
|
|
|
316
342
|
destination: string;
|
|
317
343
|
}
|
|
318
344
|
export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
|
|
319
|
-
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference' | 'supportEmail'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
345
|
+
export interface CoinflowIFrameProps extends Omit<CoinflowTypes, 'merchantId'>, Pick<CoinflowCommonPurchaseProps, 'chargebackProtectionData' | 'webhookInfo' | 'amount' | 'customerInfo' | 'settlementType' | 'email' | 'planCode' | 'deviceId' | 'jwtToken' | 'origins' | 'threeDsChallengePreference' | 'supportEmail'>, Pick<CoinflowCommonWithdrawProps, 'bankAccountLinkRedirect' | 'additionalWallets' | 'transactionSigner' | 'lockAmount' | 'lockDefaultToken' | 'origins'>, Pick<CoinflowEvmPurchaseProps, 'authOnly'>, Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token' | 'destinationAuthKey'> {
|
|
320
346
|
walletPubkey: string | null | undefined;
|
|
321
347
|
sessionKey?: string;
|
|
322
348
|
route: string;
|
|
@@ -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, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, }: CoinflowIFrameProps): string;
|
|
9
|
+
static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, amount, transaction, blockchain, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, 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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/angular",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^17.3.0",
|
|
6
6
|
"@angular/core": "^17.3.0",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"tweetnacl": "^1.0.3"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"tslib": "^2.8.
|
|
14
|
+
"tslib": "^2.8.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependenciesMeta": {
|
|
17
17
|
"@coinflowlabs/lib-common": {
|