@coinflowlabs/angular 1.9.0 → 1.11.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 CHANGED
@@ -4,6 +4,16 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 1.11.0
8
+
9
+ - Added `cardBackground` to `MerchantTheme` to control the inner card-entry surface independently of the outer canvas `background`
10
+ - Added `placeholderColor` to `MerchantTheme` to control placeholder text color in card form inputs
11
+ - Fixed the card brand icon being hidden when the card form reflows to a stacked two-row layout at narrow widths
12
+
13
+ ## 1.10.0
14
+
15
+ - Fixed an issue with vertical spacing when resizing the page
16
+
7
17
  ## 1.8.0
8
18
 
9
19
  - New `CoinflowCardForm` component — simple card input with a single `tokenize()` call and full theme support
@@ -70,6 +70,7 @@ var PaymentMethods;
70
70
  PaymentMethods["crypto"] = "crypto";
71
71
  PaymentMethods["wire"] = "wire";
72
72
  PaymentMethods["cashApp"] = "cashApp";
73
+ PaymentMethods["rain"] = "rain";
73
74
  })(PaymentMethods || (PaymentMethods = {}));
74
75
  const paymentMethodLabels = {
75
76
  [PaymentMethods.card]: 'Card',
@@ -84,6 +85,7 @@ const paymentMethodLabels = {
84
85
  [PaymentMethods.crypto]: 'Crypto',
85
86
  [PaymentMethods.wire]: 'Wire Transfer',
86
87
  [PaymentMethods.cashApp]: 'CashApp',
88
+ [PaymentMethods.rain]: 'Rain',
87
89
  };
88
90
  var CardType;
89
91
  (function (CardType) {
@@ -549,7 +551,7 @@ class CoinflowUtils {
549
551
  return 'http://localhost:5000';
550
552
  return `https://api-${env}.coinflow.cash`;
551
553
  }
552
- static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, subtotal, customPayInFees, presentment, transaction, blockchain = 'solana', webhookInfo, email, loaderBackground, handleHeightChangeId, bankAccountLinkRedirect, additionalWallets, chargebackProtectionData, chargebackProtectionAccountType, merchantCss, color, rent, lockDefaultToken, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, destinationAuthKey, allowedPaymentMethods, accountFundingTransaction, partialUsdcChecked, redemptionCheck, allowedWithdrawSpeeds, isZeroAuthorization, zeroAuthorizationConfig, userLocation, baseUrl, }) {
554
+ static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, subtotal, presentment, transaction, blockchain = 'solana', webhookInfo, email, loaderBackground, handleHeightChangeId, bankAccountLinkRedirect, additionalWallets, chargebackProtectionData, chargebackProtectionAccountType, merchantCss, color, rent, lockDefaultToken, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, destinationAuthKey, allowedPaymentMethods, accountFundingTransaction, partialUsdcChecked, redemptionCheck, allowedWithdrawSpeeds, isZeroAuthorization, zeroAuthorizationConfig, userLocation, baseUrl, }) {
553
555
  const prefix = routePrefix
554
556
  ? `/${routePrefix}/${blockchain}`
555
557
  : `/${blockchain}`;
@@ -576,9 +578,6 @@ class CoinflowUtils {
576
578
  url.searchParams.append('amount', subtotal.amount.toString());
577
579
  }
578
580
  }
579
- if (customPayInFees && customPayInFees.length > 0) {
580
- url.searchParams.append('customPayInFees', encodeURIComponent(JSON.stringify(customPayInFees)));
581
- }
582
581
  if (presentment)
583
582
  url.searchParams.append('presentment', presentment);
584
583
  if (webhookInfo) {
@@ -678,6 +677,33 @@ class CoinflowUtils {
678
677
  }
679
678
  return url.toString();
680
679
  }
