@coinflowlabs/angular 1.11.0 → 1.13.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.
|
@@ -5,6 +5,7 @@ import base58Imported from 'bs58';
|
|
|
5
5
|
import LZString from 'lz-string';
|
|
6
6
|
import nsureSDK from '@nsure-ai/web-client-sdk';
|
|
7
7
|
import * as i1 from '@angular/platform-browser';
|
|
8
|
+
import { NgStyle } from '@angular/common';
|
|
8
9
|
|
|
9
10
|
var WithdrawCategory;
|
|
10
11
|
(function (WithdrawCategory) {
|
|
@@ -70,7 +71,10 @@ var PaymentMethods;
|
|
|
70
71
|
PaymentMethods["crypto"] = "crypto";
|
|
71
72
|
PaymentMethods["wire"] = "wire";
|
|
72
73
|
PaymentMethods["cashApp"] = "cashApp";
|
|
73
|
-
PaymentMethods["
|
|
74
|
+
PaymentMethods["apa"] = "apa";
|
|
75
|
+
PaymentMethods["paypal"] = "paypal";
|
|
76
|
+
PaymentMethods["venmo"] = "venmo";
|
|
77
|
+
PaymentMethods["interac"] = "interac";
|
|
74
78
|
})(PaymentMethods || (PaymentMethods = {}));
|
|
75
79
|
const paymentMethodLabels = {
|
|
76
80
|
[PaymentMethods.card]: 'Card',
|
|
@@ -85,7 +89,10 @@ const paymentMethodLabels = {
|
|
|
85
89
|
[PaymentMethods.crypto]: 'Crypto',
|
|
86
90
|
[PaymentMethods.wire]: 'Wire Transfer',
|
|
87
91
|
[PaymentMethods.cashApp]: 'CashApp',
|
|
88
|
-
[PaymentMethods.
|
|
92
|
+
[PaymentMethods.apa]: 'APA',
|
|
93
|
+
[PaymentMethods.paypal]: 'PayPal',
|
|
94
|
+
[PaymentMethods.venmo]: 'Venmo',
|
|
95
|
+
[PaymentMethods.interac]: 'Interac',
|
|
89
96
|
};
|
|
90
97
|
var CardType;
|
|
91
98
|
(function (CardType) {
|
|
@@ -551,7 +558,7 @@ class CoinflowUtils {
|
|
|
551
558
|
return 'http://localhost:5000';
|
|
552
559
|
return `https://api-${env}.coinflow.cash`;
|
|
553
560
|
}
|
|
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, }) {
|
|
561
|
+
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, depositAmounts, baseUrl, }) {
|
|
555
562
|
const prefix = routePrefix
|
|
556
563
|
? `/${routePrefix}/${blockchain}`
|
|
557
564
|
: `/${blockchain}`;
|
|
@@ -663,6 +670,8 @@ class CoinflowUtils {
|
|
|
663
670
|
url.searchParams.append('origins', LZString.compressToEncodedURIComponent(JSON.stringify(origins)));
|
|
664
671
|
if (allowedPaymentMethods)
|
|
665
672
|
url.searchParams.append('allowedPaymentMethods', allowedPaymentMethods.join(','));
|
|
673
|
+
if (depositAmounts)
|
|
674
|
+
url.searchParams.append('depositAmounts', depositAmounts.join(','));
|
|
666
675
|
if (threeDsChallengePreference)
|
|
667
676
|
url.searchParams.append('threeDsChallengePreference', threeDsChallengePreference);
|
|
668
677
|
if (destinationAuthKey)
|
|
@@ -841,6 +850,7 @@ var IFrameMessageMethods;
|
|
|
841
850
|
IFrameMessageMethods["Loaded"] = "loaded";
|
|
842
851
|
IFrameMessageMethods["AccountLinked"] = "accountLinked";
|
|
843
852
|
IFrameMessageMethods["Redirect"] = "redirect";
|
|
853
|
+
IFrameMessageMethods["Overlay"] = "overlay";
|
|
844
854
|
})(IFrameMessageMethods || (IFrameMessageMethods = {}));
|
|
845
855
|
function getWalletPubkey(input) {
|
|
846
856
|
let wallet;
|
|
@@ -907,6 +917,11 @@ function handleIFrameMessage(rawMessage, handlers, handleHeightChangeId) {
|
|
|
907
917
|
case IFrameMessageMethods.Redirect:
|
|
908
918
|
window.open(data, '_blank');
|
|
909
919
|
return;
|
|
920
|
+
case IFrameMessageMethods.Overlay:
|
|
921
|
+
if (!handlers.handleOverlay)
|
|
922
|
+
return;
|
|
923
|
+
handlers.handleOverlay(data);
|
|
924
|
+
return;
|
|
910
925
|
}
|
|
911
926
|
console.warn(`Didn't expect to get here, handleIFrameMessage method:${method} is not one of ${Object.values(IFrameMessageMethods)}`);
|
|
912
927
|
}
|
|
@@ -1256,6 +1271,366 @@ function CSSPropertiesToComponent(dict) {
|
|
|
1256
1271
|
return str;
|
|
1257
1272
|
}
|
|
1258
1273
|
|
|
1274
|
+
/**
|
|
1275
|
+
* Single source of truth for the card-entry responsive layout.
|
|
1276
|
+
*
|
|
1277
|
+
* The real card-entry form (`UnifiedCardEntry` in the core-flows app) and the
|
|
1278
|
+
* React/Vue/Angular skeleton loaders all render the same grid. Historically the
|
|
1279
|
+
* form drove the inline↔two-row switch from JS (a ResizeObserver toggling React
|
|
1280
|
+
* state) while the skeletons hard-coded their own guesses, so the two drifted.
|
|
1281
|
+
*
|
|
1282
|
+
* This module defines the grid templates and the breakpoint ONCE, as pure data
|
|
1283
|
+
* plus a CSS builder, so every consumer reflows at exactly the same width via a
|
|
1284
|
+
* CSS container query — no JS width measurement, nothing to keep in sync.
|
|
1285
|
+
*/
|
|
1286
|
+
/**
|
|
1287
|
+
* Minimum width (px) each field needs before the row is too cramped and the
|
|
1288
|
+
* layout drops to two rows. Mirrors the real form's field sizing.
|
|
1289
|
+
*/
|
|
1290
|
+
const CARD_ENTRY_MIN_WIDTHS = {
|
|
1291
|
+
'card-number': 180,
|
|
1292
|
+
expiration: 96,
|
|
1293
|
+
cvv: 80,
|
|
1294
|
+
};
|
|
1295
|
+
/** Notional gap (px) between fields, summed into the reflow breakpoint. */
|
|
1296
|
+
const CARD_ENTRY_SLOT_GAP_PX = 8;
|
|
1297
|
+
/** Field row height — matches the real form's `3rem` grid rows. */
|
|
1298
|
+
const CARD_ENTRY_ROW_HEIGHT = '3rem';
|
|
1299
|
+
const CARD_ENTRY_ROW_HEIGHT_PX = 48;
|
|
1300
|
+
/** 1px accent line between rows / between exp & cvv in the two-row layout. */
|
|
1301
|
+
const CARD_ENTRY_DIVIDER_PX = 1;
|
|
1302
|
+
/**
|
|
1303
|
+
* The form draws its fields inside a 1px border, so the query container (the
|
|
1304
|
+
* full iframe width) is 2px wider than the field row that `minRowWidth`
|
|
1305
|
+
* describes. The breakpoint bakes this in so form and skeleton flip together.
|
|
1306
|
+
*/
|
|
1307
|
+
const CARD_ENTRY_BORDER_PX = 1;
|
|
1308
|
+
/**
|
|
1309
|
+
* The form insets its box by this much on every side (Tailwind `m-0.5`) so the
|
|
1310
|
+
* focus ring has room and isn't clipped at the iframe edge. It adds to the box's
|
|
1311
|
+
* rendered height, so the skeleton's height guess includes it to avoid a jump
|
|
1312
|
+
* when the loaded form replaces the skeleton.
|
|
1313
|
+
*/
|
|
1314
|
+
const CARD_ENTRY_MARGIN_PX = 2;
|
|
1315
|
+
/** Inline (wide-layout) track width for each field. */
|
|
1316
|
+
const INLINE_SLOT_WIDTH = {
|
|
1317
|
+
'card-number': '1fr',
|
|
1318
|
+
expiration: '96px',
|
|
1319
|
+
cvv: '80px',
|
|
1320
|
+
};
|
|
1321
|
+
/** grid-area name a field occupies. */
|
|
1322
|
+
const FIELD_AREA = {
|
|
1323
|
+
'card-number': 'card',
|
|
1324
|
+
expiration: 'exp',
|
|
1325
|
+
cvv: 'cvv',
|
|
1326
|
+
};
|
|
1327
|
+
function has(inputs, name) {
|
|
1328
|
+
return inputs.includes(name);
|
|
1329
|
+
}
|
|
1330
|
+
/** The reflow breakpoint on the field row, before adding the form border. */
|
|
1331
|
+
function minRowWidthPx(inputs) {
|
|
1332
|
+
const fields = inputs.reduce((sum, name) => sum + CARD_ENTRY_MIN_WIDTHS[name], 0);
|
|
1333
|
+
const gaps = Math.max(0, inputs.length - 1) * CARD_ENTRY_SLOT_GAP_PX;
|
|
1334
|
+
return fields + gaps;
|
|
1335
|
+
}
|
|
1336
|
+
/** grid-template for the single-row inline layout. */
|
|
1337
|
+
function inlineTemplate({ inputs, hasIcon, }) {
|
|
1338
|
+
const areas = [];
|
|
1339
|
+
const cols = [];
|
|
1340
|
+
const pushSlot = (area, width) => {
|
|
1341
|
+
if (areas.length > 0) {
|
|
1342
|
+
areas.push(`d${area.toUpperCase()}`);
|
|
1343
|
+
cols.push('1px');
|
|
1344
|
+
}
|
|
1345
|
+
areas.push(area);
|
|
1346
|
+
cols.push(width);
|
|
1347
|
+
};
|
|
1348
|
+
if (hasIcon && has(inputs, 'card-number'))
|
|
1349
|
+
pushSlot('icon', 'auto');
|
|
1350
|
+
for (const name of inputs)
|
|
1351
|
+
pushSlot(FIELD_AREA[name], INLINE_SLOT_WIDTH[name]);
|
|
1352
|
+
return `"${areas.join(' ')}" ${CARD_ENTRY_ROW_HEIGHT} / ${cols.join(' ')}`;
|
|
1353
|
+
}
|
|
1354
|
+
/** grid-template + dividers for the two-row layout (PAN on top). */
|
|
1355
|
+
function twoRowTemplate({ inputs, hasIcon, }) {
|
|
1356
|
+
const showsCard = has(inputs, 'card-number');
|
|
1357
|
+
const showsExp = has(inputs, 'expiration');
|
|
1358
|
+
const showsCvv = has(inputs, 'cvv');
|
|
1359
|
+
if (!showsCard || (!showsExp && !showsCvv))
|
|
1360
|
+
return null;
|
|
1361
|
+
const rows = `${CARD_ENTRY_ROW_HEIGHT} ${CARD_ENTRY_DIVIDER_PX}px ${CARD_ENTRY_ROW_HEIGHT}`;
|
|
1362
|
+
if (showsExp && showsCvv) {
|
|
1363
|
+
const areas = hasIcon
|
|
1364
|
+
? '"icon card card card" "dHR dHR dHR dHR" "exp exp dEV cvv"'
|
|
1365
|
+
: '"card card card" "dHR dHR dHR" "exp dEV cvv"';
|
|
1366
|
+
const cols = hasIcon
|
|
1367
|
+
? 'auto minmax(0, 1fr) 1px minmax(0, 1fr)'
|
|
1368
|
+
: 'minmax(0, 1fr) 1px minmax(0, 1fr)';
|
|
1369
|
+
return {
|
|
1370
|
+
template: gridShorthand(areas, rows, cols),
|
|
1371
|
+
dividers: [
|
|
1372
|
+
{ area: 'dHR', orientation: 'h' },
|
|
1373
|
+
{ area: 'dEV', orientation: 'v' },
|
|
1374
|
+
],
|
|
1375
|
+
};
|
|
1376
|
+
}
|
|
1377
|
+
const onlyBottom = showsExp ? 'exp' : 'cvv';
|
|
1378
|
+
const areas = hasIcon
|
|
1379
|
+
? `"icon card" "dHR dHR" "${onlyBottom} ${onlyBottom}"`
|
|
1380
|
+
: `"card" "dHR" "${onlyBottom}"`;
|
|
1381
|
+
const cols = hasIcon ? 'auto minmax(0, 1fr)' : 'minmax(0, 1fr)';
|
|
1382
|
+
return {
|
|
1383
|
+
template: gridShorthand(areas, rows, cols),
|
|
1384
|
+
dividers: [{ area: 'dHR', orientation: 'h' }],
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Compose a `grid-template` shorthand from a multi-row areas string, a matching
|
|
1389
|
+
* row-size list, and the column list — e.g. `"a" "b" 3rem 1px / 1fr`.
|
|
1390
|
+
*/
|
|
1391
|
+
function gridShorthand(areas, rows, cols) {
|
|
1392
|
+
const areaRows = areas.match(/"[^"]*"/g) ?? [];
|
|
1393
|
+
const rowSizes = rows.split(/\s+/);
|
|
1394
|
+
const withRowSizes = areaRows
|
|
1395
|
+
.map((row, i) => `${row} ${rowSizes[i] ?? ''}`.trim())
|
|
1396
|
+
.join(' ');
|
|
1397
|
+
return `${withRowSizes} / ${cols}`;
|
|
1398
|
+
}
|
|
1399
|
+
/** Resolve the full layout (templates + breakpoint + areas) for a config. */
|
|
1400
|
+
function buildCardEntryLayout({ inputs, hasIcon = false, allowTwoRow = true, }) {
|
|
1401
|
+
const fieldAreas = inputs.map(name => FIELD_AREA[name]);
|
|
1402
|
+
// A lone field fills the width and never reflows (matches the real form's
|
|
1403
|
+
// single-input case — the fixed slot width and the icon are ignored).
|
|
1404
|
+
if (inputs.length === 1) {
|
|
1405
|
+
return {
|
|
1406
|
+
inline: `"${fieldAreas[0]}" ${CARD_ENTRY_ROW_HEIGHT} / 1fr`,
|
|
1407
|
+
twoRow: null,
|
|
1408
|
+
breakpointPx: null,
|
|
1409
|
+
fieldAreas,
|
|
1410
|
+
hasIconArea: false,
|
|
1411
|
+
twoRowDividers: [],
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
const hasIconArea = hasIcon && has(inputs, 'card-number');
|
|
1415
|
+
const inline = inlineTemplate({ inputs, hasIcon: hasIconArea });
|
|
1416
|
+
const twoRow = allowTwoRow
|
|
1417
|
+
? twoRowTemplate({ inputs, hasIcon: hasIconArea })
|
|
1418
|
+
: null;
|
|
1419
|
+
return {
|
|
1420
|
+
inline,
|
|
1421
|
+
twoRow: twoRow?.template ?? null,
|
|
1422
|
+
breakpointPx: twoRow
|
|
1423
|
+
? minRowWidthPx(inputs) + 2 * CARD_ENTRY_BORDER_PX
|
|
1424
|
+
: null,
|
|
1425
|
+
fieldAreas,
|
|
1426
|
+
hasIconArea,
|
|
1427
|
+
twoRowDividers: twoRow?.dividers ?? [],
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Container-query CSS that switches `gridSelector` between the inline and
|
|
1432
|
+
* two-row templates at the layout's breakpoint. The element matched by
|
|
1433
|
+
* `gridSelector` must be a descendant of a `container-type: inline-size`
|
|
1434
|
+
* ancestor named `containerName`.
|
|
1435
|
+
*
|
|
1436
|
+
* `extraBaseRules` are emitted before the `@container` block (e.g. the default
|
|
1437
|
+
* hidden state of two-row-only dividers); `extraCompactRules` are emitted inside
|
|
1438
|
+
* it (e.g. revealing those dividers / hiding wide-only chrome). Keeping the base
|
|
1439
|
+
* state first ensures the compact rules win when the query matches.
|
|
1440
|
+
*/
|
|
1441
|
+
function buildCardEntryGridCss({ gridSelector, layout, containerName, extraBaseRules = '', extraCompactRules = '', }) {
|
|
1442
|
+
const base = `${gridSelector} { display: grid; grid-template: ${layout.inline}; }
|
|
1443
|
+
${extraBaseRules}`;
|
|
1444
|
+
if (!layout.twoRow || layout.breakpointPx === null)
|
|
1445
|
+
return base;
|
|
1446
|
+
const container = containerName ? `${containerName} ` : '';
|
|
1447
|
+
return `${base}
|
|
1448
|
+
@container ${container}(width < ${layout.breakpointPx}px) {
|
|
1449
|
+
${gridSelector} { grid-template: ${layout.twoRow}; }
|
|
1450
|
+
${extraCompactRules}
|
|
1451
|
+
}`;
|
|
1452
|
+
}
|
|
1453
|
+
|
|
1454
|
+
/**
|
|
1455
|
+
* Framework-agnostic definitions for the V2 card-form skeleton loader.
|
|
1456
|
+
*
|
|
1457
|
+
* The React, Vue, and Angular libraries all render the same skeleton while the
|
|
1458
|
+
* card-form iframe loads. The grid templates and breakpoint come from the shared
|
|
1459
|
+
* {@link buildCardEntryLayout} — the SAME source of truth the real form uses —
|
|
1460
|
+
* so the skeleton reflows at exactly the width the loaded form does. Only the
|
|
1461
|
+
* box styling and per-framework wiring live here.
|
|
1462
|
+
*/
|
|
1463
|
+
/** Which fields each iframe variant mounts. */
|
|
1464
|
+
const VARIANT_INPUTS = {
|
|
1465
|
+
'card-form': ['card-number', 'expiration', 'cvv'],
|
|
1466
|
+
'card-number-form': ['card-number', 'expiration'],
|
|
1467
|
+
'cvv-form': ['cvv'],
|
|
1468
|
+
};
|
|
1469
|
+
// The iframe skeletons render without the optional card-brand icon.
|
|
1470
|
+
const CARD_ENTRY_LAYOUTS = {
|
|
1471
|
+
'card-form': buildCardEntryLayout({ inputs: VARIANT_INPUTS['card-form'] }),
|
|
1472
|
+
'card-number-form': buildCardEntryLayout({
|
|
1473
|
+
inputs: VARIANT_INPUTS['card-number-form'],
|
|
1474
|
+
}),
|
|
1475
|
+
'cvv-form': buildCardEntryLayout({ inputs: VARIANT_INPUTS['cvv-form'] }),
|
|
1476
|
+
};
|
|
1477
|
+
// Iframe height (px) to guess before it reports its real height. Matches the
|
|
1478
|
+
// form's rendered height so the skeleton→form swap doesn't jump: field row(s) +
|
|
1479
|
+
// the 1px border and the box's `m-0.5` margin on top and bottom.
|
|
1480
|
+
const CARD_ENTRY_VERTICAL_CHROME_PX = 2 * CARD_ENTRY_BORDER_PX + 2 * CARD_ENTRY_MARGIN_PX;
|
|
1481
|
+
const INLINE_SKELETON_HEIGHT_PX = CARD_ENTRY_ROW_HEIGHT_PX + CARD_ENTRY_VERTICAL_CHROME_PX;
|
|
1482
|
+
/** Two-row layouts are a second field row plus the 1px divider taller. */
|
|
1483
|
+
const COMPACT_SKELETON_HEIGHT_PX = 2 * CARD_ENTRY_ROW_HEIGHT_PX +
|
|
1484
|
+
CARD_ENTRY_DIVIDER_PX +
|
|
1485
|
+
CARD_ENTRY_VERTICAL_CHROME_PX;
|
|
1486
|
+
function toSkeletonLayout(layout) {
|
|
1487
|
+
return {
|
|
1488
|
+
inline: layout.inline,
|
|
1489
|
+
compact: layout.twoRow ?? undefined,
|
|
1490
|
+
compactMaxWidthPx: layout.breakpointPx ?? undefined,
|
|
1491
|
+
areas: layout.fieldAreas,
|
|
1492
|
+
};
|
|
1493
|
+
}
|
|
1494
|
+
const SKELETON_LAYOUTS = {
|
|
1495
|
+
'card-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['card-form']),
|
|
1496
|
+
'card-number-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['card-number-form']),
|
|
1497
|
+
'cvv-form': toSkeletonLayout(CARD_ENTRY_LAYOUTS['cvv-form']),
|
|
1498
|
+
};
|
|
1499
|
+
/** Name of the shared pulse keyframes; referenced by the box `animation`. */
|
|
1500
|
+
const SKELETON_PULSE_ANIMATION_NAME = 'coinflow-card-form-skeleton-pulse';
|
|
1501
|
+
/**
|
|
1502
|
+
* Duration (ms) of the skeleton's opacity fade-out. Matches the `opacity 300ms`
|
|
1503
|
+
* transition each renderer applies. Renderers unmount the skeleton on
|
|
1504
|
+
* `transitionend`, but that event can be skipped (reduced-motion, an ancestor
|
|
1505
|
+
* `display:none`, or opacity already 0) — so they also use this as a fallback
|
|
1506
|
+
* timeout to force the unmount and avoid a stuck (invisible) skeleton.
|
|
1507
|
+
*/
|
|
1508
|
+
const SKELETON_FADE_MS = 300;
|
|
1509
|
+
/**
|
|
1510
|
+
* Whether the given container width would trigger the variant's two-row layout.
|
|
1511
|
+
* Mirrors the real form's container query (`width < breakpoint`). Variants
|
|
1512
|
+
* without a two-row layout never reflow.
|
|
1513
|
+
*/
|
|
1514
|
+
function shouldStackSkeleton({ variant, width, }) {
|
|
1515
|
+
const { compact, compactMaxWidthPx } = SKELETON_LAYOUTS[variant];
|
|
1516
|
+
return (compact !== undefined &&
|
|
1517
|
+
compactMaxWidthPx !== undefined &&
|
|
1518
|
+
width > 0 &&
|
|
1519
|
+
width < compactMaxWidthPx);
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Height to guess before the iframe reports its real height. The two-row layout
|
|
1523
|
+
* is a field row plus divider taller than the inline one.
|
|
1524
|
+
*/
|
|
1525
|
+
function guessSkeletonHeightPx({ variant, width, }) {
|
|
1526
|
+
return shouldStackSkeleton({ variant, width })
|
|
1527
|
+
? COMPACT_SKELETON_HEIGHT_PX
|
|
1528
|
+
: INLINE_SKELETON_HEIGHT_PX;
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* The `grid-template` to apply for the given container width. Frameworks that
|
|
1532
|
+
* drive the layout from JS (Vue, Angular) call this from their resize observer;
|
|
1533
|
+
* React instead injects a CSS container query via {@link buildSkeletonCss}.
|
|
1534
|
+
*/
|
|
1535
|
+
function getSkeletonGridTemplate({ variant, width, }) {
|
|
1536
|
+
const { inline, compact } = SKELETON_LAYOUTS[variant];
|
|
1537
|
+
if (compact && shouldStackSkeleton({ variant, width }))
|
|
1538
|
+
return compact;
|
|
1539
|
+
return inline;
|
|
1540
|
+
}
|
|
1541
|
+
/** Stable class name for a variant's skeleton grid element. */
|
|
1542
|
+
function getSkeletonGridClass(variant) {
|
|
1543
|
+
return `coinflow-card-form-skeleton-grid--${variant}`;
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* CSS (keyframes + grid + container-query breakpoint) for the container-query
|
|
1547
|
+
* driven renderer used by React, where the skeleton root is a query container.
|
|
1548
|
+
*/
|
|
1549
|
+
function buildSkeletonCss(variant) {
|
|
1550
|
+
const gridClass = getSkeletonGridClass(variant);
|
|
1551
|
+
const grid = buildCardEntryGridCss({
|
|
1552
|
+
gridSelector: `.${gridClass}`,
|
|
1553
|
+
layout: CARD_ENTRY_LAYOUTS[variant],
|
|
1554
|
+
extraBaseRules: `.${gridClass} { gap: 0; flex: 1; }`,
|
|
1555
|
+
});
|
|
1556
|
+
return `@keyframes ${SKELETON_PULSE_ANIMATION_NAME} {0%,100%{opacity:1}50%{opacity:0.4}}
|
|
1557
|
+
${grid}`;
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Padding (px) to inset the skeleton grid by, applied on the skeleton root. It
|
|
1561
|
+
* equals the form's own chrome — its `m-0.5` margin plus 1px border — so the
|
|
1562
|
+
* boxes land in the same area the real fields will, and the grid fills the root
|
|
1563
|
+
* exactly (no dead space that would make the boxes look too short).
|
|
1564
|
+
*/
|
|
1565
|
+
const SKELETON_ROOT_PADDING_PX = CARD_ENTRY_MARGIN_PX + CARD_ENTRY_BORDER_PX;
|
|
1566
|
+
/**
|
|
1567
|
+
* Inline style for each skeleton box, MINUS the `background` — the fill color is
|
|
1568
|
+
* theme-dependent (see {@link getSkeletonColors}) so each renderer merges it in.
|
|
1569
|
+
* A hairline margin keeps a subtle gap between boxes while letting them fill
|
|
1570
|
+
* nearly the full field height (the root padding handles the outer inset). Uses
|
|
1571
|
+
* string units so it renders identically in React, Vue, and Angular.
|
|
1572
|
+
*/
|
|
1573
|
+
const SKELETON_BOX_STYLE = {
|
|
1574
|
+
minWidth: '0',
|
|
1575
|
+
margin: '1px',
|
|
1576
|
+
borderRadius: '4px',
|
|
1577
|
+
opacity: '1',
|
|
1578
|
+
animation: `${SKELETON_PULSE_ANIMATION_NAME} 1.5s ease-in-out infinite`,
|
|
1579
|
+
};
|
|
1580
|
+
// Dark surface → light skeleton; light surface → dark skeleton (the original
|
|
1581
|
+
// look); unknown → a neutral mid-grey that reads on either.
|
|
1582
|
+
const DARK_SURFACE_COLORS = {
|
|
1583
|
+
backdrop: 'rgba(255, 255, 255, 0.05)',
|
|
1584
|
+
box: 'rgba(255, 255, 255, 0.30)',
|
|
1585
|
+
};
|
|
1586
|
+
const LIGHT_SURFACE_COLORS = {
|
|
1587
|
+
backdrop: 'rgba(0, 0, 0, 0.04)',
|
|
1588
|
+
box: 'rgba(0, 0, 0, 0.30)',
|
|
1589
|
+
};
|
|
1590
|
+
const NEUTRAL_COLORS = {
|
|
1591
|
+
backdrop: 'rgba(128, 128, 128, 0.08)',
|
|
1592
|
+
box: 'rgba(128, 128, 128, 0.38)',
|
|
1593
|
+
};
|
|
1594
|
+
/** Parse a hex (#rgb/#rrggbb/#rrggbbaa) or rgb()/rgba() string to [r,g,b]. */
|
|
1595
|
+
function parseRgb(color) {
|
|
1596
|
+
const c = color.trim().toLowerCase();
|
|
1597
|
+
let hex = c.startsWith('#') ? c.slice(1) : '';
|
|
1598
|
+
if (hex && /^[0-9a-f]+$/.test(hex)) {
|
|
1599
|
+
if (hex.length === 3)
|
|
1600
|
+
hex = hex
|
|
1601
|
+
.split('')
|
|
1602
|
+
.map(x => x + x)
|
|
1603
|
+
.join('');
|
|
1604
|
+
if (hex.length === 8)
|
|
1605
|
+
hex = hex.slice(0, 6);
|
|
1606
|
+
if (hex.length === 6)
|
|
1607
|
+
return [
|
|
1608
|
+
parseInt(hex.slice(0, 2), 16),
|
|
1609
|
+
parseInt(hex.slice(2, 4), 16),
|
|
1610
|
+
parseInt(hex.slice(4, 6), 16),
|
|
1611
|
+
];
|
|
1612
|
+
}
|
|
1613
|
+
const m = c.match(/rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/);
|
|
1614
|
+
if (m)
|
|
1615
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
1616
|
+
return null;
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Best-effort skeleton palette. The skeleton renders in the SDK (parent), so it
|
|
1620
|
+
* can't see the form's resolved colors — it only has the optional `theme` the
|
|
1621
|
+
* integrator passed. When `theme.background` is a parseable color we tint the
|
|
1622
|
+
* skeleton light-on-dark or dark-on-light to match; otherwise we fall back to a
|
|
1623
|
+
* neutral mid-grey that stays visible on any surface.
|
|
1624
|
+
*/
|
|
1625
|
+
function getSkeletonColors(theme) {
|
|
1626
|
+
const rgb = theme?.background ? parseRgb(theme.background) : null;
|
|
1627
|
+
if (!rgb)
|
|
1628
|
+
return NEUTRAL_COLORS;
|
|
1629
|
+
const [r, g, b] = rgb;
|
|
1630
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
1631
|
+
return luminance < 0.5 ? DARK_SURFACE_COLORS : LIGHT_SURFACE_COLORS;
|
|
1632
|
+
}
|
|
1633
|
+
|
|
1259
1634
|
/* generated using openapi-typescript-codegen -- do no edit */
|
|
1260
1635
|
/* istanbul ignore file */
|
|
1261
1636
|
/* tslint:disable */
|
|
@@ -1320,13 +1695,139 @@ function getProtectionSessionId() {
|
|
|
1320
1695
|
return cachedSessionId;
|
|
1321
1696
|
}
|
|
1322
1697
|
|
|
1698
|
+
const FORTER_COOKIE_NAME = 'forterToken';
|
|
1699
|
+
// Defense-in-depth: the attacker-influenceable cookie is later sent as the `x-forter-token` header / Forter `forterTokenCookie`; since tokens are opaque, long, uncontrolled-alphabet strings, don't use a narrow allowlist — just bound the length and reject control / CR / LF chars that could enable header injection.
|
|
1700
|
+
const MAX_FORTER_TOKEN_LENGTH = 1024;
|
|
1701
|
+
// eslint-disable-next-line no-control-regex
|
|
1702
|
+
const FORTER_TOKEN_UNSAFE_PATTERN = /[\x00-\x1F\x7F]/;
|
|
1703
|
+
// Forter sets the `forterToken` cookie asynchronously and some WebViews (notably React Native) only surface it transiently/late, so a just-in-time checkout read often comes back empty even when nSure and Verisoul succeed; cache and prefer the captured token (see captureForterToken) as Verisoul does, and keep it current latest-wins since Forter re-emits a more complete token after its handshake (later `ftr:tokenReady` events overwrite it and the cookie poll keeps refreshing) rather than freezing on the first partial token.
|
|
1704
|
+
let cachedForterToken = null;
|
|
1705
|
+
// Whether `cachedForterToken` came from the authoritative `ftr:tokenReady` event, the reliable source in cross-origin iframes / WebViews where the cookie is partitioned or stale, so a cookie read must never clobber an event-sourced value.
|
|
1706
|
+
let cachedFromEvent = false;
|
|
1707
|
+
// Ensures only one cookie-poll loop runs at a time (captureForterToken can be called from several mounted protection components).
|
|
1708
|
+
let pollActive = false;
|
|
1709
|
+
function sanitizeForterToken(raw) {
|
|
1710
|
+
if (!raw)
|
|
1711
|
+
return null;
|
|
1712
|
+
let token = raw;
|
|
1713
|
+
try {
|
|
1714
|
+
token = decodeURIComponent(raw);
|
|
1715
|
+
}
|
|
1716
|
+
catch {
|
|
1717
|
+
// keep raw if it isn't valid percent-encoding
|
|
1718
|
+
}
|
|
1719
|
+
if (!token)
|
|
1720
|
+
return null;
|
|
1721
|
+
if (token.length > MAX_FORTER_TOKEN_LENGTH)
|
|
1722
|
+
return null;
|
|
1723
|
+
if (FORTER_TOKEN_UNSAFE_PATTERN.test(token))
|
|
1724
|
+
return null;
|
|
1725
|
+
return token;
|
|
1726
|
+
}
|
|
1727
|
+
// Reads the Forter cookie. Matches `forterToken` exactly, then falls back to any `*forter*token*` cookie name in case Forter changes/prefixes it.
|
|
1728
|
+
function readForterCookie() {
|
|
1729
|
+
if (typeof document === 'undefined' || !document.cookie)
|
|
1730
|
+
return null;
|
|
1731
|
+
let fallback = null;
|
|
1732
|
+
for (const part of document.cookie.split(';')) {
|
|
1733
|
+
const eq = part.indexOf('=');
|
|
1734
|
+
if (eq === -1)
|
|
1735
|
+
continue;
|
|
1736
|
+
const name = part.slice(0, eq).trim();
|
|
1737
|
+
const value = part.slice(eq + 1);
|
|
1738
|
+
if (name === FORTER_COOKIE_NAME)
|
|
1739
|
+
return value;
|
|
1740
|
+
const lower = name.toLowerCase();
|
|
1741
|
+
if (lower.includes('forter') && lower.includes('token'))
|
|
1742
|
+
fallback = value;
|
|
1743
|
+
}
|
|
1744
|
+
return fallback;
|
|
1745
|
+
}
|
|
1746
|
+
function getForterToken() {
|
|
1747
|
+
return cachedForterToken ?? sanitizeForterToken(readForterCookie());
|
|
1748
|
+
}
|
|
1749
|
+
// Forter dispatches `ftr:tokenReady` on `document` with the token in `event.detail` once computed; this is cookie-INDEPENDENT and so the reliable source in cross-origin iframes / WebViews where the forterToken cookie is partitioned/blocked (the cookie still works as a fallback on web).
|
|
1750
|
+
const FORTER_TOKEN_READY_EVENT = 'ftr:tokenReady';
|
|
1751
|
+
function handleForterTokenReady(event) {
|
|
1752
|
+
const detail = event.detail;
|
|
1753
|
+
const token = typeof detail === 'string' ? sanitizeForterToken(detail) : null;
|
|
1754
|
+
if (!token)
|
|
1755
|
+
return;
|
|
1756
|
+
// Latest-wins: stay subscribed so each re-emission overwrites the cache with the newer, more complete token (see note on cachedForterToken).
|
|
1757
|
+
cachedForterToken = token;
|
|
1758
|
+
cachedFromEvent = true;
|
|
1759
|
+
}
|
|
1760
|
+
// Capture and cache the Forter token shortly after the SDK script is injected so it is available to getForterToken() by checkout time: primary source is the `ftr:tokenReady` event and the cookie is polled as a fallback, and if neither surfaces log a diagnostic (cookie names + Forter globals only — never values) to reveal whether the SDK exposes the token at all in this context.
|
|
1761
|
+
function captureForterToken({ timeoutMs = 15_000, intervalMs = 250, } = {}) {
|
|
1762
|
+
if (typeof window === 'undefined')
|
|
1763
|
+
return;
|
|
1764
|
+
// Stay subscribed for the page lifetime so every `ftr:tokenReady` overwrites the cache (latest-wins); addEventListener dedupes the same handler, so calling this from multiple mounts registers it only once.
|
|
1765
|
+
if (typeof document !== 'undefined') {
|
|
1766
|
+
document.addEventListener(FORTER_TOKEN_READY_EVENT, handleForterTokenReady);
|
|
1767
|
+
}
|
|
1768
|
+
if (pollActive)
|
|
1769
|
+
return;
|
|
1770
|
+
pollActive = true;
|
|
1771
|
+
const start = Date.now();
|
|
1772
|
+
const tick = () => {
|
|
1773
|
+
// Keep refreshing from the cookie (latest-wins among cookie reads) until the window closes, but never clobber an event-sourced token — the event is authoritative where the cookie is partitioned / stale.
|
|
1774
|
+
if (!cachedFromEvent) {
|
|
1775
|
+
const token = sanitizeForterToken(readForterCookie());
|
|
1776
|
+
if (token)
|
|
1777
|
+
cachedForterToken = token;
|
|
1778
|
+
}
|
|
1779
|
+
if (Date.now() - start >= timeoutMs) {
|
|
1780
|
+
pollActive = false;
|
|
1781
|
+
if (!cachedForterToken)
|
|
1782
|
+
logForterTokenMissing();
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
window.setTimeout(tick, intervalMs);
|
|
1786
|
+
};
|
|
1787
|
+
tick();
|
|
1788
|
+
}
|
|
1789
|
+
function logForterTokenMissing() {
|
|
1790
|
+
if (typeof document === 'undefined')
|
|
1791
|
+
return;
|
|
1792
|
+
const cookieNames = (document.cookie || '')
|
|
1793
|
+
.split(';')
|
|
1794
|
+
.map(part => part.split('=')[0].trim())
|
|
1795
|
+
.filter(Boolean);
|
|
1796
|
+
const forterGlobals = typeof window !== 'undefined'
|
|
1797
|
+
? Object.keys(window).filter(key => /ftr|forter/i.test(key))
|
|
1798
|
+
: [];
|
|
1799
|
+
console.warn('[forter] token never surfaced after init.', 'cookieNames:', cookieNames, 'forterGlobals:', forterGlobals);
|
|
1800
|
+
}
|
|
1801
|
+
// Resolve once a Forter token is available, or after `timeoutMs` if it never surfaces: Forter issues its device token asynchronously (~1s after the SDK loads, via `ftr:tokenReady` / forterToken cookie), so a fast charge — notably saved-card / "1-click" purchases — can read getForterToken() before it exists and send an empty x-forter-token, so await this at charge time to populate the header; fail-open by resolving to whatever getForterToken() returns at the deadline (possibly null) rather than blocking the purchase, and return immediately when a token is already cached so it adds no latency in the common case.
|
|
1802
|
+
async function awaitForterToken({ timeoutMs = 2_000, intervalMs = 100, } = {}) {
|
|
1803
|
+
const existing = getForterToken();
|
|
1804
|
+
if (existing)
|
|
1805
|
+
return existing;
|
|
1806
|
+
if (typeof window === 'undefined')
|
|
1807
|
+
return null;
|
|
1808
|
+
return new Promise(resolve => {
|
|
1809
|
+
const start = Date.now();
|
|
1810
|
+
const poll = () => {
|
|
1811
|
+
const token = getForterToken();
|
|
1812
|
+
if (token)
|
|
1813
|
+
return resolve(token);
|
|
1814
|
+
if (Date.now() - start >= timeoutMs)
|
|
1815
|
+
return resolve(getForterToken());
|
|
1816
|
+
window.setTimeout(poll, intervalMs);
|
|
1817
|
+
};
|
|
1818
|
+
window.setTimeout(poll, intervalMs);
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1323
1822
|
const DEVICE_ID_HEADER = 'x-device-id';
|
|
1324
1823
|
const SESSION_ID_HEADER = 'x-session-id';
|
|
1325
1824
|
const REFERRER_HEADER = 'x-coinflow-referrer';
|
|
1825
|
+
const FORTER_TOKEN_HEADER = 'x-forter-token';
|
|
1326
1826
|
function getCoinflowProtectionHeaders() {
|
|
1327
1827
|
return {
|
|
1328
1828
|
[DEVICE_ID_HEADER]: getNSureDeviceId(),
|
|
1329
1829
|
[SESSION_ID_HEADER]: getProtectionSessionId(),
|
|
1830
|
+
[FORTER_TOKEN_HEADER]: getForterToken(),
|
|
1330
1831
|
};
|
|
1331
1832
|
}
|
|
1332
1833
|
function getReferrer() {
|
|
@@ -1845,17 +2346,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
1845
2346
|
}] } });
|
|
1846
2347
|
|
|
1847
2348
|
class CoinflowCardForm {
|
|
1848
|
-
constructor(sanitizer) {
|
|
2349
|
+
constructor(sanitizer, zone) {
|
|
1849
2350
|
this.sanitizer = sanitizer;
|
|
2351
|
+
this.zone = zone;
|
|
1850
2352
|
this.loaded = false;
|
|
1851
2353
|
this.iframeHeight = null;
|
|
2354
|
+
this.areas = [];
|
|
2355
|
+
this.guessHeight = INLINE_SKELETON_HEIGHT_PX;
|
|
2356
|
+
this.gridTemplate = '';
|
|
2357
|
+
// Keep the skeleton mounted while it fades out so the opacity transition can
|
|
2358
|
+
// play, then unmount on transition end. Remount instantly when shown again.
|
|
2359
|
+
this.rendered = true;
|
|
2360
|
+
this.observer = null;
|
|
2361
|
+
this.unmountTimer = null;
|
|
1852
2362
|
}
|
|
1853
2363
|
ngOnInit() {
|
|
2364
|
+
this.layout = SKELETON_LAYOUTS[this.args.variant];
|
|
2365
|
+
this.areas = this.layout.areas;
|
|
2366
|
+
this.gridTemplate = this.layout.inline;
|
|
1854
2367
|
this.buildUrl();
|
|
2368
|
+
this.observeWidth();
|
|
2369
|
+
}
|
|
2370
|
+
ngOnDestroy() {
|
|
2371
|
+
this.observer?.disconnect();
|
|
2372
|
+
if (this.unmountTimer)
|
|
2373
|
+
clearTimeout(this.unmountTimer);
|
|
2374
|
+
}
|
|
2375
|
+
get height() {
|
|
2376
|
+
return this.loaded && this.iframeHeight
|
|
2377
|
+
? `${this.iframeHeight}px`
|
|
2378
|
+
: `${this.guessHeight}px`;
|
|
2379
|
+
}
|
|
2380
|
+
get skeletonRootStyle() {
|
|
2381
|
+
return {
|
|
2382
|
+
position: 'absolute',
|
|
2383
|
+
top: 0,
|
|
2384
|
+
left: 0,
|
|
2385
|
+
width: '100%',
|
|
2386
|
+
height: '100%',
|
|
2387
|
+
display: 'flex',
|
|
2388
|
+
pointerEvents: 'none',
|
|
2389
|
+
flexDirection: 'column',
|
|
2390
|
+
gap: '8px',
|
|
2391
|
+
padding: `${SKELETON_ROOT_PADDING_PX}px`,
|
|
2392
|
+
boxSizing: 'border-box',
|
|
2393
|
+
borderRadius: '8px',
|
|
2394
|
+
background: this.skeletonColors.backdrop,
|
|
2395
|
+
opacity: this.loaded ? '0%' : '100%',
|
|
2396
|
+
transition: 'opacity 300ms linear, height 150ms ease-out',
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
get gridStyle() {
|
|
2400
|
+
return {
|
|
2401
|
+
display: 'grid',
|
|
2402
|
+
gap: 0,
|
|
2403
|
+
flex: 1,
|
|
2404
|
+
width: '100%',
|
|
2405
|
+
gridTemplate: this.gridTemplate,
|
|
2406
|
+
};
|
|
2407
|
+
}
|
|
2408
|
+
// Best-effort skeleton tint from the merchant theme's background (neutral when
|
|
2409
|
+
// absent), so the loader reads on light and dark forms alike.
|
|
2410
|
+
get skeletonColors() {
|
|
2411
|
+
return getSkeletonColors(this.args.theme);
|
|
2412
|
+
}
|
|
2413
|
+
boxStyle(area) {
|
|
2414
|
+
return {
|
|
2415
|
+
...SKELETON_BOX_STYLE,
|
|
2416
|
+
background: this.skeletonColors.box,
|
|
2417
|
+
gridArea: area,
|
|
2418
|
+
};
|
|
1855
2419
|
}
|
|
1856
2420
|
onMessage(event) {
|
|
2421
|
+
// Only honor messages from THIS instance's iframe. Multiple card forms on
|
|
2422
|
+
// one page each listen on `window`, so without this every instance would
|
|
2423
|
+
// apply every other iframe's height/loaded events to itself.
|
|
2424
|
+
if (event.source !== this.iframeRef?.nativeElement?.contentWindow)
|
|
2425
|
+
return;
|
|
1857
2426
|
this.handleMessage(event.data, event.origin);
|
|
1858
2427
|
}
|
|
2428
|
+
onSkeletonTransitionEnd(e) {
|
|
2429
|
+
if (e.propertyName === 'opacity' && this.loaded)
|
|
2430
|
+
this.rendered = false;
|
|
2431
|
+
}
|
|
2432
|
+
observeWidth() {
|
|
2433
|
+
// Measure the wrapper div, not the iframe: a freshly-mounted <iframe> is a
|
|
2434
|
+
// replaced element with an intrinsic 300px default width before its
|
|
2435
|
+
// width:100% resolves, which would briefly (and wrongly) trip the compact
|
|
2436
|
+
// breakpoint. A block div reports the true container width immediately.
|
|
2437
|
+
const el = this.wrapperRef?.nativeElement;
|
|
2438
|
+
if (!el || !this.layout.compact)
|
|
2439
|
+
return;
|
|
2440
|
+
const measure = () => {
|
|
2441
|
+
const width = el.clientWidth;
|
|
2442
|
+
this.guessHeight = guessSkeletonHeightPx({
|
|
2443
|
+
variant: this.args.variant,
|
|
2444
|
+
width,
|
|
2445
|
+
});
|
|
2446
|
+
this.gridTemplate = getSkeletonGridTemplate({
|
|
2447
|
+
variant: this.args.variant,
|
|
2448
|
+
width,
|
|
2449
|
+
});
|
|
2450
|
+
};
|
|
2451
|
+
measure();
|
|
2452
|
+
this.observer = new ResizeObserver(() => this.zone.run(measure));
|
|
2453
|
+
this.observer.observe(el);
|
|
2454
|
+
}
|
|
1859
2455
|
buildUrl() {
|
|
1860
2456
|
const baseUrl = CoinflowUtils.getCoinflowBaseUrl(this.args.env);
|
|
1861
2457
|
const iframeUrl = new URL(`/form/v2/${this.args.variant}`, baseUrl);
|
|
@@ -1878,6 +2474,14 @@ class CoinflowCardForm {
|
|
|
1878
2474
|
if (parsed.method === IFrameMessageMethods.Loaded) {
|
|
1879
2475
|
this.loaded = true;
|
|
1880
2476
|
this.args.onLoad?.();
|
|
2477
|
+
// Fallback unmount: `transitionend` may never fire (reduced-motion, an
|
|
2478
|
+
// ancestor display:none, or opacity already 0), so force cleanup after
|
|
2479
|
+
// the fade window.
|
|
2480
|
+
if (this.unmountTimer)
|
|
2481
|
+
clearTimeout(this.unmountTimer);
|
|
2482
|
+
this.unmountTimer = setTimeout(() => {
|
|
2483
|
+
this.zone.run(() => (this.rendered = false));
|
|
2484
|
+
}, SKELETON_FADE_MS);
|
|
1881
2485
|
}
|
|
1882
2486
|
else if (parsed.method === IFrameMessageMethods.HeightChange) {
|
|
1883
2487
|
const parsedHeight = Number(parsed.data);
|
|
@@ -1926,44 +2530,84 @@ class CoinflowCardForm {
|
|
|
1926
2530
|
iframe.contentWindow.postMessage('tokenize', targetOrigin);
|
|
1927
2531
|
});
|
|
1928
2532
|
}
|
|
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: "
|
|
1931
|
-
#
|
|
1932
|
-
[
|
|
1933
|
-
title="Card Form"
|
|
1934
|
-
frameBorder="0"
|
|
1935
|
-
allow="payment"
|
|
2533
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CoinflowCardForm, deps: [{ token: i1.DomSanitizer }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2534
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.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 }, { propertyName: "wrapperRef", first: true, predicate: ["wrapper"], descendants: true, static: true }], ngImport: i0, template: `<div
|
|
2535
|
+
#wrapper
|
|
2536
|
+
[style.position]="'relative'"
|
|
1936
2537
|
[style.width]="'100%'"
|
|
1937
|
-
[style.height]="
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2538
|
+
[style.height]="height"
|
|
2539
|
+
>
|
|
2540
|
+
@if (rendered) {
|
|
2541
|
+
<div
|
|
2542
|
+
role="status"
|
|
2543
|
+
aria-label="Loading card form"
|
|
2544
|
+
(transitionend)="onSkeletonTransitionEnd($event)"
|
|
2545
|
+
[ngStyle]="skeletonRootStyle"
|
|
2546
|
+
>
|
|
2547
|
+
<div [ngStyle]="gridStyle">
|
|
2548
|
+
@for (area of areas; track area) {
|
|
2549
|
+
<div [ngStyle]="boxStyle(area)"></div>
|
|
2550
|
+
}
|
|
2551
|
+
</div>
|
|
2552
|
+
</div>
|
|
2553
|
+
}
|
|
2554
|
+
<iframe
|
|
2555
|
+
#cardFormIframe
|
|
2556
|
+
[src]="url"
|
|
2557
|
+
title="Card Form"
|
|
2558
|
+
frameBorder="0"
|
|
2559
|
+
allow="payment"
|
|
2560
|
+
[style.width]="'100%'"
|
|
2561
|
+
[style.height]="height"
|
|
2562
|
+
[style.border]="'none'"
|
|
2563
|
+
[style.opacity]="loaded ? 1 : 0"
|
|
2564
|
+
[style.transition]="'opacity 300ms linear, height 150ms ease-out'"
|
|
2565
|
+
></iframe>
|
|
2566
|
+
</div>`, isInline: true, styles: ["@keyframes coinflow-card-form-skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
|
|
1942
2567
|
}
|
|
1943
2568
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CoinflowCardForm, decorators: [{
|
|
1944
2569
|
type: Component,
|
|
1945
|
-
args: [{
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
imports: [],
|
|
1949
|
-
template: `<iframe
|
|
1950
|
-
#cardFormIframe
|
|
1951
|
-
[src]="url"
|
|
1952
|
-
title="Card Form"
|
|
1953
|
-
frameBorder="0"
|
|
1954
|
-
allow="payment"
|
|
2570
|
+
args: [{ selector: 'lib-coinflow-card-form', standalone: true, imports: [NgStyle], template: `<div
|
|
2571
|
+
#wrapper
|
|
2572
|
+
[style.position]="'relative'"
|
|
1955
2573
|
[style.width]="'100%'"
|
|
1956
|
-
[style.height]="
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
2574
|
+
[style.height]="height"
|
|
2575
|
+
>
|
|
2576
|
+
@if (rendered) {
|
|
2577
|
+
<div
|
|
2578
|
+
role="status"
|
|
2579
|
+
aria-label="Loading card form"
|
|
2580
|
+
(transitionend)="onSkeletonTransitionEnd($event)"
|
|
2581
|
+
[ngStyle]="skeletonRootStyle"
|
|
2582
|
+
>
|
|
2583
|
+
<div [ngStyle]="gridStyle">
|
|
2584
|
+
@for (area of areas; track area) {
|
|
2585
|
+
<div [ngStyle]="boxStyle(area)"></div>
|
|
2586
|
+
}
|
|
2587
|
+
</div>
|
|
2588
|
+
</div>
|
|
2589
|
+
}
|
|
2590
|
+
<iframe
|
|
2591
|
+
#cardFormIframe
|
|
2592
|
+
[src]="url"
|
|
2593
|
+
title="Card Form"
|
|
2594
|
+
frameBorder="0"
|
|
2595
|
+
allow="payment"
|
|
2596
|
+
[style.width]="'100%'"
|
|
2597
|
+
[style.height]="height"
|
|
2598
|
+
[style.border]="'none'"
|
|
2599
|
+
[style.opacity]="loaded ? 1 : 0"
|
|
2600
|
+
[style.transition]="'opacity 300ms linear, height 150ms ease-out'"
|
|
2601
|
+
></iframe>
|
|
2602
|
+
</div>`, styles: ["@keyframes coinflow-card-form-skeleton-pulse{0%,to{opacity:1}50%{opacity:.4}}\n"] }]
|
|
2603
|
+
}], ctorParameters: () => [{ type: i1.DomSanitizer }, { type: i0.NgZone }], propDecorators: { args: [{
|
|
1963
2604
|
type: Input
|
|
1964
2605
|
}], iframeRef: [{
|
|
1965
2606
|
type: ViewChild,
|
|
1966
2607
|
args: ['cardFormIframe', { static: true }]
|
|
2608
|
+
}], wrapperRef: [{
|
|
2609
|
+
type: ViewChild,
|
|
2610
|
+
args: ['wrapper', { static: true }]
|
|
1967
2611
|
}], onMessage: [{
|
|
1968
2612
|
type: HostListener,
|
|
1969
2613
|
args: ['window:message', ['$event']]
|
|
@@ -2337,5 +2981,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
2337
2981
|
* Generated bundle index. Do not edit.
|
|
2338
2982
|
*/
|
|
2339
2983
|
|
|
2340
|
-
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, REFERRER_HEADER, RN_REDIRECT_MESSAGE_NAME, SESSION_ID_HEADER, SettlementType, ThreeDsChallengePreference, TokenExCardNumberIframeId, TokenExCvvContainerID, WithdrawCategory, WithdrawCurrencies, WithdrawSpeed, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, getCoinflowProtectionHeaders, getCoinflowPurchaseHeaders, getCurrencyDecimals, getCustomerName, getHandlers, getIframeConfig, getWalletPubkey, handleIFrameMessage, initCoinflowProtection, invertRate, isBankingCurrency, isTypedCurrencyCents, isWithdrawCurrency, isZeroAuthSavedPaymentMethods, isZeroAuthVerifyCard, nftCartItem, paymentMethodLabels, recordFrontendError, setTokenExScriptTag };
|
|
2984
|
+
export { BankingCurrencies, CARD_ENTRY_BORDER_PX, CARD_ENTRY_DIVIDER_PX, CARD_ENTRY_MARGIN_PX, CARD_ENTRY_MIN_WIDTHS, CARD_ENTRY_ROW_HEIGHT, CARD_ENTRY_ROW_HEIGHT_PX, CARD_ENTRY_SLOT_GAP_PX, CARD_TYPE_MAPPING, COMPACT_SKELETON_HEIGHT_PX, CardType, ChargebackProtectionAccountType, CoinflowApplePayButtonComponent, CoinflowCardForm, CoinflowCardFormV2, CoinflowCardNumberInput, CoinflowCardNumberOnlyInput, CoinflowCvvInputComponent, CoinflowCvvOnlyInputComponent, CoinflowGooglePayButtonComponent, CoinflowIFrameComponent, CoinflowPurchaseComponent, CoinflowPurchaseHistoryComponent, CoinflowPurchaseProtectionComponent, CoinflowUtils, CoinflowWithdrawComponent, CoinflowWithdrawHistoryComponent, Currency, CurrencyToISO4217, DEVICE_ID_HEADER, EventBus, FORTER_TOKEN_HEADER, IFrameMessageMethods, INLINE_SKELETON_HEIGHT_PX, MerchantStyle, PaymentMethods, REFERRER_HEADER, RN_REDIRECT_MESSAGE_NAME, SESSION_ID_HEADER, SKELETON_BOX_STYLE, SKELETON_FADE_MS, SKELETON_LAYOUTS, SKELETON_PULSE_ANIMATION_NAME, SKELETON_ROOT_PADDING_PX, SettlementType, ThreeDsChallengePreference, TokenExCardNumberIframeId, TokenExCvvContainerID, WithdrawCategory, WithdrawCurrencies, WithdrawSpeed, awaitForterToken, buildCardEntryGridCss, buildCardEntryLayout, buildSkeletonCss, captureForterToken, doInitializeCvvOnlyTokenExIframe, doInitializeTokenExCardOnlyIframe, doInitializeTokenExIframe, getCoinflowProtectionHeaders, getCoinflowPurchaseHeaders, getCurrencyDecimals, getCustomerName, getForterToken, getHandlers, getIframeConfig, getSkeletonColors, getSkeletonGridClass, getSkeletonGridTemplate, getWalletPubkey, guessSkeletonHeightPx, handleIFrameMessage, initCoinflowProtection, invertRate, isBankingCurrency, isTypedCurrencyCents, isWithdrawCurrency, isZeroAuthSavedPaymentMethods, isZeroAuthVerifyCard, nftCartItem, paymentMethodLabels, recordFrontendError, setTokenExScriptTag, shouldStackSkeleton };
|
|
2341
2985
|
//# sourceMappingURL=coinflowlabs-angular.mjs.map
|