@coinflowlabs/angular 1.1.4 → 1.1.5

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,11 @@ This library was generated with [Angular CLI](https://github.com/angular/angular
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 1.1.5
8
+
9
+ - Added `onLoad` property
10
+
11
+
7
12
  ## 1.1.0
8
13
 
9
14
  - Added Multi-Currency Presentment via the `presentment` property
@@ -66,6 +66,7 @@ var Currency;
66
66
  Currency["ALL"] = "ALL";
67
67
  Currency["ANG"] = "ANG";
68
68
  Currency["AOA"] = "AOA";
69
+ Currency["ARS"] = "ARS";
69
70
  Currency["AUD"] = "AUD";
70
71
  Currency["AWG"] = "AWG";
71
72
  Currency["AZN"] = "AZN";
@@ -75,18 +76,23 @@ var Currency;
75
76
  Currency["BGN"] = "BGN";
76
77
  Currency["BHD"] = "BHD";
77
78
  Currency["BIF"] = "BIF";
79
+ Currency["BMD"] = "BMD";
78
80
  Currency["BND"] = "BND";
79
81
  Currency["BOB"] = "BOB";
80
82
  Currency["BRL"] = "BRL";
83
+ Currency["BSD"] = "BSD";
81
84
  Currency["BTN"] = "BTN";
82
85
  Currency["BWP"] = "BWP";
86
+ Currency["BYN"] = "BYN";
83
87
  Currency["BZD"] = "BZD";
84
88
  Currency["CAD"] = "CAD";
85
89
  Currency["CHF"] = "CHF";
90
+ Currency["CLF"] = "CLF";
86
91
  Currency["CLP"] = "CLP";
87
92
  Currency["CNY"] = "CNY";
88
93
  Currency["COP"] = "COP";
89
94
  Currency["CRC"] = "CRC";
95
+ Currency["CUP"] = "CUP";
90
96
  Currency["CVE"] = "CVE";
91
97
  Currency["CZK"] = "CZK";
92
98
  Currency["DJF"] = "DJF";
@@ -96,6 +102,7 @@ var Currency;
96
102
  Currency["EGP"] = "EGP";
97
103
  Currency["ETB"] = "ETB";
98
104
  Currency["EUR"] = "EUR";
105
+ Currency["FJD"] = "FJD";
99
106
  Currency["GBP"] = "GBP";
100
107
  Currency["GEL"] = "GEL";
101
108
  Currency["GHS"] = "GHS";
@@ -108,6 +115,7 @@ var Currency;
108
115
  Currency["HTG"] = "HTG";
109
116
  Currency["HUF"] = "HUF";
110
117
  Currency["IDR"] = "IDR";
118
+ Currency["ILS"] = "ILS";
111
119
  Currency["INR"] = "INR";
112
120
  Currency["IQD"] = "IQD";
113
121
  Currency["IRR"] = "IRR";
@@ -123,6 +131,8 @@ var Currency;
123
131
  Currency["KWD"] = "KWD";
124
132
  Currency["KYD"] = "KYD";
125
133
  Currency["KZT"] = "KZT";
134
+ Currency["LAK"] = "LAK";
135
+ Currency["LBP"] = "LBP";
126
136
  Currency["LKR"] = "LKR";
127
137
  Currency["LRD"] = "LRD";
128
138
  Currency["LSL"] = "LSL";
@@ -136,9 +146,11 @@ var Currency;
136
146
  Currency["MOP"] = "MOP";
137
147
  Currency["MRU"] = "MRU";
138
148
  Currency["MUR"] = "MUR";
149
+ Currency["MWK"] = "MWK";
139
150
  Currency["MVR"] = "MVR";
140
151
  Currency["MXN"] = "MXN";
141
152
  Currency["MYR"] = "MYR";
153
+ Currency["MZN"] = "MZN";
142
154
  Currency["NAD"] = "NAD";
143
155
  Currency["NGN"] = "NGN";
144
156
  Currency["NIO"] = "NIO";
@@ -148,6 +160,7 @@ var Currency;
148
160
  Currency["OMR"] = "OMR";
149
161
  Currency["PAB"] = "PAB";
150
162
  Currency["PEN"] = "PEN";
163
+ Currency["PGK"] = "PGK";
151
164
  Currency["PHP"] = "PHP";
152
165
  Currency["PKR"] = "PKR";
153
166
  Currency["PLN"] = "PLN";
@@ -164,6 +177,7 @@ var Currency;
164
177
  Currency["SLE"] = "SLE";
165
178
  Currency["SLL"] = "SLL";
166
179
  Currency["SOS"] = "SOS";
180
+ Currency["SRD"] = "SRD";
167
181
  Currency["STN"] = "STN";
168
182
  Currency["SVC"] = "SVC";
169
183
  Currency["SYP"] = "SYP";
@@ -172,6 +186,7 @@ var Currency;
172
186
  Currency["TJS"] = "TJS";
173
187
  Currency["TMT"] = "TMT";
174
188
  Currency["TND"] = "TND";
189
+ Currency["TOP"] = "TOP";
175
190
  Currency["TRY"] = "TRY";
176
191
  Currency["TTD"] = "TTD";
177
192
  Currency["TWD"] = "TWD";
@@ -181,6 +196,7 @@ var Currency;
181
196
  Currency["UYU"] = "UYU";
182
197
  Currency["UZS"] = "UZS";
183
198
  Currency["VND"] = "VND";
199
+ Currency["VUV"] = "VUV";
184
200
  Currency["XAF"] = "XAF";
185
201
  Currency["XCD"] = "XCD";
186
202
  Currency["XOF"] = "XOF";
@@ -188,6 +204,7 @@ var Currency;
188
204
  Currency["YER"] = "YER";
189
205
  Currency["ZAR"] = "ZAR";
190
206
  Currency["ZMW"] = "ZMW";
207
+ Currency["ZWL"] = "ZWL";
191
208
  })(Currency || (Currency = {}));
