@coinflowlabs/angular 0.3.4 → 1.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.
@@ -1,9 +1,9 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { CoinflowCardNumberInputProps } from '../common';
2
+ import { CoinflowCardNumberInputProps, MerchantIdOrCheckoutJwt } from '../common';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CoinflowCardNumberInput implements OnDestroy {
5
5
  private cardFormService;
6
- args: CoinflowCardNumberInputProps;
6
+ args: CoinflowCardNumberInputProps & MerchantIdOrCheckoutJwt;
7
7
  private iframe;
8
8
  private onScriptLoaded;
9
9
  private initializeTokenEx;
@@ -1,9 +1,9 @@
1
1
  import { OnDestroy } from '@angular/core';
2
- import { CoinflowCardNumberInputProps } from '../common';
2
+ import { CoinflowCardNumberInputProps, MerchantIdOrCheckoutJwt } from '../common';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CoinflowCardNumberOnlyInput implements OnDestroy {
5
5
  private cardFormService;
6
- args: CoinflowCardNumberInputProps;
6
+ args: CoinflowCardNumberInputProps & MerchantIdOrCheckoutJwt;
7
7
  private iframe;
8
8
  private onScriptLoaded;
9
9
  private initializeTokenEx;
@@ -1,12 +1,14 @@
1
- import { OnDestroy } from '@angular/core';
2
- import { CoinflowCvvOnlyInputProps } from '../common';
1
+ import { OnDestroy, SimpleChanges } from '@angular/core';
2
+ import { CoinflowCvvOnlyInputProps, MerchantIdOrCheckoutJwt } from '../common';
3
3
  import * as i0 from "@angular/core";
4
4
  export declare class CoinflowCvvOnlyInputComponent implements OnDestroy {
5
5
  private cardFormService;
6
- args: CoinflowCvvOnlyInputProps;
6
+ args: CoinflowCvvOnlyInputProps & MerchantIdOrCheckoutJwt;
7
7
  private iframe;
8
8
  private onScriptLoaded;
9
+ private cleanup;
9
10
  private initializeTokenEx;
11
+ ngOnChanges(changes: SimpleChanges): void;
10
12
  reinitialize(): void;
11
13
  ngOnInit(): void;
12
14
  ngOnDestroy(): void;
@@ -26,7 +26,7 @@ declare enum IFrameMessageMethods {
26
26
  Success = "success",
27
27
  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,4 +1,5 @@
1
1
  import type { Connection, VersionedTransaction, PublicKey, Signer, Transaction } from '@solana/web3.js';
2
+ import { Subtotal } from './Subtotal';
2
3
  export declare enum SettlementType {
3
4
  Credits = "Credits",
4
5
  USDC = "USDC",
@@ -161,7 +162,7 @@ export declare enum ThreeDsChallengePreference {
161
162
  Challenge = "Challenge"
162
163
  }
163
164
  export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
164
- amount?: number | string;
165
+ subtotal?: Subtotal;
165
166
  onSuccess?: OnSuccessMethod;
166
167
  webhookInfo?: {
167
168
  [key: string]: any;
@@ -205,7 +206,6 @@ export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps
205
206
  debugTx?: boolean;
206
207
  connection: Connection;
207
208
  blockchain: 'solana';
208
- token?: PublicKey | string;
209
209
  rent?: {
210
210
  lamports: string | number;
211
211
  };
@@ -226,7 +226,6 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
226
226
  }
227
227
  export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
228
228
  transaction?: EvmTransactionData;
229
- token?: string;
230
229
  wallet: EthWallet;
231
230
  }
232
231
  export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
@@ -342,7 +341,7 @@ export interface TokenRedeem extends CommonEvmRedeem {
342
341
  destination: string;
343
342
  }
344
343
  export type EvmTransactionData = SafeMintRedeem | ReturnedTokenIdRedeem | ReservoirRedeem | KnownTokenIdRedeem | NormalRedeem | TokenRedeem;
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'> {
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'> {
346
345
  walletPubkey: string | null | undefined;
347
346
  sessionKey?: string;
348
347
  route: string;
@@ -6,7 +6,7 @@ export declare class CoinflowUtils {
6
6
  getNSurePartnerId(merchantId: string): Promise<string | undefined>;
7
7
  static getCoinflowBaseUrl(env?: CoinflowEnvs): string;
8
8
  static getCoinflowApiUrl(env?: CoinflowEnvs): 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;
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;
10
10
  static getTransaction(props: CoinflowPurchaseProps): string | undefined;
11
11
  static byBlockchain<T>(blockchain: CoinflowBlockchain, args: {
12
12
  solana: T;
@@ -0,0 +1,37 @@
1
+ export declare enum Currency {
2
+ USD = "USD",
3
+ EUR = "EUR",
4
+ GBP = "GBP",
5
+ BRL = "BRL"
6
+ }
7
+ export interface Cents {
8
+ /**
9
+ * @isInt Cents must be an integer
10
+ * @minimum 0 Minimum Cents is 0
11
+ */
12
+ cents: number;
13
+ }
14
+ export interface CurrencyCents extends Cents {
15
+ currency: Currency;
16
+ }
17
+ export interface TokenSubtotal {
18
+ /**
19
+ * The tokens address
20
+ *
21
+ * Solana - Token Mint Address
22
+ * Evm - Token Contract Address
23
+ */
24
+ address: string;
25
+ /**
26
+ * Number of tokens
27
+ */
28
+ amount: number | string;
29
+ /**
30
+ * Number of decimals for the token
31
+ */
32
+ decimals?: number;
33
+ }
34
+ export type Subtotal = CurrencyCents | Cents | TokenSubtotal;
35
+ export interface NearDeposit {
36
+ yocto: string;
37
+ }
@@ -14,6 +14,8 @@ export interface TokenExIFrameConfiguration {
14
14
  authenticationKey: string;
15
15
  pci: true;
16
16
  token?: string;
17
+ use3DS?: boolean;
18
+ threeDSMethodNotificationUrl?: string;
17
19
  }
18
20
  export interface CardFormInputStyles {
19
21
  base: CSSProperties | string;
@@ -30,7 +32,7 @@ export interface CoinflowCardNumberInputProps {
30
32
  cvv: CardFormInputStyles;
31
33
  };
32
34
  debug?: boolean;
33
- origins?: string[];
35
+ origins: string[];
34
36
  font?: string;
35
37
  }
36
38
  export interface CoinflowCvvOnlyInputProps {
@@ -41,9 +43,22 @@ export interface CoinflowCvvOnlyInputProps {
41
43
  cvv: CardFormInputStyles;
42
44
  };
43
45
  debug?: boolean;
44
- origins?: string[];
46
+ origins: string[];
45
47
  font?: string;
46
48
  }
49
+ export interface VersionDetail {
50
+ threeDSMethodURL: string;
51
+ acsStartProtocolVersion: string;
52
+ acsEndProtocolVersion: string;
53
+ threeDSServerStartVersion: string;
54
+ threeDSServerEndVersion?: string;
55
+ acsInfoInd: [string];
56
+ directoryServerID: string;
57
+ dsStartProtocolVersion: string;
58
+ dsEndProtocolVersion: string;
59
+ dsIdentifier: string;
60
+ threeDSServerTransID: string;
61
+ }
47
62
  export interface TokenizationResponse {
48
63
  cardType: string;
49
64
  cvvIncluded: true;
@@ -52,6 +67,8 @@ export interface TokenizationResponse {
52
67
  referenceNumber: string;
53
68
  token: string;
54
69
  tokenHMAC: string;
70
+ recommended3dsVersion?: Record<string, string>;
71
+ threeDSecureResponse?: VersionDetail[];
55
72
  }
56
73
  declare global {
57
74
  namespace TokenEx {
@@ -1,24 +1,31 @@
1
1
  import { TokenExIframe, TokenExIFrameConfiguration } from './TokenEx';
2
2
  import { CardType, CoinflowEnvs } from '../CoinflowTypes';
3
- export interface DoInitializeTokenExIframeArgs {
3
+ export type MerchantIdOrCheckoutJwt = {
4
+ merchantId: string;
5
+ } | {
6
+ checkoutJwt: string;
7
+ };
8
+ export interface CommonDoInitializeTokenExIframeArgs {
4
9
  css: string;
5
10
  debug?: boolean;
6
11
  font?: string;
7
- origins: string[] | undefined;
12
+ origins: string[];
8
13
  tokenExScriptLoaded: boolean;
9
14
  env: CoinflowEnvs;
10
15
  setCachedToken: (s: string | undefined) => void;
11
16
  setLoaded: (b: boolean) => void;
12
17
  }
13
- export interface DoInitializeCvvOnlyTokenExIframeArgs extends DoInitializeTokenExIframeArgs {
18
+ export type DoInitializeTokenExIframeArgs = CommonDoInitializeTokenExIframeArgs & MerchantIdOrCheckoutJwt;
19
+ export type DoInitializeCvvOnlyTokenExIframeArgs = DoInitializeTokenExIframeArgs & {
14
20
  token: string;
15
21
  cardType: CardType;
16
- }
17
- export declare function getIframeConfig({ token, origins, env, }: {
22
+ };
23
+ export type GetIFrameConfigArgs = {
18
24
  token?: string;
19
- origins: string[] | undefined;
25
+ origins: string[];
20
26
  env: CoinflowEnvs;
21
- }): Promise<TokenExIFrameConfiguration>;
27
+ } & MerchantIdOrCheckoutJwt;
28
+ export declare function getIframeConfig(args: GetIFrameConfigArgs): Promise<TokenExIFrameConfiguration>;
22
29
  export declare function setTokenExScriptTag({ env, setTokenExScriptLoaded, }: {
23
30
  env: CoinflowEnvs;
24
31
  setTokenExScriptLoaded: (b: boolean) => void;
@@ -3,3 +3,4 @@ export * from './CoinflowUtils';
3
3
  export * from './CoinflowLibMessageHandlers';
4
4
  export * from './card-form/TokenEx';
5
5
  export * from './card-form/tokenexHelpers';
6
+ export * from './Subtotal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinflowlabs/angular",
3
- "version": "0.3.4",
3
+ "version": "1.0.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.0",
6
6
  "@angular/core": "^17.3.0",