@coinflowlabs/angular 0.3.5 → 1.0.1

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,4 +1,4 @@
1
- import { doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, TokenExIframe, CoinflowEnvs } from '../common';
1
+ import { doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, TokenExIframe, MerchantIdOrCheckoutJwt } from '../common';
2
2
  import * as i0 from "@angular/core";
3
3
  export declare class CardFormService {
4
4
  loaded: boolean;
@@ -6,9 +6,9 @@ export declare class CardFormService {
6
6
  setTokenExIframe(iframe: TokenExIframe | undefined): void;
7
7
  setCachedToken(): void;
8
8
  setLoaded(input: boolean): void;
9
- initializeCvvOnlyTokenExIframe(env: CoinflowEnvs, args: Omit<Parameters<typeof doInitializeCvvOnlyTokenExIframe>[0], 'env' | 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'>): Promise<TokenExIframe | undefined>;
10
- initializeTokenExIframe(env: CoinflowEnvs, args: Omit<Parameters<typeof doInitializeTokenExIframe>[0], 'env' | 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'>): Promise<TokenExIframe | undefined>;
11
- initializeTokenExCardOnlyIframe(env: CoinflowEnvs, args: Omit<Parameters<typeof doInitializeTokenExCardOnlyIframe>[0], 'env' | 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'>): Promise<TokenExIframe | undefined>;
9
+ initializeCvvOnlyTokenExIframe(args: Omit<Parameters<typeof doInitializeCvvOnlyTokenExIframe>[0], 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'> & MerchantIdOrCheckoutJwt): Promise<TokenExIframe | undefined>;
10
+ initializeTokenExIframe(args: Omit<Parameters<typeof doInitializeTokenExIframe>[0], 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'> & MerchantIdOrCheckoutJwt): Promise<TokenExIframe | undefined>;
11
+ initializeTokenExCardOnlyIframe(args: Omit<Parameters<typeof doInitializeTokenExCardOnlyIframe>[0], 'tokenExScriptLoaded' | 'setCachedToken' | 'setLoaded'> & MerchantIdOrCheckoutJwt): Promise<TokenExIframe | undefined>;
12
12
  static ɵfac: i0.ɵɵFactoryDeclaration<CardFormService, never>;
13
13
  static ɵprov: i0.ɵɵInjectableDeclaration<CardFormService>;
14
14
  }
@@ -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,9 +1,9 @@
1
1
  import { OnDestroy, SimpleChanges } from '@angular/core';
2
- import { CoinflowCvvOnlyInputProps } from '../common';
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
9
  private cleanup;
@@ -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",
@@ -17,6 +18,7 @@ export type MerchantTheme = {
17
18
  textColor?: string;
18
19
  textColorAccent?: string;
19
20
  textColorAction?: string;
21
+ ctaColor?: string;
20
22
  font?: string;
21
23
  style?: MerchantStyle;
22
24
  };
@@ -49,6 +51,14 @@ export type OnSuccessMethod = (args: {
49
51
  paymentId: string;
50
52
  hash?: string | undefined;
51
53
  } | string) => void | Promise<void>;
54
+ export type AuthDeclinedWalletCallInfo = {
55
+ title: string;
56
+ code: string;
57
+ action: string;
58
+ message: string;
59
+ total: string;
60
+ };
61
+ export type OnAuthDeclinedMethod = (args: AuthDeclinedWalletCallInfo | string | string) => void | Promise<void>;
52
62
  /** Wallets **/
53
63
  export interface SolanaWallet {
54
64
  publicKey: PublicKey | null;
@@ -161,8 +171,9 @@ export declare enum ThreeDsChallengePreference {
161
171
  Challenge = "Challenge"
162
172
  }
163
173
  export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
164
- amount?: number | string;
174
+ subtotal?: Subtotal;
165
175
  onSuccess?: OnSuccessMethod;
176
+ onAuthDeclined?: OnAuthDeclinedMethod;
166
177
  webhookInfo?: {
167
178
  [key: string]: any;
168
179
  };
@@ -205,7 +216,6 @@ export interface CoinflowSolanaPurchaseProps extends CoinflowCommonPurchaseProps
205
216
  debugTx?: boolean;
206
217
  connection: Connection;
207
218
  blockchain: 'solana';
208
- token?: PublicKey | string;
209
219
  rent?: {
210
220
  lamports: string | number;
211
221
  };
@@ -226,7 +236,6 @@ export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
226
236
  }
227
237
  export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
228
238
  transaction?: EvmTransactionData;
229
- token?: string;
230
239
  wallet: EthWallet;
231
240
  }
232
241
  export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
@@ -342,7 +351,7 @@ export interface TokenRedeem extends CommonEvmRedeem {
342
351
  destination: string;
343
352
  }
344
353
  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'> {
354
+ 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
355
  walletPubkey: string | null | undefined;
347
356
  sessionKey?: string;
348
357
  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
+ checkoutJwt: string;
5
+ } | {
6
+ merchantId: 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.5",
3
+ "version": "1.0.1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^17.3.0",
6
6
  "@angular/core": "^17.3.0",