192
209
  const CurrencyToISO4217 = {
193
210
  [Currency.AED]: '784',
@@ -318,6 +335,23 @@ const CurrencyToISO4217 = {
318
335
  [Currency.YER]: '886',
319
336
  [Currency.ZAR]: '710',
320
337
  [Currency.ZMW]: '967',
338
+ [Currency.ARS]: '032',
339
+ [Currency.BMD]: '060',
340
+ [Currency.BSD]: '044',
341
+ [Currency.BYN]: '933',
342
+ [Currency.CUP]: '192',
343
+ [Currency.FJD]: '242',
344
+ [Currency.ILS]: '376',
345
+ [Currency.LAK]: '418',
346
+ [Currency.LBP]: '422',
347
+ [Currency.MWK]: '454',
348
+ [Currency.MZN]: '943',
349
+ [Currency.PGK]: '598',
350
+ [Currency.SRD]: '968',
351
+ [Currency.TOP]: '776',
352
+ [Currency.VUV]: '548',
353
+ [Currency.ZWL]: '932',
354
+ [Currency.CLF]: '990',
321
355
  };
322
356
  const WithdrawCurrencies = {
323
357
  [Currency.USD]: Currency.USD,
@@ -369,7 +403,7 @@ class CoinflowUtils {
369
403
  return 'http://localhost:5000';
370
404
  return `https://api-${env}.coinflow.cash`;
371
405
  }
372
- static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, subtotal, presentment, transaction, blockchain = 'solana', webhookInfo, email, loaderBackground, handleHeightChangeId, bankAccountLinkRedirect, additionalWallets, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, destinationAuthKey, allowedPaymentMethods, }) {
406
+ static getCoinflowUrl({ walletPubkey, sessionKey, route, routePrefix, env, subtotal, presentment, transaction, blockchain = 'solana', webhookInfo, email, loaderBackground, handleHeightChangeId, bankAccountLinkRedirect, additionalWallets, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, origins, threeDsChallengePreference, supportEmail, destinationAuthKey, allowedPaymentMethods, accountFundingTransaction, }) {
373
407
  const prefix = routePrefix
374
408
  ? `/${routePrefix}/${blockchain}`
375
409
  : `/${blockchain}`;
@@ -476,6 +510,8 @@ class CoinflowUtils {
476
510
  url.searchParams.append('threeDsChallengePreference', threeDsChallengePreference);
477
511
  if (destinationAuthKey)
478
512
  url.searchParams.append('destinationAuthKey', destinationAuthKey);
513
+ if (accountFundingTransaction)
514
+ url.searchParams.append('accountFundingTransaction', LZString.compressToEncodedURIComponent(JSON.stringify(accountFundingTransaction)));
479
515
  return url.toString();
480
516
  }
481
517
  static getTransaction(props) {
@@ -769,6 +805,18 @@ function getSessionKeyHandlers({ onSuccess, onAuthDeclined, }) {
769
805
  };
770
806
  }
771
807
 
808
+ class EventBus {
809
+ static on(type, callback) {
810
+ document.addEventListener(type, callback);
811
+ }
812
+ static dispatch(type, data) {
813
+ document.dispatchEvent(new CustomEvent(type, { detail: data }));
814
+ }
815
+ static remove(type, callback) {
816
+ document.removeEventListener(type, callback);
817
+ }
818
+ }
819
+
772
820
  // Type definitions for TokenEx iframe integration
773
821
  const TokenExCardNumberIframeId = 'tokenExCardNumber';
774
822
  const TokenExCvvContainerID = 'tokenExCardCvv';
@@ -982,6 +1030,7 @@ class CoinflowIFrameComponent {
982
1030
  constructor(sanitizer) {
983
1031
  this.sanitizer = sanitizer;
984
1032
  this.messageEvent = new EventEmitter();
1033
+ this.isLoading = true;
985
1034
  }
986
1035
  ngOnInit() {
987
1036
  const coinflowUrl = CoinflowUtils.getCoinflowUrl(this.iframeProps);
@@ -992,6 +1041,20 @@ class CoinflowIFrameComponent {
992
1041
  if (!event.origin.includes(CoinflowUtils.getCoinflowBaseUrl(this.iframeProps.env)))
993
1042
  return;
994
1043
  this.messageEvent.emit(event);
1044
+ if (this.waitForLoadedMessage) {
1045
+ try {
1046
+ const message = JSON.parse(event.data);
1047
+ if (message &&
1048
+ typeof message === 'object' &&
1049
+ message.method === 'loaded') {
1050
+ this.isLoading = false;
1051
+ this.onLoad?.();
1052
+ }
1053
+ }
1054
+ catch (error) {
1055
+ // Ignore parse errors
1056
+ }
1057
+ }
995
1058
  const promise = handleIFrameMessage(event.data, this.messageHandlers, this.iframeProps.handleHeightChangeId);
996
1059
  if (!promise)
997
1060
  return;
@@ -1004,8 +1067,14 @@ class CoinflowIFrameComponent {
1004
1067
  return;
1005
1068
  this.iframe.nativeElement.contentWindow.postMessage(message, '*');
1006
1069
  }
1070
+ handleIframeLoad() {
1071
+ if (this.waitForLoadedMessage)
1072
+ return;
1073
+ this.isLoading = false;
1074
+ this.onLoad?.();
1075
+ }
1007
1076
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowIFrameComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
1008
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowIFrameComponent, isStandalone: true, selector: "lib-coinflow-iframe", inputs: { iframeProps: "iframeProps", messageHandlers: "messageHandlers" }, outputs: { messageEvent: "messageEvent" }, host: { listeners: { "window:message": "onPostMessage($event)" } }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true }], ngImport: i0, template: ` <iframe
1077
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowIFrameComponent, isStandalone: true, selector: "lib-coinflow-iframe", inputs: { iframeProps: "iframeProps", messageHandlers: "messageHandlers", onLoad: "onLoad", waitForLoadedMessage: "waitForLoadedMessage" }, outputs: { messageEvent: "messageEvent" }, host: { listeners: { "window:message": "onPostMessage($event)" } }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true }], ngImport: i0, template: ` <iframe
1009
1078
  width="100%"
1010
1079
  height="100%"
1011
1080
  #iframe
@@ -1015,6 +1084,7 @@ class CoinflowIFrameComponent {
1015
1084
  frameBorder="0"
1016
1085
  [src]="dynamicUrl"
1017
1086
  credentialless
1087
+ (load)="handleIframeLoad()"
1018
1088
  ></iframe>`, isInline: true }); }
1019
1089
  }
1020
1090
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowIFrameComponent, decorators: [{
@@ -1033,12 +1103,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
1033
1103
  frameBorder="0"
1034
1104
  [src]="dynamicUrl"
1035
1105
  credentialless
1106
+ (load)="handleIframeLoad()"
1036
1107
  ></iframe>`,
1037
1108
  }]
1038
1109
  }], ctorParameters: () => [{ type: i1.DomSanitizer }], propDecorators: { iframeProps: [{
1039
1110
  type: Input
1040
1111
  }], messageHandlers: [{
1041
1112
  type: Input
1113
+ }], onLoad: [{
1114
+ type: Input
1115
+ }], waitForLoadedMessage: [{
1116
+ type: Input
1042
1117
  }], messageEvent: [{
1043
1118
  type: Output
1044
1119
  }], iframe: [{
@@ -1065,7 +1140,7 @@ class CoinflowPurchaseComponent {
1065
1140
  };
1066
1141
  }
1067
1142
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowPurchaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1068
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowPurchaseComponent, isStandalone: true, selector: "lib-coinflow-purchase", inputs: { purchaseProps: "purchaseProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"], outputs: ["messageEvent"] }] }); }
1143
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowPurchaseComponent, isStandalone: true, selector: "lib-coinflow-purchase", inputs: { purchaseProps: "purchaseProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!" [onLoad]="purchaseProps?.onLoad" [waitForLoadedMessage]="true"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers", "onLoad", "waitForLoadedMessage"], outputs: ["messageEvent"] }] }); }
1069
1144
  }