680
+ static getCoinflowIntentsUrl({ baseUrl, route, color, theme, env, origins, deviceId, merchantCss, loaderBackground, handleHeightChangeId, }) {
681
+ const url = new URL(route, baseUrl ?? CoinflowUtils.getCoinflowBaseUrl(env));
682
+ if (origins)
683
+ url.searchParams.append('origins', LZString.compressToEncodedURIComponent(JSON.stringify(origins)));
684
+ if (deviceId) {
685
+ url.searchParams.append('deviceId', deviceId);
686
+ }
687
+ else {
688
+ const deviceId = getNSureDeviceId();
689
+ if (deviceId)
690
+ url.searchParams.append('deviceId', deviceId);
691
+ }
692
+ if (merchantCss)
693
+ url.searchParams.append('merchantCss', merchantCss);
694
+ if (color)
695
+ url.searchParams.append('color', color);
696
+ if (loaderBackground) {
697
+ url.searchParams.append('loaderBackground', loaderBackground);
698
+ }
699
+ if (handleHeightChangeId) {
700
+ url.searchParams.append('useHeightChange', handleHeightChangeId.toString());
701
+ }
702
+ if (theme) {
703
+ url.searchParams.append('theme', LZString.compressToEncodedURIComponent(JSON.stringify(theme)));
704
+ }
705
+ return url.toString();
706
+ }
681
707
  static getTransaction(props) {
682
708
  if (!props.blockchain)
683
709
  return undefined;
@@ -1318,10 +1344,7 @@ function getCoinflowPurchaseHeaders() {
1318
1344
  };
1319
1345
  }
1320
1346
 
1321
- const NSURE_APP_IDS = {
1322
- prod: '9JBW2RHC7JNJN8ZQ',
1323
- sandbox: 'SANDBOX_CTCE4XK53ZW0R7V1',
1324
- };
1347
+ const NSURE_APP_ID = '9JBW2RHC7JNJN8ZQ';
1325
1348
  const PROTECTION_SESSION_PROJECT_IDS = {
1326
1349
  prod: '315da543-c486-435a-aa21-53844c469822',
1327
1350
  sandbox: 'e9f629c4-80ee-4c6d-967e-62af47d8679e',
@@ -1333,7 +1356,7 @@ async function initCoinflowProtection({ coinflowEnv, merchantId, }) {
1333
1356
  if (!hasUrlDeviceId) {
1334
1357
  const partnerId = await new CoinflowUtils(coinflowEnv).getNSurePartnerId(merchantId);
1335
1358
  if (partnerId) {
1336
- const appId = NSURE_APP_IDS[env] ?? NSURE_APP_IDS['sandbox'];
1359
+ const appId = NSURE_APP_ID;
1337
1360
  try {
1338
1361
  nsureSDK.init(appId, partnerId);
1339
1362
  }
@@ -1822,31 +1845,29 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
1822
1845
  }] } });
1823
1846
 
