@funnelfox/billing 0.9.0-ffb-467-adyen.25 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/chunk-index.cjs.js +151 -139
- package/dist/chunk-index.cjs2.js +6 -0
- package/dist/chunk-index.cjs3.js +37 -2
- package/dist/chunk-index.es.js +151 -138
- package/dist/chunk-index.es2.js +6 -0
- package/dist/chunk-index.es3.js +37 -2
- package/dist/chunk-stripe-card-form.cjs.js +191 -61
- package/dist/chunk-stripe-card-form.es.js +191 -61
- package/dist/chunk-stripe-loader.es.js +1 -1
- package/dist/chunk-stripe-wallet.cjs.js +40 -7
- package/dist/chunk-stripe-wallet.es.js +40 -7
- package/dist/funnelfox-billing.esm.js +1 -1
- package/dist/funnelfox-billing.js +425 -660
- package/dist/funnelfox-billing.min.js +1 -1
- package/package.json +5 -1
- package/src/types.d.ts +17 -74
- package/dist/chunk-adyen-card-form.cjs.js +0 -226
- package/dist/chunk-adyen-card-form.es.js +0 -224
- package/dist/chunk-adyen-loader.cjs.js +0 -49
- package/dist/chunk-adyen-loader.es.js +0 -45
- package/dist/chunk-adyen-wallet.cjs.js +0 -205
- package/dist/chunk-adyen-wallet.es.js +0 -202
package/README.md
CHANGED
|
@@ -800,6 +800,8 @@ if (wallet === 'APPLE_PAY') {
|
|
|
800
800
|
|
|
801
801
|
**Returns:** `Promise<'APPLE_PAY' | 'GOOGLE_PAY' | null>`
|
|
802
802
|
|
|
803
|
+
Call `Billing.stripe.getAvailableWallet(...)` while rendering the page (it decides whether to show the wallet button anyway). Besides detecting availability it prewarms the payment sheet, so `purchaseWallet(...)` inside the click handler can open it immediately — Safari cancels Apple Pay sheets that open after long async work in the click handler. Pass the same `priceId`/`externalId`/`email`/`countryCode` to both calls: they share one checkout session, and mismatched params create a second session and skip the prewarmed sheet.
|
|
804
|
+
|
|
803
805
|
---
|
|
804
806
|
|
|
805
807
|
### `Billing.stripe.purchaseWallet(params)`
|
package/dist/chunk-index.cjs.js
CHANGED
|
@@ -171,16 +171,7 @@ function loadScript$1(options) {
|
|
|
171
171
|
existingScript = document.querySelector(`script[src="${src}"]`);
|
|
172
172
|
}
|
|
173
173
|
if (existingScript) {
|
|
174
|
-
|
|
175
|
-
// card form and the wallet probe both request Adyen Web at once). Resolving now would let the
|
|
176
|
-
// caller read the not-yet-defined global; wait for the in-flight load instead.
|
|
177
|
-
if (existingScript.dataset.loaded === 'true') {
|
|
178
|
-
resolve(existingScript);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
existingScript.addEventListener('load', () => resolve(existingScript));
|
|
182
|
-
existingScript.addEventListener('error', () => reject(new Error(`Failed to load script: ${src}`)));
|
|
183
|
-
}
|
|
174
|
+
resolve(existingScript);
|
|
184
175
|
return;
|
|
185
176
|
}
|
|
186
177
|
const script = document.createElement('script');
|
|
@@ -202,10 +193,7 @@ function loadScript$1(options) {
|
|
|
202
193
|
Object.entries(attributes).forEach(([key, value]) => {
|
|
203
194
|
script.setAttribute(key, value);
|
|
204
195
|
});
|
|
205
|
-
script.onload = () =>
|
|
206
|
-
script.dataset.loaded = 'true';
|
|
207
|
-
resolve(script);
|
|
208
|
-
};
|
|
196
|
+
script.onload = () => resolve(script);
|
|
209
197
|
script.onerror = () => reject(new Error(`Failed to load script: ${src}`));
|
|
210
198
|
const target = appendTo === 'head' ? document.head : document.body;
|
|
211
199
|
target.appendChild(script);
|
|
@@ -224,14 +212,7 @@ function loadStylesheet(options) {
|
|
|
224
212
|
// Check if stylesheet already exists
|
|
225
213
|
const existingLink = document.querySelector(`link[href="${href}"]`);
|
|
226
214
|
if (existingLink) {
|
|
227
|
-
|
|
228
|
-
if (existingLink.dataset.loaded === 'true') {
|
|
229
|
-
resolve(existingLink);
|
|
230
|
-
}
|
|
231
|
-
else {
|
|
232
|
-
existingLink.addEventListener('load', () => resolve(existingLink));
|
|
233
|
-
existingLink.addEventListener('error', () => reject(new Error(`Failed to load stylesheet: ${href}`)));
|
|
234
|
-
}
|
|
215
|
+
resolve(existingLink);
|
|
235
216
|
return;
|
|
236
217
|
}
|
|
237
218
|
const link = document.createElement('link');
|
|
@@ -243,10 +224,7 @@ function loadStylesheet(options) {
|
|
|
243
224
|
if (crossOrigin) {
|
|
244
225
|
link.crossOrigin = crossOrigin;
|
|
245
226
|
}
|
|
246
|
-
link.onload = () =>
|
|
247
|
-
link.dataset.loaded = 'true';
|
|
248
|
-
resolve(link);
|
|
249
|
-
};
|
|
227
|
+
link.onload = () => resolve(link);
|
|
250
228
|
link.onerror = () => reject(new Error(`Failed to load stylesheet: ${href}`));
|
|
251
229
|
document.head.appendChild(link);
|
|
252
230
|
});
|
|
@@ -345,6 +323,20 @@ async function loadPrimerSDK(version) {
|
|
|
345
323
|
/**
|
|
346
324
|
* @fileoverview Helper utilities for Funnefox SDK
|
|
347
325
|
*/
|
|
326
|
+
function formatCurrencyAmount(minorAmount, currency) {
|
|
327
|
+
const code = currency?.trim().toUpperCase() || 'USD';
|
|
328
|
+
try {
|
|
329
|
+
const formatter = new Intl.NumberFormat(undefined, {
|
|
330
|
+
style: 'currency',
|
|
331
|
+
currency: code,
|
|
332
|
+
});
|
|
333
|
+
const fractionDigits = formatter.resolvedOptions().maximumFractionDigits ?? 2;
|
|
334
|
+
return formatter.format(minorAmount / 10 ** fractionDigits);
|
|
335
|
+
}
|
|
336
|
+
catch {
|
|
337
|
+
return `${(minorAmount / 100).toFixed(2)} ${code}`;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
348
340
|
function merge(...objects) {
|
|
349
341
|
const result = {};
|
|
350
342
|
for (const obj of objects) {
|
|
@@ -513,7 +505,7 @@ exports.PaymentMethod = void 0;
|
|
|
513
505
|
/**
|
|
514
506
|
* @fileoverview Constants for Funnefox SDK
|
|
515
507
|
*/
|
|
516
|
-
const SDK_VERSION = '0.9.0
|
|
508
|
+
const SDK_VERSION = '0.9.0';
|
|
517
509
|
const DEFAULTS = {
|
|
518
510
|
BASE_URL: 'https://billing.funnelfox.com',
|
|
519
511
|
REGION: 'default',
|
|
@@ -546,6 +538,8 @@ const EVENTS = {
|
|
|
546
538
|
PURCHASE_COMPLETED: 'purchase-completed',
|
|
547
539
|
PURCHASE_CANCELLED: 'purchase-cancelled',
|
|
548
540
|
METHODS_AVAILABLE: 'methods-available',
|
|
541
|
+
TAX_CHANGE: 'tax-change',
|
|
542
|
+
TAX_PENDING: 'tax-pending',
|
|
549
543
|
};
|
|
550
544
|
const API_ENDPOINTS = {
|
|
551
545
|
CREATE_CLIENT_SESSION: '/v1/checkout/create_client_session',
|
|
@@ -1219,6 +1213,15 @@ class APIClient {
|
|
|
1219
1213
|
method: 'POST',
|
|
1220
1214
|
body: JSON.stringify(payload),
|
|
1221
1215
|
}));
|
|
1216
|
+
if (raw.status === 'error' || !raw.data) {
|
|
1217
|
+
const firstError = raw.error?.[0];
|
|
1218
|
+
throw new APIError(firstError?.msg || 'Tax recalculation failed', null, {
|
|
1219
|
+
errorCode: firstError?.code,
|
|
1220
|
+
errorType: firstError?.type,
|
|
1221
|
+
requestId: raw.req_id,
|
|
1222
|
+
response: raw,
|
|
1223
|
+
});
|
|
1224
|
+
}
|
|
1222
1225
|
return raw.data;
|
|
1223
1226
|
}
|
|
1224
1227
|
async resumePayment(params) {
|
|
@@ -1316,7 +1319,16 @@ class SessionService {
|
|
|
1316
1319
|
this.cache = new Map();
|
|
1317
1320
|
}
|
|
1318
1321
|
buildCacheKey(p) {
|
|
1319
|
-
return [
|
|
1322
|
+
return [
|
|
1323
|
+
p.orgId,
|
|
1324
|
+
p.baseUrl || DEFAULTS.BASE_URL,
|
|
1325
|
+
p.region || DEFAULTS.REGION,
|
|
1326
|
+
p.countryCode ?? '',
|
|
1327
|
+
p.priceId,
|
|
1328
|
+
p.externalId,
|
|
1329
|
+
p.email,
|
|
1330
|
+
p.integration,
|
|
1331
|
+
].join('|');
|
|
1320
1332
|
}
|
|
1321
1333
|
makeClient(orgId, baseUrl) {
|
|
1322
1334
|
return new APIClient({
|
|
@@ -1342,8 +1354,19 @@ class SessionService {
|
|
|
1342
1354
|
integration: p.integration,
|
|
1343
1355
|
});
|
|
1344
1356
|
this.cache.set(key, req);
|
|
1357
|
+
const evict = () => {
|
|
1358
|
+
if (this.cache.get(key) === req)
|
|
1359
|
+
this.cache.delete(key);
|
|
1360
|
+
};
|
|
1361
|
+
req.then(resp => {
|
|
1362
|
+
if (!resp || resp.status === 'error' || !resp.data)
|
|
1363
|
+
evict();
|
|
1364
|
+
}, evict);
|
|
1345
1365
|
return req;
|
|
1346
1366
|
}
|
|
1367
|
+
invalidate(p) {
|
|
1368
|
+
this.cache.delete(this.buildCacheKey(p));
|
|
1369
|
+
}
|
|
1347
1370
|
clearCache() {
|
|
1348
1371
|
this.cache.clear();
|
|
1349
1372
|
}
|
|
@@ -1806,6 +1829,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1806
1829
|
super();
|
|
1807
1830
|
this.counter = 0;
|
|
1808
1831
|
this.cachedSessionResponse = null;
|
|
1832
|
+
this.taxRecalcSeq = 0;
|
|
1809
1833
|
this.cardSessionFieldConfig = {};
|
|
1810
1834
|
this.isTelemetryEnabled = false;
|
|
1811
1835
|
this.telemetryCleanup = null;
|
|
@@ -1849,16 +1873,35 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1849
1873
|
this.isTaxEnabled = () => this.cachedSessionResponse?.data?.tax_enabled ??
|
|
1850
1874
|
this.checkoutConfig.enableTax ??
|
|
1851
1875
|
false;
|
|
1852
|
-
this.
|
|
1876
|
+
this.getSessionTaxInfo = () => {
|
|
1853
1877
|
const data = this.cachedSessionResponse?.data;
|
|
1854
1878
|
if (!data || data.amount_total == null) {
|
|
1855
|
-
return;
|
|
1879
|
+
return undefined;
|
|
1856
1880
|
}
|
|
1857
|
-
|
|
1881
|
+
return {
|
|
1858
1882
|
amountTotal: data.amount_total,
|
|
1859
1883
|
taxAmount: data.tax_amount ?? 0,
|
|
1860
1884
|
currency: data.currency ?? '',
|
|
1861
|
-
}
|
|
1885
|
+
};
|
|
1886
|
+
};
|
|
1887
|
+
this.emitTaxInfo = (info) => {
|
|
1888
|
+
this.lastTaxInfo = info;
|
|
1889
|
+
this.checkoutConfig.onTaxChange?.(info);
|
|
1890
|
+
this.emit(EVENTS.TAX_CHANGE, info);
|
|
1891
|
+
};
|
|
1892
|
+
this.emitSessionTaxEstimate = () => {
|
|
1893
|
+
const info = this.getSessionTaxInfo();
|
|
1894
|
+
if (info) {
|
|
1895
|
+
this.emitTaxInfo(info);
|
|
1896
|
+
}
|
|
1897
|
+
};
|
|
1898
|
+
// Re-render the current tax figures to a skin that subscribed after the estimate was first
|
|
1899
|
+
// emitted (the initMethod card path wires the skin only once the method mounts).
|
|
1900
|
+
this.renderTaxToSkin = () => {
|
|
1901
|
+
const info = this.lastTaxInfo ?? this.getSessionTaxInfo();
|
|
1902
|
+
if (info) {
|
|
1903
|
+
this.emit(EVENTS.TAX_CHANGE, info);
|
|
1904
|
+
}
|
|
1862
1905
|
};
|
|
1863
1906
|
this.runTaxRecalc = async () => {
|
|
1864
1907
|
const orderId = this.orderId;
|
|
@@ -1866,6 +1909,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1866
1909
|
if (!orderId || !countryCode) {
|
|
1867
1910
|
return;
|
|
1868
1911
|
}
|
|
1912
|
+
const seq = ++this.taxRecalcSeq;
|
|
1869
1913
|
try {
|
|
1870
1914
|
const tax = await this.apiClient.recalculateTax({
|
|
1871
1915
|
orderId,
|
|
@@ -1873,15 +1917,24 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1873
1917
|
countryCode,
|
|
1874
1918
|
postalCode: this.cardPostalCode,
|
|
1875
1919
|
});
|
|
1876
|
-
this.
|
|
1920
|
+
if (seq !== this.taxRecalcSeq) {
|
|
1921
|
+
return;
|
|
1922
|
+
}
|
|
1923
|
+
this.emitTaxInfo({
|
|
1877
1924
|
amountTotal: tax.amount_total,
|
|
1878
1925
|
taxAmount: tax.tax_amount,
|
|
1879
1926
|
currency: tax.currency,
|
|
1880
1927
|
});
|
|
1881
1928
|
}
|
|
1882
1929
|
catch (err) {
|
|
1930
|
+
if (seq !== this.taxRecalcSeq) {
|
|
1931
|
+
return;
|
|
1932
|
+
}
|
|
1883
1933
|
// Recalc failed for the new address; surface it instead of silently showing a stale total.
|
|
1884
1934
|
console.warn('[funnelfox-billing] tax recalculation failed', err);
|
|
1935
|
+
if (this.lastTaxInfo) {
|
|
1936
|
+
this.emit(EVENTS.TAX_CHANGE, this.lastTaxInfo);
|
|
1937
|
+
}
|
|
1885
1938
|
this.checkoutConfig.onTaxError?.(err);
|
|
1886
1939
|
}
|
|
1887
1940
|
};
|
|
@@ -1889,6 +1942,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1889
1942
|
if (this.taxRecalcDebounce) {
|
|
1890
1943
|
clearTimeout(this.taxRecalcDebounce);
|
|
1891
1944
|
}
|
|
1945
|
+
this.emit(EVENTS.TAX_PENDING);
|
|
1892
1946
|
this.taxRecalcDebounce = setTimeout(this.runTaxRecalc, TAX_RECALC_DEBOUNCE_MS);
|
|
1893
1947
|
};
|
|
1894
1948
|
// Flush a pending recalc so a card charge reflects the final entered address (no estimate drift).
|
|
@@ -1905,6 +1959,11 @@ class CheckoutInstance extends EventEmitter {
|
|
|
1905
1959
|
this.handleMethodRender = (method) => {
|
|
1906
1960
|
this.emit(EVENTS.METHOD_RENDER, method);
|
|
1907
1961
|
};
|
|
1962
|
+
this.handleTaxMethodRender = (method) => {
|
|
1963
|
+
if (method === exports.PaymentMethod.PAYMENT_CARD && this.isTaxEnabled()) {
|
|
1964
|
+
this.renderTaxToSkin();
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1908
1967
|
this.handleMethodRenderError = (method) => {
|
|
1909
1968
|
this.emit(EVENTS.METHOD_RENDER_ERROR, method);
|
|
1910
1969
|
};
|
|
@@ -2072,7 +2131,7 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2072
2131
|
integration: 'primer',
|
|
2073
2132
|
});
|
|
2074
2133
|
const sessionResponse = response;
|
|
2075
|
-
if (response.data?.stripe_public_key) {
|
|
2134
|
+
if (response.data?.stripe_public_key && !sessionResponse.radarSessionId) {
|
|
2076
2135
|
const stripePublicKey = response.data.stripe_public_key;
|
|
2077
2136
|
sessionResponse.radarSessionId = loadStripe(stripePublicKey)
|
|
2078
2137
|
.then(stripe => stripe
|
|
@@ -2083,7 +2142,8 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2083
2142
|
: '')
|
|
2084
2143
|
.catch(() => '');
|
|
2085
2144
|
}
|
|
2086
|
-
if (response.data?.airwallex_risk_enabled
|
|
2145
|
+
if (response.data?.airwallex_risk_enabled &&
|
|
2146
|
+
!sessionResponse.airwallexDeviceId) {
|
|
2087
2147
|
const isLivemode = response.data?.is_livemode;
|
|
2088
2148
|
const deviceId = generateUUID();
|
|
2089
2149
|
sessionResponse.airwallexDeviceId = loadAirwallexDeviceFingerprint(deviceId, isLivemode)
|
|
@@ -2476,6 +2536,13 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2476
2536
|
const skin = await skinFactory(this.checkoutConfig, this.cardSessionFieldConfig);
|
|
2477
2537
|
this.on(EVENTS.INPUT_ERROR, skin.onInputError);
|
|
2478
2538
|
this.on(EVENTS.STATUS_CHANGE, skin.onStatusChange);
|
|
2539
|
+
if (skin.onTaxChange) {
|
|
2540
|
+
this.on(EVENTS.TAX_CHANGE, skin.onTaxChange);
|
|
2541
|
+
}
|
|
2542
|
+
if (skin.onTaxPending) {
|
|
2543
|
+
this.on(EVENTS.TAX_PENDING, skin.onTaxPending);
|
|
2544
|
+
}
|
|
2545
|
+
this.on(EVENTS.METHOD_RENDER, this.handleTaxMethodRender);
|
|
2479
2546
|
this.on(EVENTS.ERROR, (error) => skin.onError(error));
|
|
2480
2547
|
this.on(EVENTS.LOADER_CHANGE, skin.onLoaderChange);
|
|
2481
2548
|
this.on(EVENTS.DESTROY, skin.onDestroy);
|
|
@@ -2493,6 +2560,13 @@ class CheckoutInstance extends EventEmitter {
|
|
|
2493
2560
|
skin.init();
|
|
2494
2561
|
this.on(EVENTS.INPUT_ERROR, skin.onInputError);
|
|
2495
2562
|
this.on(EVENTS.METHOD_RENDER, skin.onMethodRender);
|
|
2563
|
+
if (skin.onTaxChange) {
|
|
2564
|
+
this.on(EVENTS.TAX_CHANGE, skin.onTaxChange);
|
|
2565
|
+
}
|
|
2566
|
+
if (skin.onTaxPending) {
|
|
2567
|
+
this.on(EVENTS.TAX_PENDING, skin.onTaxPending);
|
|
2568
|
+
}
|
|
2569
|
+
this.on(EVENTS.METHOD_RENDER, this.handleTaxMethodRender);
|
|
2496
2570
|
this.on(EVENTS.SUCCESS, skin.onDestroy);
|
|
2497
2571
|
this.on(EVENTS.DESTROY, skin.onDestroy);
|
|
2498
2572
|
return skin.getCheckoutOptions();
|
|
@@ -2787,120 +2861,59 @@ async function getAvailablePaymentMethods(params) {
|
|
|
2787
2861
|
}
|
|
2788
2862
|
async function createStripeCardForm(element, params) {
|
|
2789
2863
|
const config = resolveConfig(params, 'createStripeCardForm');
|
|
2864
|
+
const sessionParams = {
|
|
2865
|
+
orgId: config.orgId,
|
|
2866
|
+
baseUrl: config.baseUrl,
|
|
2867
|
+
region: config.region,
|
|
2868
|
+
priceId: params.priceId,
|
|
2869
|
+
externalId: params.externalId,
|
|
2870
|
+
email: params.email,
|
|
2871
|
+
clientMetadata: params.clientMetadata,
|
|
2872
|
+
countryCode: params.countryCode,
|
|
2873
|
+
integration: 'stripe',
|
|
2874
|
+
};
|
|
2790
2875
|
const [session, { mountStripeCardForm }] = await Promise.all([
|
|
2791
|
-
sessionService.createSession(
|
|
2792
|
-
orgId: config.orgId,
|
|
2793
|
-
baseUrl: config.baseUrl,
|
|
2794
|
-
region: config.region,
|
|
2795
|
-
priceId: params.priceId,
|
|
2796
|
-
externalId: params.externalId,
|
|
2797
|
-
email: params.email,
|
|
2798
|
-
clientMetadata: params.clientMetadata,
|
|
2799
|
-
countryCode: params.countryCode,
|
|
2800
|
-
integration: 'stripe',
|
|
2801
|
-
}),
|
|
2876
|
+
sessionService.createSession(sessionParams),
|
|
2802
2877
|
Promise.resolve().then(function () { return require('./chunk-stripe-card-form.cjs.js'); }),
|
|
2803
2878
|
]);
|
|
2804
2879
|
const apiClient = new APIClient({
|
|
2805
2880
|
orgId: config.orgId,
|
|
2806
2881
|
baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
|
|
2807
2882
|
});
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
sessionService.createSession({
|
|
2814
|
-
orgId: config.orgId,
|
|
2815
|
-
baseUrl: config.baseUrl,
|
|
2816
|
-
region: config.region,
|
|
2817
|
-
priceId: params.priceId,
|
|
2818
|
-
externalId: params.externalId,
|
|
2819
|
-
email: params.email,
|
|
2820
|
-
clientMetadata: params.clientMetadata,
|
|
2821
|
-
countryCode: params.countryCode,
|
|
2822
|
-
integration: 'adyen',
|
|
2823
|
-
}),
|
|
2824
|
-
Promise.resolve().then(function () { return require('./chunk-adyen-card-form.cjs.js'); }),
|
|
2825
|
-
]);
|
|
2826
|
-
const apiClient = new APIClient({
|
|
2827
|
-
orgId: config.orgId,
|
|
2828
|
-
baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
|
|
2829
|
-
});
|
|
2830
|
-
return mountAdyenCardForm(element, session, { ...params, apiClient });
|
|
2831
|
-
}
|
|
2832
|
-
async function purchaseAdyenWallet(params) {
|
|
2833
|
-
const config = resolveConfig(params, 'purchaseAdyenWallet');
|
|
2834
|
-
const [session, { purchaseWallet }] = await Promise.all([
|
|
2835
|
-
sessionService.createSession({
|
|
2836
|
-
orgId: config.orgId,
|
|
2837
|
-
baseUrl: config.baseUrl,
|
|
2838
|
-
region: config.region,
|
|
2839
|
-
priceId: params.priceId,
|
|
2840
|
-
externalId: params.externalId,
|
|
2841
|
-
email: params.email,
|
|
2842
|
-
clientMetadata: params.clientMetadata,
|
|
2843
|
-
countryCode: params.countryCode,
|
|
2844
|
-
integration: 'adyen',
|
|
2845
|
-
}),
|
|
2846
|
-
Promise.resolve().then(function () { return require('./chunk-adyen-wallet.cjs.js'); }),
|
|
2847
|
-
]);
|
|
2848
|
-
const apiClient = new APIClient({
|
|
2849
|
-
orgId: config.orgId,
|
|
2850
|
-
baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
|
|
2883
|
+
apiClient.processSessionResponse(session);
|
|
2884
|
+
return mountStripeCardForm(element, session, {
|
|
2885
|
+
...params,
|
|
2886
|
+
apiClient,
|
|
2887
|
+
invalidateSession: () => sessionService.invalidate(sessionParams),
|
|
2851
2888
|
});
|
|
2852
|
-
return purchaseWallet(session, { ...params, apiClient });
|
|
2853
|
-
}
|
|
2854
|
-
async function getAvailableAdyenWallet(params) {
|
|
2855
|
-
const config = resolveConfig(params, 'getAvailableAdyenWallet');
|
|
2856
|
-
const [session, { getAvailableWallet }] = await Promise.all([
|
|
2857
|
-
sessionService.createSession({
|
|
2858
|
-
orgId: config.orgId,
|
|
2859
|
-
baseUrl: config.baseUrl,
|
|
2860
|
-
region: config.region,
|
|
2861
|
-
priceId: params.priceId,
|
|
2862
|
-
externalId: params.externalId,
|
|
2863
|
-
email: params.email,
|
|
2864
|
-
clientMetadata: params.clientMetadata,
|
|
2865
|
-
countryCode: params.countryCode,
|
|
2866
|
-
integration: 'adyen',
|
|
2867
|
-
}),
|
|
2868
|
-
Promise.resolve().then(function () { return require('./chunk-adyen-wallet.cjs.js'); }),
|
|
2869
|
-
]);
|
|
2870
|
-
const result = await getAvailableWallet(session);
|
|
2871
|
-
if (result === 'APPLE_PAY')
|
|
2872
|
-
return exports.PaymentMethod.APPLE_PAY;
|
|
2873
|
-
if (result === 'GOOGLE_PAY')
|
|
2874
|
-
return exports.PaymentMethod.GOOGLE_PAY;
|
|
2875
|
-
return null;
|
|
2876
|
-
}
|
|
2877
|
-
async function getAvailableAdyenPaymentMethods(params) {
|
|
2878
|
-
const wallet = await getAvailableAdyenWallet(params);
|
|
2879
|
-
return wallet
|
|
2880
|
-
? [exports.PaymentMethod.PAYMENT_CARD, wallet]
|
|
2881
|
-
: [exports.PaymentMethod.PAYMENT_CARD];
|
|
2882
2889
|
}
|
|
2883
2890
|
async function purchaseStripeWallet(params) {
|
|
2884
2891
|
const config = resolveConfig(params, 'purchaseStripeWallet');
|
|
2892
|
+
const sessionParams = {
|
|
2893
|
+
orgId: config.orgId,
|
|
2894
|
+
baseUrl: config.baseUrl,
|
|
2895
|
+
region: config.region,
|
|
2896
|
+
priceId: params.priceId,
|
|
2897
|
+
externalId: params.externalId,
|
|
2898
|
+
email: params.email,
|
|
2899
|
+
clientMetadata: params.clientMetadata,
|
|
2900
|
+
countryCode: params.countryCode,
|
|
2901
|
+
integration: 'stripe',
|
|
2902
|
+
};
|
|
2885
2903
|
const [session, { purchaseWallet }] = await Promise.all([
|
|
2886
|
-
sessionService.createSession(
|
|
2887
|
-
orgId: config.orgId,
|
|
2888
|
-
baseUrl: config.baseUrl,
|
|
2889
|
-
region: config.region,
|
|
2890
|
-
priceId: params.priceId,
|
|
2891
|
-
externalId: params.externalId,
|
|
2892
|
-
email: params.email,
|
|
2893
|
-
clientMetadata: params.clientMetadata,
|
|
2894
|
-
countryCode: params.countryCode,
|
|
2895
|
-
integration: 'stripe',
|
|
2896
|
-
}),
|
|
2904
|
+
sessionService.createSession(sessionParams),
|
|
2897
2905
|
Promise.resolve().then(function () { return require('./chunk-stripe-wallet.cjs.js'); }),
|
|
2898
2906
|
]);
|
|
2899
2907
|
const apiClient = new APIClient({
|
|
2900
2908
|
orgId: config.orgId,
|
|
2901
2909
|
baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
|
|
2902
2910
|
});
|
|
2903
|
-
|
|
2911
|
+
apiClient.processSessionResponse(session);
|
|
2912
|
+
return purchaseWallet(session, {
|
|
2913
|
+
...params,
|
|
2914
|
+
apiClient,
|
|
2915
|
+
invalidateSession: () => sessionService.invalidate(sessionParams),
|
|
2916
|
+
});
|
|
2904
2917
|
}
|
|
2905
2918
|
async function getAvailableStripeWallet(params) {
|
|
2906
2919
|
const config = resolveConfig(params, 'getAvailableStripeWallet');
|
|
@@ -2918,6 +2931,11 @@ async function getAvailableStripeWallet(params) {
|
|
|
2918
2931
|
}),
|
|
2919
2932
|
Promise.resolve().then(function () { return require('./chunk-stripe-wallet.cjs.js'); }),
|
|
2920
2933
|
]);
|
|
2934
|
+
const apiClient = new APIClient({
|
|
2935
|
+
orgId: config.orgId,
|
|
2936
|
+
baseUrl: config.baseUrl || DEFAULTS.BASE_URL,
|
|
2937
|
+
});
|
|
2938
|
+
apiClient.processSessionResponse(session);
|
|
2921
2939
|
const result = await getAvailableWallet(session);
|
|
2922
2940
|
if (result === 'APPLE_PAY')
|
|
2923
2941
|
return exports.PaymentMethod.APPLE_PAY;
|
|
@@ -2948,16 +2966,11 @@ const Billing = {
|
|
|
2948
2966
|
getAvailableWallet: getAvailableStripeWallet,
|
|
2949
2967
|
getAvailablePaymentMethods: getAvailableStripePaymentMethods,
|
|
2950
2968
|
},
|
|
2951
|
-
adyen: {
|
|
2952
|
-
createCardForm: createAdyenCardForm,
|
|
2953
|
-
purchaseWallet: purchaseAdyenWallet,
|
|
2954
|
-
getAvailableWallet: getAvailableAdyenWallet,
|
|
2955
|
-
getAvailablePaymentMethods: getAvailableAdyenPaymentMethods,
|
|
2956
|
-
},
|
|
2957
2969
|
};
|
|
2958
2970
|
if (typeof window !== 'undefined') {
|
|
2959
2971
|
window.Billing = Billing;
|
|
2960
2972
|
}
|
|
2973
|
+
console.debug('Billing SDK inited');
|
|
2961
2974
|
|
|
2962
2975
|
exports.APIError = APIError;
|
|
2963
2976
|
exports.Billing = Billing;
|
|
@@ -2976,7 +2989,6 @@ exports.ValidationError = ValidationError;
|
|
|
2976
2989
|
exports.configure = configure;
|
|
2977
2990
|
exports.createCheckout = createCheckout;
|
|
2978
2991
|
exports.createClientSession = createClientSession;
|
|
2992
|
+
exports.formatCurrencyAmount = formatCurrencyAmount;
|
|
2979
2993
|
exports.getAvailablePaymentMethods = getAvailablePaymentMethods;
|
|
2980
|
-
exports.loadScript = loadScript$1;
|
|
2981
2994
|
exports.loadStripe = loadStripe;
|
|
2982
|
-
exports.loadStylesheet = loadStylesheet;
|
package/dist/chunk-index.cjs2.js
CHANGED
|
@@ -83,6 +83,12 @@ class DefaultSkin {
|
|
|
83
83
|
this.onInputError = (event) => {
|
|
84
84
|
this.cardInstance.onInputError(event);
|
|
85
85
|
};
|
|
86
|
+
this.onTaxChange = (info) => {
|
|
87
|
+
this.cardInstance.onTaxChange(info);
|
|
88
|
+
};
|
|
89
|
+
this.onTaxPending = () => {
|
|
90
|
+
this.cardInstance.onTaxPending();
|
|
91
|
+
};
|
|
86
92
|
this.onMethodRender = (paymentMethod) => {
|
|
87
93
|
const methodKey = paymentMethod.replace('_', '-').toLowerCase();
|
|
88
94
|
const methodContainer = this.containerEl.querySelector(`.ff-payment-method-${methodKey}`);
|
package/dist/chunk-index.cjs3.js
CHANGED
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
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";
|
|
10
|
+
var index = require('./chunk-index.cjs.js');
|
|
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: flex;\n flex-direction: row;\n gap: 10px;\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: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 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 }";
|
|
12
|
+
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<div id=\"ffTaxSummary\" class=\"ff-tax-summary\" hidden>\n <div class=\"ff-tax-row\">\n <span>Subtotal</span>\n <span id=\"ffTaxSubtotal\"></span>\n </div>\n <div class=\"ff-tax-row\">\n <span>Tax</span>\n <span id=\"ffTaxAmount\"></span>\n </div>\n <div class=\"ff-tax-row ff-tax-total\">\n <span>Total</span>\n <span id=\"ffTaxTotal\"></span>\n </div>\n</div>\n";
|
|
13
|
+
|
|
14
|
+
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: flex;\n flex-direction: row;\n gap: 10px;\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: #d10000;\n font-size: 16px;\n line-height: 1;\n margin: 0 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\n.ff-tax-summary {\n margin-top: 12px;\n padding-top: 12px;\n border-top: 1px solid rgb(0 0 0 / 10%);\n font-size: 16px;\n transition: opacity 0.2s ease;\n}\n\n.ff-tax-summary[hidden] {\n display: none;\n}\n\n.ff-tax-summary--updating {\n opacity: 0.55;\n}\n\n.ff-tax-row {\n display: flex;\n justify-content: space-between;\n gap: 10px;\n margin-bottom: 6px;\n}\n\n.ff-tax-row.ff-tax-total {\n margin-top: 8px;\n margin-bottom: 0;\n font-weight: 600;\n}";
|
|
13
15
|
|
|
14
16
|
class CardSkin {
|
|
15
17
|
constructor(containerEl, checkoutConfig, cardSessionFieldConfig) {
|
|
@@ -44,6 +46,39 @@ class CardSkin {
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
};
|
|
49
|
+
this.onTaxChange = (info) => {
|
|
50
|
+
const summary = this.containerEl.querySelector('#ffTaxSummary');
|
|
51
|
+
if (!summary) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// taxAmount is the tax added on top of the price; it is 0 for tax-inclusive pricing and for
|
|
55
|
+
// non-taxed locations — in both cases there is nothing to itemise, so the summary stays hidden.
|
|
56
|
+
if (!(info.taxAmount > 0)) {
|
|
57
|
+
summary.hidden = true;
|
|
58
|
+
summary.classList.remove('ff-tax-summary--updating');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const subtotal = this.containerEl.querySelector('#ffTaxSubtotal');
|
|
62
|
+
const tax = this.containerEl.querySelector('#ffTaxAmount');
|
|
63
|
+
const total = this.containerEl.querySelector('#ffTaxTotal');
|
|
64
|
+
if (subtotal) {
|
|
65
|
+
subtotal.textContent = index.formatCurrencyAmount(info.amountTotal - info.taxAmount, info.currency);
|
|
66
|
+
}
|
|
67
|
+
if (tax) {
|
|
68
|
+
tax.textContent = index.formatCurrencyAmount(info.taxAmount, info.currency);
|
|
69
|
+
}
|
|
70
|
+
if (total) {
|
|
71
|
+
total.textContent = index.formatCurrencyAmount(info.amountTotal, info.currency);
|
|
72
|
+
}
|
|
73
|
+
summary.hidden = false;
|
|
74
|
+
summary.classList.remove('ff-tax-summary--updating');
|
|
75
|
+
};
|
|
76
|
+
this.onTaxPending = () => {
|
|
77
|
+
const summary = this.containerEl.querySelector('#ffTaxSummary');
|
|
78
|
+
if (summary && !summary.hidden) {
|
|
79
|
+
summary.classList.add('ff-tax-summary--updating');
|
|
80
|
+
}
|
|
81
|
+
};
|
|
47
82
|
this.onMethodRender = () => {
|
|
48
83
|
this.containerEl.style.display = 'block';
|
|
49
84
|
};
|