1070
1145
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowPurchaseComponent, decorators: [{
1071
1146
  type: Component,
@@ -1073,7 +1148,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
1073
1148
  selector: 'lib-coinflow-purchase',
1074
1149
  standalone: true,
1075
1150
  imports: [CoinflowIFrameComponent],
1076
- template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ',
1151
+ template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!" [onLoad]="purchaseProps?.onLoad" [waitForLoadedMessage]="true"></lib-coinflow-iframe> ',
1077
1152
  }]
1078
1153
  }], propDecorators: { purchaseProps: [{
1079
1154
  type: Input
@@ -1123,7 +1198,7 @@ class CoinflowWithdrawComponent {
1123
1198
  };
1124
1199
  }
1125
1200
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowWithdrawComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1126
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowWithdrawComponent, isStandalone: true, selector: "lib-coinflow-withdraw", inputs: { withdrawProps: "withdrawProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"], outputs: ["messageEvent"] }] }); }
1201
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: CoinflowWithdrawComponent, isStandalone: true, selector: "lib-coinflow-withdraw", inputs: { withdrawProps: "withdrawProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!" [onLoad]="withdrawProps?.onLoad"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers", "onLoad", "waitForLoadedMessage"], outputs: ["messageEvent"] }] }); }
1127
1202
  }