1824
1847
  class CoinflowCardForm {
1825
- constructor() {
1826
- this.url = '';
1848
+ constructor(sanitizer) {
1849
+ this.sanitizer = sanitizer;
1827
1850
  this.loaded = false;
1851
+ this.iframeHeight = null;
1828
1852
  }
1829
1853
  ngOnInit() {
1830
1854
  this.buildUrl();
1831
- this.messageHandler = (event) => this.handleMessage(event.data, event.origin);
1832
- window.addEventListener('message', this.messageHandler);
1833
1855
  }
1834
- ngOnDestroy() {
1835
- if (this.messageHandler) {
1836
- window.removeEventListener('message', this.messageHandler);
1837
- }
1856
+ onMessage(event) {
1857
+ this.handleMessage(event.data, event.origin);
1838
1858
  }
1839
1859
  buildUrl() {
1840
1860
  const baseUrl = CoinflowUtils.getCoinflowBaseUrl(this.args.env);
1841
1861
  const iframeUrl = new URL(`/form/v2/${this.args.variant}`, baseUrl);
1842
1862
  iframeUrl.searchParams.append('merchantId', this.args.merchantId);
1863
+ iframeUrl.searchParams.append('useHeightChange', 'true');
1843
1864
  if (this.args.theme) {
1844
1865
  iframeUrl.searchParams.append('theme', LZString.compressToEncodedURIComponent(JSON.stringify(this.args.theme)));
1845
1866
  }
1846
1867
  if (this.args.token) {
1847
1868
  iframeUrl.searchParams.append('token', this.args.token);
1848
1869
  }
1849
- this.url = iframeUrl.toString();
1870
+ this.url = this.sanitizer.bypassSecurityTrustResourceUrl(iframeUrl.toString());
1850
1871
  }
1851
1872
  handleMessage(data, origin) {
1852
1873
  const expectedOrigin = new URL(CoinflowUtils.getCoinflowBaseUrl(this.args.env)).origin;
@@ -1858,6 +1879,12 @@ class CoinflowCardForm {
1858
1879
  this.loaded = true;
1859
1880
  this.args.onLoad?.();
1860
1881
  }
1882
+ else if (parsed.method === IFrameMessageMethods.HeightChange) {
1883
+ const parsedHeight = Number(parsed.data);
1884
+ if (Number.isFinite(parsedHeight) && parsedHeight > 0) {
1885
+ this.iframeHeight = parsedHeight;
1886
+ }
1887
+ }
1861
1888
  }
1862
1889
  catch {
1863
1890
  // not JSON
@@ -1899,18 +1926,18 @@ class CoinflowCardForm {
1899
1926
  iframe.contentWindow.postMessage('tokenize', targetOrigin);
1900
1927
  });
1901
1928
  }
1902
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CoinflowCardForm, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1903
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", type: CoinflowCardForm, isStandalone: true, selector: "lib-coinflow-card-form", inputs: { args: "args" }, viewQueries: [{ propertyName: "iframeRef", first: true, predicate: ["cardFormIframe"], descendants: true, static: true }], ngImport: i0, template: `<iframe
1929
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CoinflowCardForm, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
1930
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", type: CoinflowCardForm, isStandalone: true, selector: "lib-coinflow-card-form", inputs: { args: "args" }, host: { listeners: { "window:message": "onMessage($event)" } }, viewQueries: [{ propertyName: "iframeRef", first: true, predicate: ["cardFormIframe"], descendants: true, static: true }], ngImport: i0, template: `<iframe
1904
1931
  #cardFormIframe
1905
1932
  [src]="url"
1906
1933
  title="Card Form"
1907
1934
  frameBorder="0"
1908
1935
  allow="payment"
1909
1936
  [style.width]="'100%'"
1910
- [style.height]="'60px'"
1937
+ [style.height]="iframeHeight ? iframeHeight + 'px' : '60px'"
1911
1938
  [style.border]="'none'"
1912
1939
  [style.opacity]="loaded ? 1 : 0"
1913
- [style.transition]="'opacity 300ms linear'"
1940
+ [style.transition]="'opacity 300ms linear, height 150ms ease-out'"
1914
1941
  ></iframe>`, isInline: true }); }
1915
1942
  }
1916
1943
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CoinflowCardForm, decorators: [{
@@ -1926,17 +1953,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
1926
1953
  frameBorder="0"
1927
1954
  allow="payment"
1928
1955
  [style.width]="'100%'"
1929
- [style.height]="'60px'"
1956
+ [style.height]="iframeHeight ? iframeHeight + 'px' : '60px'"
1930
1957
  [style.border]="'none'"
1931
1958
  [style.opacity]="loaded ? 1 : 0"
1932
- [style.transition]="'opacity 300ms linear'"
1959
+ [style.transition]="'opacity 300ms linear, height 150ms ease-out'"
1933
1960
  ></iframe>`,
1934
1961
  }]
1935
- }], propDecorators: { args: [{
1962
+ }], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { args: [{
1936
1963
  type: Input
1937
1964
  }], iframeRef: [{
1938
1965
  type: ViewChild,
1939
1966
  args: ['cardFormIframe', { static: true }]
1967
+ }], onMessage: [{
1968
+ type: HostListener,
1969
+ args: ['window:message', ['$event']]
1940
1970
  }] } });
1941
1971
  /** @deprecated Use CoinflowCardForm instead */
1942
1972
  const CoinflowCardFormV2 = CoinflowCardForm;