@funnelfox/billing 0.8.0-ffb-837.55 → 0.8.0-main.60
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 +14 -1
- package/dist/chunk-index.cjs.js +129 -11
- package/dist/chunk-index.cjs3.js +1 -1
- package/dist/chunk-index.es.js +129 -11
- package/dist/chunk-index.es3.js +1 -1
- package/dist/funnelfox-billing.js +130 -12
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +2 -2
- package/src/types.d.ts +47 -5
package/README.md
CHANGED
|
@@ -140,6 +140,8 @@ const checkout = await createCheckout({
|
|
|
140
140
|
- `customer.externalId` (string, required) - Your user identifier
|
|
141
141
|
- `customer.email` (string, optional) - Customer email
|
|
142
142
|
- `customer.countryCode` (string, optional) - ISO country code
|
|
143
|
+
- `options.displayCurrency` (string, optional) - ISO 4217 currency the page showed the price in (from Billing's `price_points/resolve`). Billing charges it when the price point offers it, otherwise the price point's own currency. Also accepted by `initMethod`, `createClientSession`, the Stripe forms, and (currency only) `silentPurchase` and `mountWalletUpsell`, which sends it with both the wallet session and the charge.
|
|
144
|
+
- `options.displayCountry` (string, optional) - ISO 3166-1 alpha-2 country the page resolved that currency for.
|
|
143
145
|
- `options.container` (string, required) - CSS selector for checkout container
|
|
144
146
|
- `options.card.emailAddress.visible` (boolean, optional) - Shows an email field in the card form. Disabled by default.
|
|
145
147
|
- `options.card.emailAddress.template` (string, optional) - Wraps the entered email before it is sent with payment, for example `{{email}}`.
|
|
@@ -256,7 +258,7 @@ checkout.on('destroy', () => {
|
|
|
256
258
|
|
|
257
259
|
#### Methods
|
|
258
260
|
|
|
259
|
-
##### `updatePrice(priceId)`
|
|
261
|
+
##### `updatePrice(priceId, clientMetadata?, displayLocale?)`
|
|
260
262
|
|
|
261
263
|
Updates the checkout to use a different price.
|
|
262
264
|
|
|
@@ -264,6 +266,16 @@ Updates the checkout to use a different price.
|
|
|
264
266
|
await checkout.updatePrice('price_yearly');
|
|
265
267
|
```
|
|
266
268
|
|
|
269
|
+
When the page shows the new price in another currency than the checkout was opened with, pass it
|
|
270
|
+
as `displayLocale`, otherwise the checkout keeps charging the currency it was opened in:
|
|
271
|
+
|
|
272
|
+
```javascript
|
|
273
|
+
await checkout.updatePrice('price_yearly', undefined, {
|
|
274
|
+
displayCurrency: 'EUR',
|
|
275
|
+
displayCountry: 'DE',
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
267
279
|
**Note:** Cannot update price while payment is processing.
|
|
268
280
|
|
|
269
281
|
##### `getStatus()`
|
|
@@ -727,6 +739,7 @@ const mount = await Billing.mountWalletUpsell(container, {
|
|
|
727
739
|
orgId: 'your-org-id',
|
|
728
740
|
priceId: 'upsell_price',
|
|
729
741
|
externalId: 'user_456',
|
|
742
|
+
displayCurrency: 'EUR', // optional: the currency the upsell page showed
|
|
730
743
|
clientMetadata: { ff_billing_reason: 'upsell' },
|
|
731
744
|
style: {
|
|
732
745
|
buttonType: 'plain',
|
package/dist/chunk-index.cjs.js
CHANGED
|
@@ -121,6 +121,7 @@ class APIError extends FunnefoxSDKError {
|
|
|
121
121
|
this.response = options.response || null;
|
|
122
122
|
this.declineCode = options.declineCode || null;
|
|
123
123
|
this.declineCodeSource = options.declineCodeSource || null;
|
|
124
|
+
this.retryAfterMs = options.retryAfterMs ?? null;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
class PrimerError extends FunnefoxSDKError {
|
|
@@ -360,6 +361,9 @@ function resolveTaxDisplay(source) {
|
|
|
360
361
|
return {
|
|
361
362
|
...resolveTaxAmount(source),
|
|
362
363
|
...resolveTaxBreakdown(source.tax_breakdown),
|
|
364
|
+
...(source.update_total_in_funnel != null
|
|
365
|
+
? { updateTotalInFunnel: source.update_total_in_funnel }
|
|
366
|
+
: {}),
|
|
363
367
|
};
|
|
364
368
|
}
|
|
365
369
|
function resolveTaxBreakdown(breakdown) {
|
|
@@ -446,7 +450,7 @@ function isBrowser() {
|
|
|
446
450
|
function sleep(ms) {
|
|
447
451
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
448
452
|
}
|
|
449
|
-
async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
|
|
453
|
+
async function retry(fn, maxAttempts = 3, baseDelay = 1000, delayFor) {
|
|
450
454
|
let lastError;
|
|
451
455
|
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
452
456
|
try {
|
|
@@ -456,7 +460,7 @@ async function retry(fn, maxAttempts = 3, baseDelay = 1000) {
|
|
|
456
460
|
lastError = error;
|
|
457
461
|
if (attempt === maxAttempts)
|
|
458
462
|
throw lastError;
|
|
459
|
-
const delay = baseDelay * Math.pow(2, attempt - 1);
|
|
463
|
+
const delay = delayFor?.(error) ?? baseDelay * Math.pow(2, attempt - 1);
|
|
460
464
|
await sleep(delay);
|
|
461
465
|
}
|
|
462
466
|
}
|
|
@@ -561,7 +565,7 @@ exports.PaymentMethod = void 0;
|
|
|
561
565
|
/**
|
|
562
566
|
* @fileoverview Constants for Funnefox SDK
|
|
563
567
|
*/
|
|
564
|
-
const SDK_VERSION = '0.8.0-
|
|
568
|
+
const SDK_VERSION = '0.8.0-main.60';
|
|
565
569
|
const DEFAULTS = {
|
|
566
570
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
567
571
|
REGION: 'default',
|
|
@@ -569,6 +573,7 @@ const DEFAULTS = {
|
|
|
569
573
|
REQUEST_TIMEOUT: 30000,
|
|
570
574
|
RETRY_ATTEMPTS: 3,
|
|
571
575
|
RETRY_BASE_DELAY: 1000,
|
|
576
|
+
MAX_RETRY_AFTER: 10000,
|
|
572
577
|
};
|
|
573
578
|
const CHECKOUT_STATES = {
|
|
574
579
|
INITIALIZING: 'initializing',
|
|
@@ -1344,9 +1349,42 @@ function toPaymentFailure(error) {
|
|
|
1344
1349
|
return failure;
|
|
1345
1350
|
}
|
|
1346
1351
|
|
|
1352
|
+
const CURRENCY_CODE = /^[A-Za-z]{3}$/;
|
|
1353
|
+
const COUNTRY_CODE = /^[A-Za-z]{2}$/;
|
|
1354
|
+
// Billing checks the code length before trimming it, so " EUR" or "EURO" fails the whole session
|
|
1355
|
+
// with a 422. An unknown currency is never an error there: left out, the price point's own one is
|
|
1356
|
+
// charged. A malformed code is dropped here for the same outcome instead of a checkout that never opens.
|
|
1357
|
+
function normalizeCode(value, pattern, option) {
|
|
1358
|
+
if (value === undefined || value === null || value === '') {
|
|
1359
|
+
return undefined;
|
|
1360
|
+
}
|
|
1361
|
+
const code = typeof value === 'string' ? value.trim() : '';
|
|
1362
|
+
if (!pattern.test(code)) {
|
|
1363
|
+
console.warn(`[funnelfox-billing] ${option} "${String(value)}" is not a valid code, so it is not sent`);
|
|
1364
|
+
return undefined;
|
|
1365
|
+
}
|
|
1366
|
+
return code.toUpperCase();
|
|
1367
|
+
}
|
|
1368
|
+
function normalizeDisplayCurrency(value) {
|
|
1369
|
+
return normalizeCode(value, CURRENCY_CODE, 'displayCurrency');
|
|
1370
|
+
}
|
|
1371
|
+
function normalizeDisplayCountry(value) {
|
|
1372
|
+
return normalizeCode(value, COUNTRY_CODE, 'displayCountry');
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1347
1375
|
/**
|
|
1348
1376
|
* @fileoverview API client for Funnefox backend integration
|
|
1349
1377
|
*/
|
|
1378
|
+
function parseRetryAfter(response) {
|
|
1379
|
+
const seconds = Number(response.headers?.get('Retry-After'));
|
|
1380
|
+
if (response.status !== 429 || !Number.isFinite(seconds) || seconds <= 0) {
|
|
1381
|
+
return null;
|
|
1382
|
+
}
|
|
1383
|
+
return Math.min(seconds * 1000, DEFAULTS.MAX_RETRY_AFTER);
|
|
1384
|
+
}
|
|
1385
|
+
function retryAfterMs(error) {
|
|
1386
|
+
return error instanceof APIError ? error.retryAfterMs : null;
|
|
1387
|
+
}
|
|
1350
1388
|
class APIClient {
|
|
1351
1389
|
constructor(config) {
|
|
1352
1390
|
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
@@ -1368,7 +1406,7 @@ class APIClient {
|
|
|
1368
1406
|
try {
|
|
1369
1407
|
return await retry(async () => {
|
|
1370
1408
|
return await withTimeout(this._makeRequest(url, requestOptions), this.timeout, 'Request timed out');
|
|
1371
|
-
}, this.retryAttempts);
|
|
1409
|
+
}, this.retryAttempts, DEFAULTS.RETRY_BASE_DELAY, retryAfterMs);
|
|
1372
1410
|
}
|
|
1373
1411
|
catch (error) {
|
|
1374
1412
|
if (error instanceof Error && error.name === 'APIError') {
|
|
@@ -1436,6 +1474,7 @@ class APIClient {
|
|
|
1436
1474
|
const message = d.error?.[0]?.msg || 'Failed to create payment';
|
|
1437
1475
|
throw new APIError(message, response.status, {
|
|
1438
1476
|
response: data,
|
|
1477
|
+
retryAfterMs: parseRetryAfter(response),
|
|
1439
1478
|
});
|
|
1440
1479
|
}
|
|
1441
1480
|
return data;
|
|
@@ -1452,6 +1491,14 @@ class APIClient {
|
|
|
1452
1491
|
if (params.countryCode !== undefined) {
|
|
1453
1492
|
payload.country_code = params.countryCode;
|
|
1454
1493
|
}
|
|
1494
|
+
const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
|
|
1495
|
+
if (displayCurrency) {
|
|
1496
|
+
payload.display_currency_code = displayCurrency;
|
|
1497
|
+
}
|
|
1498
|
+
const displayCountry = normalizeDisplayCountry(params.displayCountry);
|
|
1499
|
+
if (displayCountry) {
|
|
1500
|
+
payload.display_country_code = displayCountry;
|
|
1501
|
+
}
|
|
1455
1502
|
return (await this.request(API_ENDPOINTS.CREATE_CLIENT_SESSION, {
|
|
1456
1503
|
method: 'POST',
|
|
1457
1504
|
body: JSON.stringify(payload),
|
|
@@ -1464,6 +1511,14 @@ class APIClient {
|
|
|
1464
1511
|
pp_ident: params.priceId,
|
|
1465
1512
|
client_metadata: params.clientMetadata || {},
|
|
1466
1513
|
};
|
|
1514
|
+
const displayCurrency = normalizeDisplayCurrency(params.displayCurrency);
|
|
1515
|
+
if (displayCurrency) {
|
|
1516
|
+
payload.display_currency_code = displayCurrency;
|
|
1517
|
+
}
|
|
1518
|
+
const displayCountry = normalizeDisplayCountry(params.displayCountry);
|
|
1519
|
+
if (displayCountry) {
|
|
1520
|
+
payload.display_country_code = displayCountry;
|
|
1521
|
+
}
|
|
1467
1522
|
return await this.request(API_ENDPOINTS.UPDATE_CLIENT_SESSION, {
|
|
1468
1523
|
method: 'POST',
|
|
1469
1524
|
body: JSON.stringify(payload),
|
|
@@ -1663,10 +1718,13 @@ class SessionService {
|
|
|
1663
1718
|
p.baseUrl || DEFAULTS.BASE_URL,
|
|
1664
1719
|
p.region || DEFAULTS.REGION,
|
|
1665
1720
|
p.countryCode ?? '',
|
|
1721
|
+
p.displayCurrency ?? '',
|
|
1722
|
+
p.displayCountry ?? '',
|
|
1666
1723
|
p.priceId,
|
|
1667
1724
|
p.externalId,
|
|
1668
1725
|
p.email,
|
|
1669
1726
|
p.integration,
|
|
1727
|
+
p.sessionScope ?? '',
|
|
1670
1728
|
].join('|');
|
|
1671
1729
|
}
|
|
1672
1730
|
makeClient(orgId, baseUrl) {
|
|
@@ -1690,6 +1748,8 @@ class SessionService {
|
|
|
1690
1748
|
region: p.region || DEFAULTS.REGION,
|
|
1691
1749
|
clientMetadata: p.clientMetadata,
|
|
1692
1750
|
countryCode: p.countryCode,
|
|
1751
|
+
displayCurrency: p.displayCurrency,
|
|
1752
|
+
displayCountry: p.displayCountry,
|
|
1693
1753
|
integration: p.integration,
|
|
1694
1754
|
});
|
|
1695
1755
|
this.cache.set(key, req);
|
|
@@ -1712,6 +1772,19 @@ class SessionService {
|
|
|
1712
1772
|
}
|
|
1713
1773
|
var sessionService = new SessionService();
|
|
1714
1774
|
|
|
1775
|
+
const tails = new Map();
|
|
1776
|
+
function enqueueForOrder(key, task) {
|
|
1777
|
+
const run = (tails.get(key) ?? Promise.resolve()).then(task);
|
|
1778
|
+
const tail = run.then(() => undefined, () => undefined);
|
|
1779
|
+
tails.set(key, tail);
|
|
1780
|
+
void tail.then(() => {
|
|
1781
|
+
if (tails.get(key) === tail) {
|
|
1782
|
+
tails.delete(key);
|
|
1783
|
+
}
|
|
1784
|
+
});
|
|
1785
|
+
return run;
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1715
1788
|
var loaderHtml = "<div class=\"ff-sdk-loader-container\">\n <div class=\"ff-sdk-loader\"></div>\n</div>\n";
|
|
1716
1789
|
|
|
1717
1790
|
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent=".ff-sdk-loader-container {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: rgba(255, 255, 255);\n z-index: 2;\n}\n\n.ff-sdk-loader {\n width: 24px;\n height: 24px;\n border: 4px solid #e32f41;\n border-top: 4px solid transparent;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }";
|
|
@@ -2272,9 +2345,17 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2272
2345
|
this.checkoutConfig.onTaxError?.(err);
|
|
2273
2346
|
}
|
|
2274
2347
|
};
|
|
2348
|
+
this.canRecalcTax = () => !!this.orderId && !!this.getSelectedCountryCode();
|
|
2275
2349
|
this.scheduleTaxRecalc = () => {
|
|
2276
2350
|
if (this.taxRecalcDebounce) {
|
|
2277
2351
|
clearTimeout(this.taxRecalcDebounce);
|
|
2352
|
+
this.taxRecalcDebounce = undefined;
|
|
2353
|
+
if (!this.canRecalcTax() && this.lastTaxInfo) {
|
|
2354
|
+
this.emitTaxInfo(this.lastTaxInfo);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
if (!this.canRecalcTax()) {
|
|
2358
|
+
return;
|
|
2278
2359
|
}
|
|
2279
2360
|
this.checkoutConfig.onTaxPending?.();
|
|
2280
2361
|
this.emit(EVENTS.TAX_PENDING);
|
|
@@ -2450,8 +2531,8 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2450
2531
|
this.hideInitializingLoader();
|
|
2451
2532
|
}
|
|
2452
2533
|
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2534
|
+
sessionParams() {
|
|
2535
|
+
return {
|
|
2455
2536
|
orgId: this.orgId,
|
|
2456
2537
|
baseUrl: this.baseUrl,
|
|
2457
2538
|
priceId: this.checkoutConfig.priceId,
|
|
@@ -2460,8 +2541,14 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2460
2541
|
region: this.region,
|
|
2461
2542
|
clientMetadata: this.checkoutConfig.clientMetadata,
|
|
2462
2543
|
countryCode: this.checkoutConfig.customer.countryCode,
|
|
2544
|
+
displayCurrency: this.checkoutConfig.displayCurrency,
|
|
2545
|
+
displayCountry: this.checkoutConfig.displayCountry,
|
|
2546
|
+
sessionScope: this.checkoutConfig.sessionScope,
|
|
2463
2547
|
integration: 'primer',
|
|
2464
|
-
}
|
|
2548
|
+
};
|
|
2549
|
+
}
|
|
2550
|
+
async createSession() {
|
|
2551
|
+
const response = await sessionService.createSession(this.sessionParams());
|
|
2465
2552
|
const sessionResponse = response;
|
|
2466
2553
|
if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
|
|
2467
2554
|
const stripePublicKey = response.data.stripe_public_key;
|
|
@@ -2741,7 +2828,10 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2741
2828
|
},
|
|
2742
2829
|
};
|
|
2743
2830
|
}
|
|
2744
|
-
|
|
2831
|
+
updatePrice(newPriceId, clientMetadata, displayLocale) {
|
|
2832
|
+
return enqueueForOrder(this.orderId ?? `checkout:${this.id}`, () => this.applyPrice(newPriceId, clientMetadata, displayLocale));
|
|
2833
|
+
}
|
|
2834
|
+
async applyPrice(newPriceId, clientMetadata, displayLocale) {
|
|
2745
2835
|
this._ensureNotDestroyed();
|
|
2746
2836
|
requireString(newPriceId, 'priceId');
|
|
2747
2837
|
if (this.state === 'processing') {
|
|
@@ -2750,14 +2840,20 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2750
2840
|
try {
|
|
2751
2841
|
this.onLoaderChangeWithRace(true);
|
|
2752
2842
|
this._setState('updating');
|
|
2753
|
-
sessionService.
|
|
2843
|
+
sessionService.invalidate(this.sessionParams());
|
|
2844
|
+
const displayCurrency = displayLocale?.displayCurrency ?? this.checkoutConfig.displayCurrency;
|
|
2845
|
+
const displayCountry = displayLocale?.displayCountry ?? this.checkoutConfig.displayCountry;
|
|
2754
2846
|
await this.apiClient.updateClientSession({
|
|
2755
2847
|
orderId: this.orderId,
|
|
2756
2848
|
clientToken: this.clientToken,
|
|
2757
2849
|
priceId: newPriceId,
|
|
2758
2850
|
clientMetadata,
|
|
2851
|
+
displayCurrency,
|
|
2852
|
+
displayCountry,
|
|
2759
2853
|
});
|
|
2760
2854
|
this.checkoutConfig.priceId = newPriceId;
|
|
2855
|
+
this.checkoutConfig.displayCurrency = displayCurrency;
|
|
2856
|
+
this.checkoutConfig.displayCountry = displayCountry;
|
|
2761
2857
|
await this.primerWrapper.refreshClientSession();
|
|
2762
2858
|
this.onLoaderChangeWithRace(false);
|
|
2763
2859
|
this._setState('ready');
|
|
@@ -2786,7 +2882,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2786
2882
|
return;
|
|
2787
2883
|
try {
|
|
2788
2884
|
this.stopUnhandledTelemetry();
|
|
2789
|
-
sessionService.
|
|
2885
|
+
sessionService.invalidate(this.sessionParams());
|
|
2790
2886
|
await this.primerWrapper.destroy();
|
|
2791
2887
|
this._setState('destroyed');
|
|
2792
2888
|
this.orderId = null;
|
|
@@ -2970,6 +3066,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2970
3066
|
await methodInterface.destroy();
|
|
2971
3067
|
await this.destroy();
|
|
2972
3068
|
},
|
|
3069
|
+
updatePrice: (newPriceId, clientMetadata, displayLocale) => this.updatePrice(newPriceId, clientMetadata, displayLocale),
|
|
2973
3070
|
};
|
|
2974
3071
|
}
|
|
2975
3072
|
startUnhandledTelemetry(paymentMethod) {
|
|
@@ -3389,7 +3486,7 @@ async function createCheckout(options) {
|
|
|
3389
3486
|
}
|
|
3390
3487
|
}
|
|
3391
3488
|
async function createClientSession(params) {
|
|
3392
|
-
const { priceId, externalId, email, clientMetadata, countryCode } = params;
|
|
3489
|
+
const { priceId, externalId, email, clientMetadata, countryCode, displayCurrency, displayCountry, } = params;
|
|
3393
3490
|
const config = resolveConfig(params, 'createClientSession');
|
|
3394
3491
|
const apiClient = new APIClient({
|
|
3395
3492
|
baseUrl: config.baseUrl,
|
|
@@ -3404,6 +3501,8 @@ async function createClientSession(params) {
|
|
|
3404
3501
|
region: config.region,
|
|
3405
3502
|
clientMetadata,
|
|
3406
3503
|
countryCode,
|
|
3504
|
+
displayCurrency,
|
|
3505
|
+
displayCountry,
|
|
3407
3506
|
});
|
|
3408
3507
|
return apiClient.processSessionResponse(sessionResponse);
|
|
3409
3508
|
}
|
|
@@ -3422,6 +3521,10 @@ function buildOneClickRequest(options) {
|
|
|
3422
3521
|
if (options.citCardNetworks !== undefined) {
|
|
3423
3522
|
payload.cit_card_networks = options.citCardNetworks;
|
|
3424
3523
|
}
|
|
3524
|
+
const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
|
|
3525
|
+
if (displayCurrency) {
|
|
3526
|
+
payload.display_currency_code = displayCurrency;
|
|
3527
|
+
}
|
|
3425
3528
|
return payload;
|
|
3426
3529
|
}
|
|
3427
3530
|
function silentPurchase(options) {
|
|
@@ -3877,6 +3980,9 @@ async function initMethod(method, element, options) {
|
|
|
3877
3980
|
},
|
|
3878
3981
|
container: '',
|
|
3879
3982
|
clientMetadata: options.meta,
|
|
3983
|
+
displayCurrency: options.displayCurrency,
|
|
3984
|
+
displayCountry: options.displayCountry,
|
|
3985
|
+
sessionScope: options.sessionScope,
|
|
3880
3986
|
card: options.card,
|
|
3881
3987
|
style: options.style,
|
|
3882
3988
|
applePay: {
|
|
@@ -3968,6 +4074,8 @@ async function createStripeCardForm(element, params) {
|
|
|
3968
4074
|
email: params.email,
|
|
3969
4075
|
clientMetadata: params.clientMetadata,
|
|
3970
4076
|
countryCode: params.countryCode,
|
|
4077
|
+
displayCurrency: params.displayCurrency,
|
|
4078
|
+
displayCountry: params.displayCountry,
|
|
3971
4079
|
integration: 'stripe',
|
|
3972
4080
|
};
|
|
3973
4081
|
const [session, { mountStripeCardForm }] = await Promise.all([
|
|
@@ -3996,6 +4104,8 @@ async function purchaseStripeWallet(params) {
|
|
|
3996
4104
|
email: params.email,
|
|
3997
4105
|
clientMetadata: params.clientMetadata,
|
|
3998
4106
|
countryCode: params.countryCode,
|
|
4107
|
+
displayCurrency: params.displayCurrency,
|
|
4108
|
+
displayCountry: params.displayCountry,
|
|
3999
4109
|
integration: 'stripe',
|
|
4000
4110
|
};
|
|
4001
4111
|
const [session, { purchaseWallet }] = await Promise.all([
|
|
@@ -4025,6 +4135,8 @@ async function getAvailableStripeWallet(params) {
|
|
|
4025
4135
|
email: params.email,
|
|
4026
4136
|
clientMetadata: params.clientMetadata,
|
|
4027
4137
|
countryCode: params.countryCode,
|
|
4138
|
+
displayCurrency: params.displayCurrency,
|
|
4139
|
+
displayCountry: params.displayCountry,
|
|
4028
4140
|
integration: 'stripe',
|
|
4029
4141
|
}),
|
|
4030
4142
|
Promise.resolve().then(function () { return require('./chunk-stripe-wallet.cjs.js'); }),
|
|
@@ -4100,12 +4212,17 @@ function parseWalletSession(data) {
|
|
|
4100
4212
|
expiresAt,
|
|
4101
4213
|
};
|
|
4102
4214
|
}
|
|
4215
|
+
function displayCurrencyField(options) {
|
|
4216
|
+
const displayCurrency = normalizeDisplayCurrency(options.displayCurrency);
|
|
4217
|
+
return displayCurrency ? { display_currency_code: displayCurrency } : {};
|
|
4218
|
+
}
|
|
4103
4219
|
/** `null` = the customer's saved method is not a Primer wallet. */
|
|
4104
4220
|
async function prepareSession(apiClient, options) {
|
|
4105
4221
|
const response = await apiClient.oneClickWalletSession({
|
|
4106
4222
|
pp_ident: options.priceId,
|
|
4107
4223
|
external_id: options.externalId,
|
|
4108
4224
|
client_metadata: options.clientMetadata || {},
|
|
4225
|
+
...displayCurrencyField(options),
|
|
4109
4226
|
}, SESSION_REQUEST_TIMEOUT_MS);
|
|
4110
4227
|
if (response?.status !== 'success' || !response.data) {
|
|
4111
4228
|
throw new APIError('one_click_wallet_session failed', null, { response });
|
|
@@ -4488,6 +4605,7 @@ class WalletUpsell {
|
|
|
4488
4605
|
{}),
|
|
4489
4606
|
payment_method_token: paymentMethodToken,
|
|
4490
4607
|
session_id: session.sessionId,
|
|
4608
|
+
...displayCurrencyField(this.options),
|
|
4491
4609
|
};
|
|
4492
4610
|
const idempotencyKey = createIdempotencyKey();
|
|
4493
4611
|
if (idempotencyKey) {
|
package/dist/chunk-index.cjs3.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
var template = "<div>\n <label class=\"ff-card-form-label\" for=\"cardNumberInput\">Card number</label>\n <div id=\"cardNumberInput\"></div>\n <div class=\"errorContainer\"></div>\n</div>\n<div class=\"card-form-row\">\n <div>\n <label class=\"ff-card-form-label\" for=\"expiryInput\">Expiration date</label>\n <div id=\"expiryInput\"></div>\n <div class=\"errorContainer\"></div>\n </div>\n <div>\n <label class=\"ff-card-form-label\" for=\"cvvInput\">Security code</label>\n <div id=\"cvvInput\">\n <svg width=\"200\" height=\"200\" viewBox=\"0 0 200 200\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"200\" height=\"200\" fill=\"transparent\"/>\n <g clip-path=\"url(#clip0_0_1)\">\n <path d=\"M157.555 23C168.279 23.0002 177 31.7394 177 42.4854V80.5889C171.946 72.0151 164.749 64.8558 156.146 59.8457H166.394V42.4854C166.393 37.6004 162.43 33.6291 157.555 33.6289H27.4453C22.5704 33.6291 18.6066 37.6004 18.6064 42.4854V59.8457H97.8535C88.9153 65.0512 81.4954 72.5771 76.4189 81.5986H18.6064V127.515C18.6066 132.4 22.5704 136.371 27.4453 136.371H75.3281C77.2742 140.177 79.6285 143.739 82.333 147H27.4453C16.7215 147 8.00019 138.261 8 127.515V42.4854C8.0002 31.7394 16.7215 23.0002 27.4453 23H157.555Z\" fill=\"#93939A\"/>\n <mask id=\"path-2-outside-1_0_1\" maskUnits=\"userSpaceOnUse\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\" fill=\"black\">\n <rect fill=\"white\" x=\"68.5012\" y=\"52.0311\" width=\"135\" height=\"135\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\"/>\n </mask>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" fill=\"#93939A\"/>\n <path d=\"M190.242 160.457L170.136 140.351C166.533 145.552 162.023 150.063 156.821 153.666L176.927 173.772C178.693 175.538 181.088 176.53 183.585 176.53C186.082 176.53 188.477 175.538 190.242 173.772C192.008 172.007 193 169.612 193 167.115C193 164.618 192.008 162.223 190.242 160.457ZM126.436 157.901C116.955 157.901 107.688 155.089 99.8048 149.822C91.922 144.555 85.7781 137.069 82.15 128.31C78.5219 119.551 77.5727 109.913 79.4222 100.614C81.2718 91.3158 85.8371 82.7746 92.5409 76.0708C99.2447 69.367 107.786 64.8017 117.084 62.9521C126.383 61.1026 136.021 62.0518 144.78 65.6799C153.539 69.308 161.025 75.4519 166.292 83.3347C171.559 91.2175 174.371 100.485 174.371 109.966C174.371 122.679 169.32 134.871 160.331 143.861C151.341 152.85 139.149 157.901 126.436 157.901ZM163.719 109.966C163.719 102.592 161.532 95.3838 157.435 89.2527C153.339 83.1216 147.516 78.343 140.703 75.5212C133.891 72.6994 126.395 71.9611 119.162 73.3996C111.93 74.8382 105.287 78.389 100.073 83.6031C94.8591 88.8171 91.3083 95.4602 89.8697 102.692C88.4312 109.924 89.1695 117.421 91.9913 124.233C94.8131 131.046 99.5918 136.869 105.723 140.965C111.854 145.062 119.062 147.248 126.436 147.248C136.324 147.248 145.807 143.32 152.799 136.329C159.791 129.337 163.719 119.854 163.719 109.966ZM133.645 102.757C133.398 102.51 133.104 102.313 132.781 102.179C132.458 102.046 132.112 101.977 131.762 101.977C131.412 101.977 131.066 102.046 130.743 102.179C130.42 102.313 130.126 102.51 129.879 102.757L126.436 106.2L122.993 102.757C122.49 102.272 121.818 102.003 121.119 102.01C120.421 102.016 119.753 102.296 119.26 102.789C118.766 103.283 118.486 103.951 118.48 104.649C118.474 105.348 118.742 106.02 119.227 106.523L122.67 109.966L119.227 113.409C118.973 113.655 118.77 113.949 118.63 114.274C118.491 114.598 118.417 114.948 118.414 115.301C118.411 115.655 118.479 116.006 118.612 116.333C118.746 116.66 118.944 116.958 119.194 117.208C119.444 117.458 119.741 117.655 120.069 117.789C120.396 117.923 120.747 117.991 121.1 117.988C121.454 117.985 121.803 117.911 122.128 117.771C122.453 117.632 122.747 117.429 122.993 117.175L126.436 113.732L129.879 117.175C130.382 117.66 131.054 117.928 131.752 117.922C132.451 117.916 133.119 117.636 133.612 117.142C134.106 116.648 134.386 115.981 134.392 115.282C134.398 114.584 134.13 113.911 133.645 113.409L130.202 109.966L133.645 106.523C133.892 106.275 134.088 105.982 134.222 105.659C134.356 105.336 134.425 104.989 134.425 104.64C134.425 104.29 134.356 103.944 134.222 103.621C134.088 103.298 133.892 103.004 133.645 102.757ZM112.34 102.757C112.093 102.51 111.8 102.313 111.477 102.179C111.154 102.046 110.807 101.977 110.458 101.977C110.108 101.977 109.762 102.046 109.439 102.179C109.116 102.313 108.822 102.51 108.575 102.757L105.132 106.2L101.688 102.757C101.186 102.272 100.513 102.003 99.8151 102.01C99.1169 102.016 98.4489 102.296 97.9552 102.789C97.4614 103.283 97.1814 103.951 97.1753 104.649C97.1692 105.348 97.4377 106.02 97.9227 106.523L101.366 109.966L97.9227 113.409C97.6684 113.655 97.4655 113.949 97.326 114.274C97.1864 114.598 97.1129 114.948 97.1098 115.301C97.1068 115.655 97.1742 116.006 97.3081 116.333C97.442 116.66 97.6397 116.958 97.8897 117.208C98.1398 117.458 98.4371 117.655 98.7644 117.789C99.0917 117.923 99.4423 117.991 99.7959 117.988C100.15 117.985 100.499 117.911 100.824 117.771C101.149 117.632 101.443 117.429 101.688 117.175L105.132 113.732L108.575 117.175C109.077 117.66 109.75 117.928 110.448 117.922C111.146 117.916 111.814 117.636 112.308 117.142C112.802 116.648 113.082 115.981 113.088 115.282C113.094 114.584 112.826 113.911 112.34 113.409L108.897 109.966L112.34 106.523C112.588 106.275 112.784 105.982 112.918 105.659C113.052 105.336 113.121 104.989 113.121 104.64C113.121 104.29 113.052 103.944 112.918 103.621C112.784 103.298 112.588 103.004 112.34 102.757ZM151.506 109.966L154.949 106.523C155.434 106.02 155.703 105.348 155.697 104.649C155.691 103.951 155.41 103.283 154.917 102.789C154.423 102.296 153.755 102.016 153.057 102.01C152.359 102.003 151.686 102.272 151.184 102.757L147.74 106.2L144.297 102.757C143.795 102.272 143.122 102.003 142.424 102.01C141.726 102.016 141.058 102.296 140.564 102.789C140.07 103.283 139.79 103.951 139.784 104.649C139.778 105.348 140.046 106.02 140.531 106.523L143.974 109.966L140.531 113.409C140.277 113.655 140.074 113.949 139.935 114.274C139.795 114.598 139.722 114.948 139.719 115.301C139.715 115.655 139.783 116.006 139.917 116.333C140.051 116.66 140.248 116.958 140.498 117.208C140.748 117.458 141.046 117.655 141.373 117.789C141.7 117.923 142.051 117.991 142.405 117.988C142.758 117.985 143.108 117.911 143.433 117.771C143.757 117.632 144.051 117.429 144.297 117.175L147.74 113.732L151.184 117.175C151.686 117.66 152.359 117.928 153.057 117.922C153.755 117.916 154.423 117.636 154.917 117.142C155.41 116.648 155.691 115.981 155.697 115.282C155.703 114.584 155.434 113.911 154.949 113.409L151.506 109.966Z\" stroke=\"transparent\" stroke-width=\"20\" mask=\"url(#path-2-outside-1_0_1)\"/>\n </g>\n <defs>\n <clipPath id=\"clip0_0_1\">\n <rect width=\"200\" height=\"200\" fill=\"white\"/>\n </clipPath>\n </defs>\n </svg>\n </div>\n <div class=\"errorContainer\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"cardHolderInput\">Cardholder name</label>\n <input class=\"ff-card-form-text-input\" id=\"cardHolderInput\" type=\"text\" pattern=\"[A-Za-z\\s]+\" placeholder=\"Full name on card\">\n <div class=\"errorContainer\"></div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"emailAddressInput\">Email</label>\n <input class=\"ff-card-form-text-input\" id=\"emailAddressInput\" placeholder=\"Email\" type=\"email\">\n <div class=\"errorContainer\"></div>\n</div>\n<div id=\"countrySelectorField\">\n <label class=\"ff-card-form-label\" for=\"countrySelectorInput\">Country</label>\n <div class=\"ff-select-wrap\">\n <select class=\"ff-card-form-text-input ff-card-form-select\" id=\"countrySelectorInput\"></select>\n <div class=\"ff-select-arrow\" aria-hidden=\"true\"></div>\n </div>\n</div>\n<div>\n <label class=\"ff-card-form-label\" for=\"postalCodeInput\">Zip code</label>\n <input class=\"ff-card-form-text-input\" id=\"postalCodeInput\" placeholder=\"12345\">\n <div class=\"errorContainer\"></div>\n</div>\n";
|
|
11
11
|
|
|
12
|
-
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-template-rows: repeat(3, auto);\n grid-auto-flow: column;\n column-gap: 10px;\n }\n\n /* Label, input and error of both columns share grid rows, so a label that wraps in one column\n moves both inputs down together, and an error under one input does not move the other. */\n .card-form-row > div {\n display: contents;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #df1b41;\n font-size: 15px;\n line-height: 1.15;\n margin: 4px 0 10px;\n }\n\n #cvvInput {\n position: relative;\n }\n\n #cvvInput > svg {\n z-index: 1;\n position: absolute;\n top: 5px;\n right: 5px;\n width: 26px;\n height: 26px;\n }\n";
|
|
12
|
+
if(typeof document!=="undefined")document.head.appendChild(document.createElement("style")).textContent="\n\n.ff-card-form-label {\n display: block;\n font-size: 16px;\n margin-bottom: 5px;\n }\n \n .card-form-row {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-template-rows: repeat(3, auto);\n grid-auto-flow: column;\n column-gap: 10px;\n }\n\n /* Label, input and error of both columns share grid rows, so a label that wraps in one column\n moves both inputs down together, and an error under one input does not move the other. */\n .card-form-row > div {\n display: contents;\n }\n \n .ff-card-form-text-input {\n margin: 0 0 3px;\n padding-left: 10px;\n padding-right: 10px;\n box-sizing: border-box;\n height: 36px;\n width: 100%;\n font-size: 1rem;\n background-color: transparent;\n border: 1px solid rgb(0 0 0 / 10%);\n border-radius: 6px;\n transition: all 0.3s ease;\n box-shadow: none;\n outline: none;\n }\n .ff-card-form-text-input.error {\n border-color: #e32f41;\n }\n\n.ff-select-wrap {\n position: relative;\n}\n\n.ff-card-form-select {\n /* iOS Safari paints select text system blue unless a color is set; match the label instead. */\n color: inherit;\n padding-right: 34px;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n background-image: none;\n}\n\n.ff-card-form-select::-ms-expand {\n display: none;\n}\n\n.ff-card-form-select:disabled {\n color: #6b7280;\n cursor: not-allowed;\n}\n\n.ff-select-arrow {\n position: absolute;\n top: 50%;\n right: 12px;\n width: 8px;\n height: 8px;\n border-right: 1.5px solid #6b7280;\n border-bottom: 1.5px solid #6b7280;\n transform: translateY(-65%) rotate(45deg);\n pointer-events: none;\n}\n\n.ff-select-wrap:focus-within .ff-select-arrow {\n border-right-color: #111827;\n border-bottom-color: #111827;\n}\n \n .errorContainer:not(:empty) {\n color: #df1b41;\n font-size: 15px;\n line-height: 1.15;\n margin: 4px 0 10px;\n }\n\n #cvvInput {\n position: relative;\n }\n\n #cvvInput > svg {\n z-index: 1;\n position: absolute;\n top: 5px;\n right: 5px;\n width: 26px;\n height: 26px;\n }\n";
|
|
13
13
|
|
|
14
14
|
class CardSkin {
|
|
15
15
|
constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
|