1128
1203
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowWithdrawComponent, decorators: [{
1129
1204
  type: Component,
@@ -1131,7 +1206,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
1131
1206
  selector: 'lib-coinflow-withdraw',
1132
1207
  standalone: true,
1133
1208
  imports: [CoinflowIFrameComponent],
1134
- template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ',
1209
+ template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!" [onLoad]="withdrawProps?.onLoad"></lib-coinflow-iframe> ',
1135
1210
  }]
1136
1211
  }], propDecorators: { withdrawProps: [{
1137
1212
  type: Input
@@ -1447,9 +1522,11 @@ class CoinflowMobileWalletButtonComponent {
1447
1522
  ng-if="iframeProps && messageHandlers"
1448
1523
  [iframeProps]="iframeProps!"
1449
1524
  [messageHandlers]="messageHandlers!"
1525
+ [onLoad]="purchaseProps?.onLoad"
1526
+ [waitForLoadedMessage]="true"
1450
1527
  ></lib-coinflow-iframe>
1451
1528
  </div>
1452
- </div>`, isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"], outputs: ["messageEvent"] }] }); }
1529
+ </div>`, isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers", "onLoad", "waitForLoadedMessage"], outputs: ["messageEvent"] }] }); }
1453
1530
  }
1454
1531
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: CoinflowMobileWalletButtonComponent, decorators: [{
1455
1532
  type: Component,
@@ -1473,6 +1550,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
1473
1550
  ng-if="iframeProps && messageHandlers"
1474
1551
  [iframeProps]="iframeProps!"
1475
1552
  [messageHandlers]="messageHandlers!"
1553
+ [onLoad]="purchaseProps?.onLoad"
1554
+ [waitForLoadedMessage]="true"
1476
1555
  ></lib-coinflow-iframe>
1477
1556
  </div>
1478
1557
  </div>`,
@@ -1755,5 +1834,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImpor
1755
1834
  * Generated bundle index. Do not edit.
1756
1835
  */
1757
1836
 
1758
- export { CoinflowApplePayButtonComponent, CoinflowCardNumberInput, CoinflowCardNumberOnlyInput, CoinflowCvvInputComponent, CoinflowCvvOnlyInputComponent, CoinflowGooglePayButtonComponent, CoinflowIFrameComponent, CoinflowPurchaseComponent, CoinflowPurchaseHistoryComponent, CoinflowPurchaseProtectionComponent, CoinflowWithdrawComponent, CoinflowWithdrawHistoryComponent };
1837
+ export { CARD_TYPE_MAPPING, CardType, CoinflowApplePayButtonComponent, CoinflowCardNumberInput, CoinflowCardNumberOnlyInput, CoinflowCvvInputComponent, CoinflowCvvOnlyInputComponent, CoinflowGooglePayButtonComponent, CoinflowIFrameComponent, CoinflowPurchaseComponent, CoinflowPurchaseHistoryComponent, CoinflowPurchaseProtectionComponent, CoinflowUtils, CoinflowWithdrawComponent, CoinflowWithdrawHistoryComponent, Currency, CurrencyToISO4217, EventBus, IFrameMessageMethods, MerchantStyle, PaymentMethods, SettlementType, ThreeDsChallengePreference, TokenExCardNumberIframeId, TokenExCvvContainerID, WithdrawCurrencies, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, getCustomerName, getHandlers, getIframeConfig, getWalletPubkey, handleIFrameMessage, isTypedCurrencyCents, isWithdrawCurrency, nftCartItem, setTokenExScriptTag };
1759
1838
  //# sourceMappingURL=coinflowlabs-angular.mjs.map