@coinflowlabs/angular 1.7.1 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinflowlabs/angular",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^19.2.17",
6
6
  "@angular/core": "^19.2.17",
@@ -1,7 +1,7 @@
1
1
  import { PublicKey, Transaction, VersionedTransaction, Signer, Connection } from '@solana/web3.js';
2
2
  import { Properties } from 'csstype';
3
3
  import * as i0 from '@angular/core';
4
- import { EventEmitter, ElementRef, OnDestroy, SimpleChanges } from '@angular/core';
4
+ import { EventEmitter, ElementRef, OnDestroy, SimpleChanges, OnInit } from '@angular/core';
5
5
  import { SafeResourceUrl, DomSanitizer } from '@angular/platform-browser';
6
6
 
7
7
  declare enum Currency {
@@ -199,6 +199,16 @@ interface TypedCurrencyCents<T extends Currency> extends Cents {
199
199
  currency: T;
200
200
  }
201
201
  declare function isTypedCurrencyCents<T extends Currency>(cents: CurrencyCents, currency: T): cents is TypedCurrencyCents<T>;
202
+ interface ExchangeRate<T extends Currency = Currency> {
203
+ base: Currency;
204
+ rate: number;
205
+ to: T;
206
+ }
207
+ declare function invertRate<T extends Currency = Currency>(ex: {
208
+ base: T;
209
+ rate: number;
210
+ to: Currency;
211
+ }): ExchangeRate<T>;
202
212
  interface TokenSubtotal {
203
213
  /**
204
214
  * The tokens address
@@ -740,6 +750,12 @@ type MerchantTheme = {
740
750
  ctaColor?: string;
741
751
  font?: string;
742
752
  style?: MerchantStyle;
753
+ fontSize?: string;
754
+ fontWeight?: string;
755
+ cardNumberPlaceholder?: string;
756
+ cvvPlaceholder?: string;
757
+ expirationPlaceholder?: string;
758
+ showCardIcon?: boolean;
743
759
  };
744
760
  interface BaseCustomerInfo {
745
761
  verificationId?: string;
@@ -776,7 +792,7 @@ interface SplitNameCustomerInfo extends BaseCustomerInfo {
776
792
  }
777
793
  type CustomerInfo = SplitNameCustomerInfo | NameCustomerInfo;
778
794
  /** Coinflow Types **/
779
- type CoinflowBlockchain = 'solana' | 'eth' | 'polygon' | 'base' | 'arbitrum' | 'stellar' | 'monad' | 'user';
795
+ type CoinflowBlockchain = 'solana' | 'eth' | 'polygon' | 'base' | 'arbitrum' | 'stellar' | 'monad' | 'tempo' | 'user';
780
796
  type CoinflowEnvs = 'prod' | 'staging' | 'staging-live' | 'sandbox' | 'local';
781
797
  interface CoinflowTypes {
782
798
  merchantId: string;
@@ -852,7 +868,7 @@ interface CoinflowSessionKeyHistoryProps extends CoinflowTypes {
852
868
  }
853
869
  interface CoinflowEvmHistoryProps extends CoinflowTypes {
854
870
  wallet: EthWallet;
855
- blockchain: 'eth' | 'polygon' | 'base' | 'arbitrum' | 'monad';
871
+ blockchain: 'eth' | 'polygon' | 'base' | 'arbitrum' | 'monad' | 'tempo';
856
872
  }
857
873
  interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
858
874
  blockchain: 'eth';
@@ -873,7 +889,10 @@ interface CoinflowStellarHistoryProps extends CoinflowTypes {
873
889
  interface CoinflowMonadHistoryProps extends CoinflowEvmHistoryProps {
874
890
  blockchain: 'monad';
875
891
  }
876
- type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps | CoinflowStellarHistoryProps | CoinflowMonadHistoryProps | CoinflowSessionKeyHistoryProps;
892
+ interface CoinflowTempoHistoryProps extends CoinflowEvmHistoryProps {
893
+ blockchain: 'tempo';
894
+ }
895
+ type CoinflowHistoryProps = CoinflowSolanaHistoryProps | CoinflowPolygonHistoryProps | CoinflowEthHistoryProps | CoinflowBaseHistoryProps | CoinflowArbitrumHistoryProps | CoinflowStellarHistoryProps | CoinflowMonadHistoryProps | CoinflowTempoHistoryProps | CoinflowSessionKeyHistoryProps;
877
896
  type Bytes = ArrayLike<number>;
878
897
  type BytesLike = Bytes | string;
879
898
  /**
@@ -907,8 +926,8 @@ declare enum PaymentMethods {
907
926
  applePay = "applePay",
908
927
  credits = "credits",
909
928
  crypto = "crypto",
910
- instantBankTransfer = "instantBankTransfer",
911
- wire = "wire"
929
+ wire = "wire",
930
+ cashApp = "cashApp"
912
931
  }
913
932
  declare const paymentMethodLabels: Record<PaymentMethods, string>;
914
933
  interface CoinflowCommonPurchaseProps extends CoinflowTypes {
@@ -920,6 +939,7 @@ interface CoinflowCommonPurchaseProps extends CoinflowTypes {
920
939
  customPayInFees?: PurchaseCustomPayInFee[];
921
940
  presentment?: Currency;
922
941
  onSuccess?: OnSuccessMethod;
942
+ sessionKey?: string;
923
943
  onAuthDeclined?: OnAuthDeclinedMethod;
924
944
  webhookInfo?: {
925
945
  [key: string]: any;
@@ -1029,7 +1049,10 @@ interface CoinflowStellarPurchaseProps extends CoinflowCommonPurchaseProps {
1029
1049
  interface CoinflowMonadPurchaseProps extends CoinflowEvmPurchaseProps {
1030
1050
  blockchain: 'monad';
1031
1051
  }
1032
- type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowSessionKeyPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps | CoinflowArbitrumPurchaseProps | CoinflowStellarPurchaseProps | CoinflowMonadPurchaseProps;
1052
+ interface CoinflowTempoPurchaseProps extends CoinflowEvmPurchaseProps {
1053
+ blockchain: 'tempo';
1054
+ }
1055
+ type CoinflowPurchaseProps = CoinflowSolanaPurchaseProps | CoinflowSessionKeyPurchaseProps | CoinflowPolygonPurchaseProps | CoinflowEthPurchaseProps | CoinflowBasePurchaseProps | CoinflowArbitrumPurchaseProps | CoinflowStellarPurchaseProps | CoinflowMonadPurchaseProps | CoinflowTempoPurchaseProps;
1033
1056
  /** Withdraw **/
1034
1057
  interface CoinflowCommonWithdrawProps extends CoinflowTypes {
1035
1058
  onSuccess?: OnSuccessMethod;
@@ -1040,7 +1063,7 @@ interface CoinflowCommonWithdrawProps extends CoinflowTypes {
1040
1063
  bankAccountLinkRedirect?: string;
1041
1064
  additionalWallets?: {
1042
1065
  wallet: string;
1043
- blockchain: 'solana' | 'eth' | 'polygon' | 'base' | 'arbitrum' | 'monad' | 'stellar';
1066
+ blockchain: 'solana' | 'eth' | 'polygon' | 'base' | 'arbitrum' | 'monad' | 'tempo' | 'stellar';
1044
1067
  }[];
1045
1068
  lockAmount?: boolean;
1046
1069
  transactionSigner?: string;
@@ -1099,7 +1122,11 @@ interface MonadWalletProps {
1099
1122
  blockchain: 'monad';
1100
1123
  }
1101
1124
  type CoinflowMonadWithdrawProps = CoinflowEvmWithdrawProps & MonadWalletProps;
1102
- type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps | CoinflowArbitrumWithdrawProps | CoinflowStellarWithdrawProps | CoinflowMonadWithdrawProps;
1125
+ interface TempoWalletProps {
1126
+ blockchain: 'tempo';
1127
+ }
1128
+ type CoinflowTempoWithdrawProps = CoinflowEvmWithdrawProps & TempoWalletProps;
1129
+ type CoinflowWithdrawProps = CoinflowSolanaWithdrawProps | CoinflowEthWithdrawProps | CoinflowPolygonWithdrawProps | CoinflowBaseWithdrawProps | CoinflowArbitrumWithdrawProps | CoinflowStellarWithdrawProps | CoinflowMonadWithdrawProps | CoinflowTempoWithdrawProps;
1103
1130
  interface CommonEvmRedeem {
1104
1131
  /**
1105
1132
  * Whether the UI should wait
@@ -1297,6 +1324,7 @@ declare class CoinflowUtils {
1297
1324
  arbitrum: T;
1298
1325
  stellar: T;
1299
1326
  monad: T;
1327
+ tempo: T;
1300
1328
  user: T;
1301
1329
  }): T;
1302
1330
  }
@@ -1305,6 +1333,12 @@ interface FullName {
1305
1333
  lastName: string;
1306
1334
  }
1307
1335
  declare function getCustomerName(info: CustomerInfo | undefined): FullName | undefined;
1336
+ declare function recordFrontendError({ event, error, env, merchantId, }: {
1337
+ event: string;
1338
+ error: any;
1339
+ env: CoinflowEnvs;
1340
+ merchantId?: string;
1341
+ }): void;
1308
1342
 
1309
1343
  type WalletCall = {
1310
1344
  method: IFrameMessageMethods;
@@ -1334,7 +1368,8 @@ declare enum IFrameMessageMethods {
1334
1368
  Success = "success",
1335
1369
  AuthDeclined = "authDeclined",
1336
1370
  Loaded = "loaded",
1337
- AccountLinked = "accountLinked"
1371
+ AccountLinked = "accountLinked",
1372
+ Redirect = "redirect"
1338
1373
  }
1339
1374
  declare function getWalletPubkey(input: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): string | null | undefined;
1340
1375
  declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers, handleHeightChangeId: string | number): Promise<string> | void;
@@ -1452,6 +1487,19 @@ declare function doInitializeCvvOnlyTokenExIframe(args: DoInitializeCvvOnlyToken
1452
1487
  declare function doInitializeTokenExIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
1453
1488
  declare function doInitializeTokenExCardOnlyIframe(args: DoInitializeTokenExIframeArgs): Promise<TokenExIframe | undefined>;
1454
1489
 
1490
+ declare const DEVICE_ID_HEADER = "x-device-id";
1491
+ declare const SESSION_ID_HEADER = "x-session-id";
1492
+ type CoinflowProtectionHeadersType = {
1493
+ [DEVICE_ID_HEADER]: string | null;
1494
+ [SESSION_ID_HEADER]: string | null;
1495
+ };
1496
+ declare function getCoinflowProtectionHeaders(): CoinflowProtectionHeadersType;
1497
+
1498
+ declare function initCoinflowProtection({ coinflowEnv, merchantId, }: {
1499
+ coinflowEnv: CoinflowEnvs;
1500
+ merchantId: string;
1501
+ }): Promise<void>;
1502
+
1455
1503
  declare class CoinflowIFrameComponent {
1456
1504
  private sanitizer;
1457
1505
  iframeProps: CoinflowIFrameProps;
@@ -1557,6 +1605,36 @@ declare class CoinflowCvvOnlyInputComponent implements OnDestroy {
1557
1605
  static ɵcmp: i0.ɵɵComponentDeclaration<CoinflowCvvOnlyInputComponent, "lib-coinflow-cvv-only-input", never, { "args": { "alias": "args"; "required": false; }; }, {}, never, never, true, never>;
1558
1606
  }
1559
1607
 
1608
+ interface CardFormArgs {
1609
+ merchantId: string;
1610
+ env?: CoinflowEnvs;
1611
+ theme?: MerchantTheme;
1612
+ variant: 'card-form' | 'card-number-form' | 'cvv-form';
1613
+ token?: string;
1614
+ onLoad?: () => void;
1615
+ }
1616
+ interface CardFormTokenResponse {
1617
+ token: string;
1618
+ expMonth?: string;
1619
+ expYear?: string;
1620
+ }
1621
+ declare class CoinflowCardForm implements OnInit, OnDestroy {
1622
+ args: CardFormArgs;
1623
+ iframeRef: ElementRef<HTMLIFrameElement>;
1624
+ url: string;
1625
+ loaded: boolean;
1626
+ private messageHandler;
1627
+ ngOnInit(): void;
1628
+ ngOnDestroy(): void;
1629
+ private buildUrl;
1630
+ private handleMessage;
1631
+ tokenize(): Promise<CardFormTokenResponse>;
1632
+ static ɵfac: i0.ɵɵFactoryDeclaration<CoinflowCardForm, never>;
1633
+ static ɵcmp: i0.ɵɵComponentDeclaration<CoinflowCardForm, "lib-coinflow-card-form", never, { "args": { "alias": "args"; "required": false; }; }, {}, never, never, true, never>;
1634
+ }
1635
+ /** @deprecated Use CoinflowCardForm instead */
1636
+ declare const CoinflowCardFormV2: typeof CoinflowCardForm;
1637
+
1560
1638
  declare class CoinflowApplePayButtonComponent {
1561
1639
  purchaseProps: CoinflowPurchaseProps & {
1562
1640
  color: 'white' | 'black';
@@ -1580,5 +1658,5 @@ type WithOnLoad = {
1580
1658
  onLoad?: () => void | Promise<void>;
1581
1659
  };
1582
1660
 
1583
- export { BankingCurrencies, CARD_TYPE_MAPPING, CardType, ChargebackProtectionAccountType, CoinflowApplePayButtonComponent, CoinflowCardNumberInput, CoinflowCardNumberOnlyInput, CoinflowCvvInputComponent, CoinflowCvvOnlyInputComponent, CoinflowGooglePayButtonComponent, CoinflowIFrameComponent, CoinflowPurchaseComponent, CoinflowPurchaseHistoryComponent, CoinflowPurchaseProtectionComponent, CoinflowUtils, CoinflowWithdrawComponent, CoinflowWithdrawHistoryComponent, Currency, CurrencyToISO4217, EventBus, IFrameMessageMethods, MerchantStyle, PaymentMethods, RN_REDIRECT_MESSAGE_NAME, SettlementType, ThreeDsChallengePreference, TokenExCardNumberIframeId, TokenExCvvContainerID, WithdrawCategory, WithdrawCurrencies, WithdrawSpeed, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, getCurrencyDecimals, getCustomerName, getHandlers, getIframeConfig, getWalletPubkey, handleIFrameMessage, isBankingCurrency, isTypedCurrencyCents, isWithdrawCurrency, isZeroAuthSavedPaymentMethods, isZeroAuthVerifyCard, nftCartItem, paymentMethodLabels, productType, setTokenExScriptTag };
1584
- export type { AccountFundingTransaction, AnyObject, ArbitrumWalletProps, AuthDeclinedWalletCallInfo, BankingCurrency, BaseWalletProps, CardFormInputStyles, Cart, CartClassOmitted, CartItem, CartItemClassOmitted, Cents, ChargebackProtectionData, ChargebackProtectionItem, CoinflowArbitrumHistoryProps, CoinflowArbitrumPurchaseProps, CoinflowArbitrumWithdrawProps, CoinflowBaseHistoryProps, CoinflowBasePurchaseProps, CoinflowBaseWithdrawProps, CoinflowBlockchain, CoinflowCardNumberInputProps, CoinflowCardTokenResponse, CoinflowCommonPurchaseProps, CoinflowCommonWithdrawProps, CoinflowCvvOnlyInputProps, CoinflowEnvs, CoinflowEthHistoryProps, CoinflowEthPurchaseProps, CoinflowEthWithdrawProps, CoinflowEvmHistoryProps, CoinflowEvmPurchaseProps, CoinflowHistoryProps, CoinflowIFrameProps, CoinflowMonadHistoryProps, CoinflowMonadPurchaseProps, CoinflowMonadWithdrawProps, CoinflowPolygonHistoryProps, CoinflowPolygonPurchaseProps, CoinflowPolygonWithdrawProps, CoinflowPurchaseProps, CoinflowSessionKeyHistoryProps, CoinflowSessionKeyPurchaseProps, CoinflowSolanaHistoryProps, CoinflowSolanaPurchaseProps, CoinflowSolanaWithdrawProps, CoinflowStellarHistoryProps, CoinflowStellarPurchaseProps, CoinflowStellarWithdrawProps, CoinflowTypes, CoinflowWithdrawProps, CommonDoInitializeTokenExIframeArgs, CommonEvmRedeem, CryptoCartItem, CurrencyCents, CustomerInfo, DecentRedeem, DoInitializeCvvOnlyTokenExIframeArgs, DoInitializeTokenExIframeArgs, EthWallet, EthWalletProps, EventBusCallback, EvmTransactionData, FullName, GetIFrameConfigArgs, GiftCardCartItem, IFrameMessageHandlers, KnownTokenIdRedeem, MerchantIdOrCheckoutJwt, MerchantTheme, MergeWithOptionalDiff, MonadWalletProps, NameCustomerInfo, NftCartItemClassOmitted, NormalRedeem, OnAuthDeclinedMethod, OnSuccessMethod, PartialBy, PolygonWalletProps, PurchaseCustomPayInFee, RecipientAftInfo, RemainingLimit, ReturnedTokenIdRedeem, SafeMintRedeem, SolanaWallet, SolanaWalletProps, SplitNameCustomerInfo, StellarWallet, StellarWalletProps, Subtotal, TokenExIFrameConfiguration, TokenExIframe, TokenRedeem, TokenSubtotal, TokenizationResponse, TypedCurrencyCents, VersionDetail, WalletCall, WalletTypes, WithOnLoad, WithdrawCurrency, ZeroAuthSavedPaymentMethods, ZeroAuthVerifyCard, ZeroAuthorizationConfig };
1661
+ export { BankingCurrencies, CARD_TYPE_MAPPING, CardType, ChargebackProtectionAccountType, CoinflowApplePayButtonComponent, CoinflowCardForm, CoinflowCardFormV2, CoinflowCardNumberInput, CoinflowCardNumberOnlyInput, CoinflowCvvInputComponent, CoinflowCvvOnlyInputComponent, CoinflowGooglePayButtonComponent, CoinflowIFrameComponent, CoinflowPurchaseComponent, CoinflowPurchaseHistoryComponent, CoinflowPurchaseProtectionComponent, CoinflowUtils, CoinflowWithdrawComponent, CoinflowWithdrawHistoryComponent, Currency, CurrencyToISO4217, DEVICE_ID_HEADER, EventBus, IFrameMessageMethods, MerchantStyle, PaymentMethods, RN_REDIRECT_MESSAGE_NAME, SESSION_ID_HEADER, SettlementType, ThreeDsChallengePreference, TokenExCardNumberIframeId, TokenExCvvContainerID, WithdrawCategory, WithdrawCurrencies, WithdrawSpeed, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, getCoinflowProtectionHeaders, getCurrencyDecimals, getCustomerName, getHandlers, getIframeConfig, getWalletPubkey, handleIFrameMessage, initCoinflowProtection, invertRate, isBankingCurrency, isTypedCurrencyCents, isWithdrawCurrency, isZeroAuthSavedPaymentMethods, isZeroAuthVerifyCard, nftCartItem, paymentMethodLabels, productType, recordFrontendError, setTokenExScriptTag };
1662
+ export type { AccountFundingTransaction, AnyObject, ArbitrumWalletProps, AuthDeclinedWalletCallInfo, BankingCurrency, BaseWalletProps, CardFormArgs, CardFormInputStyles, CardFormTokenResponse, Cart, CartClassOmitted, CartItem, CartItemClassOmitted, Cents, ChargebackProtectionData, ChargebackProtectionItem, CoinflowArbitrumHistoryProps, CoinflowArbitrumPurchaseProps, CoinflowArbitrumWithdrawProps, CoinflowBaseHistoryProps, CoinflowBasePurchaseProps, CoinflowBaseWithdrawProps, CoinflowBlockchain, CoinflowCardNumberInputProps, CoinflowCardTokenResponse, CoinflowCommonPurchaseProps, CoinflowCommonWithdrawProps, CoinflowCvvOnlyInputProps, CoinflowEnvs, CoinflowEthHistoryProps, CoinflowEthPurchaseProps, CoinflowEthWithdrawProps, CoinflowEvmHistoryProps, CoinflowEvmPurchaseProps, CoinflowHistoryProps, CoinflowIFrameProps, CoinflowMonadHistoryProps, CoinflowMonadPurchaseProps, CoinflowMonadWithdrawProps, CoinflowPolygonHistoryProps, CoinflowPolygonPurchaseProps, CoinflowPolygonWithdrawProps, CoinflowProtectionHeadersType, CoinflowPurchaseProps, CoinflowSessionKeyHistoryProps, CoinflowSessionKeyPurchaseProps, CoinflowSolanaHistoryProps, CoinflowSolanaPurchaseProps, CoinflowSolanaWithdrawProps, CoinflowStellarHistoryProps, CoinflowStellarPurchaseProps, CoinflowStellarWithdrawProps, CoinflowTempoHistoryProps, CoinflowTempoPurchaseProps, CoinflowTempoWithdrawProps, CoinflowTypes, CoinflowWithdrawProps, CommonDoInitializeTokenExIframeArgs, CommonEvmRedeem, CryptoCartItem, CurrencyCents, CustomerInfo, DecentRedeem, DoInitializeCvvOnlyTokenExIframeArgs, DoInitializeTokenExIframeArgs, EthWallet, EthWalletProps, EventBusCallback, EvmTransactionData, ExchangeRate, FullName, GetIFrameConfigArgs, GiftCardCartItem, IFrameMessageHandlers, KnownTokenIdRedeem, MerchantIdOrCheckoutJwt, MerchantTheme, MergeWithOptionalDiff, MonadWalletProps, NameCustomerInfo, NftCartItemClassOmitted, NormalRedeem, OnAuthDeclinedMethod, OnSuccessMethod, PartialBy, PolygonWalletProps, PurchaseCustomPayInFee, RecipientAftInfo, RemainingLimit, ReturnedTokenIdRedeem, SafeMintRedeem, SolanaWallet, SolanaWalletProps, SplitNameCustomerInfo, StellarWallet, StellarWalletProps, Subtotal, TempoWalletProps, TokenExIFrameConfiguration, TokenExIframe, TokenRedeem, TokenSubtotal, TokenizationResponse, TypedCurrencyCents, VersionDetail, WalletCall, WalletTypes, WithOnLoad, WithdrawCurrency, ZeroAuthSavedPaymentMethods, ZeroAuthVerifyCard, ZeroAuthorizationConfig };