@flopay/shared 1.4.3 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -2750
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -2613
- package/package.json +1 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2750 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
|
|
26
|
-
mod2
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var index_exports = {};
|
|
32
|
-
__export(index_exports, {
|
|
33
|
-
BILLING_API_URL: () => BILLING_API_URL,
|
|
34
|
-
BILLING_API_URL_PRODUCTION: () => BILLING_API_URL_PRODUCTION,
|
|
35
|
-
BILLING_API_URL_STAGING: () => BILLING_API_URL_STAGING,
|
|
36
|
-
BOLD_DARK_APPEARANCE: () => BOLD_DARK_APPEARANCE,
|
|
37
|
-
BOLD_LIGHT_APPEARANCE: () => BOLD_LIGHT_APPEARANCE,
|
|
38
|
-
BUTTONS_LAYOUT_BOLD_DARK: () => BUTTONS_LAYOUT_BOLD_DARK,
|
|
39
|
-
BUTTONS_LAYOUT_BOLD_LIGHT: () => BUTTONS_LAYOUT_BOLD_LIGHT,
|
|
40
|
-
BUTTONS_LAYOUT_DARK: () => BUTTONS_LAYOUT_DARK,
|
|
41
|
-
BUTTONS_LAYOUT_DEFAULT: () => BUTTONS_LAYOUT_DEFAULT,
|
|
42
|
-
BUTTONS_LAYOUT_GLASS_DARK: () => BUTTONS_LAYOUT_GLASS_DARK,
|
|
43
|
-
BUTTONS_LAYOUT_GLASS_LIGHT: () => BUTTONS_LAYOUT_GLASS_LIGHT,
|
|
44
|
-
BUTTONS_LAYOUT_MINIMAL: () => BUTTONS_LAYOUT_MINIMAL,
|
|
45
|
-
BUTTONS_LAYOUT_MODERN_DARK: () => BUTTONS_LAYOUT_MODERN_DARK,
|
|
46
|
-
BUTTONS_LAYOUT_MODERN_LIGHT: () => BUTTONS_LAYOUT_MODERN_LIGHT,
|
|
47
|
-
BUTTONS_LAYOUT_ROUNDED: () => BUTTONS_LAYOUT_ROUNDED,
|
|
48
|
-
CA_PROVINCES: () => CA_PROVINCES,
|
|
49
|
-
COUNTRY_OPTIONS: () => COUNTRY_OPTIONS,
|
|
50
|
-
CURRENCY_MAP: () => CURRENCY_MAP,
|
|
51
|
-
DEFAULT_API_BASE_URL: () => DEFAULT_API_BASE_URL,
|
|
52
|
-
DEFAULT_API_VERSION: () => DEFAULT_API_VERSION,
|
|
53
|
-
DEFAULT_APPEARANCE: () => DEFAULT_APPEARANCE,
|
|
54
|
-
DEFAULT_CURRENCY: () => DEFAULT_CURRENCY,
|
|
55
|
-
ELEMENT_TYPES: () => ELEMENT_TYPES,
|
|
56
|
-
FLAT_APPEARANCE: () => FLAT_APPEARANCE,
|
|
57
|
-
FLO_SDK_VERSION_HEADER: () => FLO_SDK_VERSION_HEADER,
|
|
58
|
-
FloPayError: () => FloPayError,
|
|
59
|
-
GLASS_DARK_APPEARANCE: () => GLASS_DARK_APPEARANCE,
|
|
60
|
-
GLASS_LIGHT_APPEARANCE: () => GLASS_LIGHT_APPEARANCE,
|
|
61
|
-
IDEMPOTENCY_IN_PROGRESS_CODE: () => IDEMPOTENCY_IN_PROGRESS_CODE,
|
|
62
|
-
IDEMPOTENCY_KEY_HEADER: () => IDEMPOTENCY_KEY_HEADER,
|
|
63
|
-
MAX_IDEMPOTENCY_KEY_LENGTH: () => MAX_IDEMPOTENCY_KEY_LENGTH,
|
|
64
|
-
MODERN_DARK_APPEARANCE: () => MODERN_DARK_APPEARANCE,
|
|
65
|
-
MODERN_LIGHT_APPEARANCE: () => MODERN_LIGHT_APPEARANCE,
|
|
66
|
-
NIGHT_APPEARANCE: () => NIGHT_APPEARANCE,
|
|
67
|
-
SDK_VERSION: () => SDK_VERSION2,
|
|
68
|
-
STRIPE_EXPRESS_METHODS: () => STRIPE_EXPRESS_METHODS,
|
|
69
|
-
STRIPE_METHOD_AMOUNT_LIMITS: () => STRIPE_METHOD_AMOUNT_LIMITS,
|
|
70
|
-
STRIPE_METHOD_COUNTRIES: () => STRIPE_METHOD_COUNTRIES,
|
|
71
|
-
STRIPE_METHOD_CURRENCIES: () => STRIPE_METHOD_CURRENCIES,
|
|
72
|
-
STRIPE_METHOD_MATRIX: () => STRIPE_METHOD_MATRIX,
|
|
73
|
-
SUPPORTED_CARD_BRANDS: () => SUPPORTED_CARD_BRANDS,
|
|
74
|
-
TELEMETRY_ERROR_CODES: () => TELEMETRY_ERROR_CODES,
|
|
75
|
-
TELEMETRY_LOG_NAMES: () => TELEMETRY_LOG_NAMES,
|
|
76
|
-
TELEMETRY_MAX_BATCH_BYTES: () => TELEMETRY_MAX_BATCH_BYTES,
|
|
77
|
-
TELEMETRY_MAX_BATCH_EVENTS: () => TELEMETRY_MAX_BATCH_EVENTS,
|
|
78
|
-
TELEMETRY_SCHEMA_VERSION: () => TELEMETRY_SCHEMA_VERSION,
|
|
79
|
-
TELEMETRY_SDK_PACKAGES: () => TELEMETRY_SDK_PACKAGES,
|
|
80
|
-
THEMES: () => THEMES,
|
|
81
|
-
US_STATES: () => US_STATES,
|
|
82
|
-
UUID_V4: () => UUID_V42,
|
|
83
|
-
apiError: () => apiError,
|
|
84
|
-
authenticationError: () => authenticationError,
|
|
85
|
-
buildCheckoutDisplayData: () => buildCheckoutDisplayData,
|
|
86
|
-
buildItemPayload: () => buildItemPayload,
|
|
87
|
-
buildProductPayload: () => buildProductPayload,
|
|
88
|
-
buildSubscriptionPayload: () => buildSubscriptionPayload,
|
|
89
|
-
buildTelemetryErrorEvent: () => buildTelemetryErrorEvent,
|
|
90
|
-
buildTelemetryLogEvent: () => buildTelemetryLogEvent,
|
|
91
|
-
buildTelemetryPerformanceEvent: () => buildTelemetryPerformanceEvent,
|
|
92
|
-
buildTelemetryTerminalEvent: () => buildTelemetryTerminalEvent,
|
|
93
|
-
configureFlopay: () => configureFlopay,
|
|
94
|
-
filterStripeMethodsByAmount: () => filterStripeMethodsByAmount,
|
|
95
|
-
filterStripeMethodsByCountry: () => filterStripeMethodsByCountry,
|
|
96
|
-
filterStripeMethodsByCurrency: () => filterStripeMethodsByCurrency,
|
|
97
|
-
foldIntoProducts: () => foldIntoProducts,
|
|
98
|
-
generateIdempotencyKey: () => generateIdempotencyKey,
|
|
99
|
-
getConfiguredBillingApiUrl: () => getConfiguredBillingApiUrl,
|
|
100
|
-
getCountryByCode: () => getCountryByCode,
|
|
101
|
-
getCurrencyByCountry: () => getCurrencyByCountry,
|
|
102
|
-
getFloPayEnvironment: () => getFloPayEnvironment,
|
|
103
|
-
getPostalCodeExample: () => getPostalCodeExample,
|
|
104
|
-
getPostalCodeLabel: () => getPostalCodeLabel,
|
|
105
|
-
getStateFromPostalCode: () => getStateFromPostalCode,
|
|
106
|
-
getStateLabel: () => getStateLabel,
|
|
107
|
-
getStateOptions: () => getStateOptions,
|
|
108
|
-
getStripeMethodDisplayName: () => getStripeMethodDisplayName,
|
|
109
|
-
hasVendoredStripeMethodLogo: () => hasVendoredStripeMethodLogo,
|
|
110
|
-
isAVSEnabled: () => isAVSEnabled,
|
|
111
|
-
isAVSFieldVisible: () => isAVSFieldVisible,
|
|
112
|
-
isPostalCodeSupported: () => isPostalCodeSupported,
|
|
113
|
-
isSetupIntentClientSecret: () => isSetupIntentClientSecret,
|
|
114
|
-
isUuidV4: () => isUuidV4,
|
|
115
|
-
isValidPostalCode: () => isValidPostalCode,
|
|
116
|
-
isValidPublishableKey: () => isValidPublishableKey,
|
|
117
|
-
isValidSecretKey: () => isValidSecretKey,
|
|
118
|
-
needsStripeMethodExplicitConfirm: () => needsStripeMethodExplicitConfirm,
|
|
119
|
-
networkError: () => networkError,
|
|
120
|
-
normalizeGatewayEnvironment: () => normalizeGatewayEnvironment,
|
|
121
|
-
partitionStripeMethods: () => partitionStripeMethods,
|
|
122
|
-
randomUuidV4: () => randomUuidV4,
|
|
123
|
-
rateLimitError: () => rateLimitError,
|
|
124
|
-
resolveAVSConfig: () => resolveAVSConfig,
|
|
125
|
-
resolveBillingApiUrl: () => resolveBillingApiUrl,
|
|
126
|
-
resolveButtonsLayoutTheme: () => resolveButtonsLayoutTheme,
|
|
127
|
-
resolveIdempotencyKey: () => resolveIdempotencyKey,
|
|
128
|
-
resolveSessionCurrency: () => resolveSessionCurrency,
|
|
129
|
-
resolveStripeMethodBrandVariant: () => resolveStripeMethodBrandVariant,
|
|
130
|
-
resolveTheme: () => resolveTheme,
|
|
131
|
-
serializeTelemetryBatch: () => serializeTelemetryBatch,
|
|
132
|
-
stripeExpressMethodToOptionKey: () => stripeExpressMethodToOptionKey,
|
|
133
|
-
validationError: () => validationError
|
|
134
|
-
});
|
|
135
|
-
module.exports = __toCommonJS(index_exports);
|
|
136
|
-
|
|
137
|
-
// src/types.ts
|
|
138
|
-
function normalizeGatewayEnvironment(env) {
|
|
139
|
-
if (env == null) return void 0;
|
|
140
|
-
switch (env) {
|
|
141
|
-
case "sandbox":
|
|
142
|
-
case "stage":
|
|
143
|
-
return "sandbox";
|
|
144
|
-
case "live":
|
|
145
|
-
case "production":
|
|
146
|
-
return "live";
|
|
147
|
-
default:
|
|
148
|
-
console.warn(
|
|
149
|
-
`[FloPay] Unrecognized gateway environment "${env}". Expected one of: sandbox, live, stage, production. Falling back to undefined.`
|
|
150
|
-
);
|
|
151
|
-
return void 0;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// src/errors.ts
|
|
156
|
-
var FloPayError = class extends Error {
|
|
157
|
-
constructor(message, type, options) {
|
|
158
|
-
super(message);
|
|
159
|
-
this.name = "FloPayError";
|
|
160
|
-
this.type = type;
|
|
161
|
-
this.code = options?.code;
|
|
162
|
-
this.declineCode = options?.declineCode;
|
|
163
|
-
this.param = options?.param;
|
|
164
|
-
this.statusCode = options?.statusCode;
|
|
165
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
function validationError(message, param) {
|
|
169
|
-
return new FloPayError(message, "validation_error", { param });
|
|
170
|
-
}
|
|
171
|
-
function apiError(message, code, statusCode) {
|
|
172
|
-
return new FloPayError(message, "api_error", { code, statusCode });
|
|
173
|
-
}
|
|
174
|
-
function authenticationError(message) {
|
|
175
|
-
return new FloPayError(message, "authentication_error");
|
|
176
|
-
}
|
|
177
|
-
function rateLimitError(message) {
|
|
178
|
-
return new FloPayError(message, "rate_limit_error");
|
|
179
|
-
}
|
|
180
|
-
function networkError(message) {
|
|
181
|
-
return new FloPayError(message, "network_error");
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// src/telemetry.ts
|
|
185
|
-
var TELEMETRY_SCHEMA_VERSION = 1;
|
|
186
|
-
var TELEMETRY_SDK_PACKAGES = [
|
|
187
|
-
"@flopay/shared",
|
|
188
|
-
"@flopay/js",
|
|
189
|
-
"@flopay/react"
|
|
190
|
-
];
|
|
191
|
-
var TELEMETRY_MAX_BATCH_BYTES = 32 * 1024;
|
|
192
|
-
var TELEMETRY_MAX_BATCH_EVENTS = 20;
|
|
193
|
-
var TELEMETRY_PROVIDERS = ["stripe", "paypal"];
|
|
194
|
-
var TELEMETRY_PAYMENT_METHOD_CATEGORIES = [
|
|
195
|
-
"card",
|
|
196
|
-
"wallet",
|
|
197
|
-
"paypal",
|
|
198
|
-
"apm",
|
|
199
|
-
"saved",
|
|
200
|
-
"unknown"
|
|
201
|
-
];
|
|
202
|
-
var TELEMETRY_STAGES = [
|
|
203
|
-
"callback",
|
|
204
|
-
"sdk_initialize",
|
|
205
|
-
"checkout_mount",
|
|
206
|
-
"session_create",
|
|
207
|
-
"session_read",
|
|
208
|
-
"session_first_byte",
|
|
209
|
-
"session_complete",
|
|
210
|
-
"checkout_data_ready",
|
|
211
|
-
"checkout_render",
|
|
212
|
-
"checkout_interactive",
|
|
213
|
-
"provider_load",
|
|
214
|
-
"provider_ready",
|
|
215
|
-
"overlay_open",
|
|
216
|
-
"overlay_return",
|
|
217
|
-
"redirect",
|
|
218
|
-
"redirect_resume",
|
|
219
|
-
"vault_request",
|
|
220
|
-
"vault_mount",
|
|
221
|
-
"vault_ready",
|
|
222
|
-
"vault_submit",
|
|
223
|
-
"tokenization",
|
|
224
|
-
"three_ds_handoff",
|
|
225
|
-
"three_ds_return",
|
|
226
|
-
"processing",
|
|
227
|
-
"recovery",
|
|
228
|
-
"completion",
|
|
229
|
-
"unmount",
|
|
230
|
-
"total_journey"
|
|
231
|
-
];
|
|
232
|
-
var TELEMETRY_ERROR_CODES = [
|
|
233
|
-
"CALLBACK_FAILED",
|
|
234
|
-
"CHECKOUT_SESSION_CREATE_FAILED",
|
|
235
|
-
"CONFIGURATION_INVALID",
|
|
236
|
-
"INTERNAL_SDK_ERROR",
|
|
237
|
-
"NETWORK_REQUEST_FAILED",
|
|
238
|
-
"PAYMENT_PROCESSING_FAILED",
|
|
239
|
-
"POPUP_BLOCKED",
|
|
240
|
-
"PROVIDER_LOAD_FAILED",
|
|
241
|
-
"PROVIDER_RUNTIME_FAILED",
|
|
242
|
-
"RECOVERY_FAILED",
|
|
243
|
-
"REDIRECT_RESUME_FAILED",
|
|
244
|
-
"REQUEST_TIMEOUT",
|
|
245
|
-
"SDK_INITIALIZATION_FAILED",
|
|
246
|
-
"THREE_DS_FAILED",
|
|
247
|
-
"TOKENIZATION_FAILED",
|
|
248
|
-
"VAULT_LOAD_FAILED",
|
|
249
|
-
"VAULT_SUBMIT_FAILED"
|
|
250
|
-
];
|
|
251
|
-
var TELEMETRY_LOG_NAMES = [
|
|
252
|
-
"sdk.initialize.started",
|
|
253
|
-
"sdk.initialize.ready",
|
|
254
|
-
"sdk.cache.hit",
|
|
255
|
-
"sdk.cache.miss",
|
|
256
|
-
"checkout.mount",
|
|
257
|
-
"session.create.started",
|
|
258
|
-
"session.read.started",
|
|
259
|
-
"session.request.first_byte",
|
|
260
|
-
"session.request.completed",
|
|
261
|
-
"checkout.data.ready",
|
|
262
|
-
"checkout.rendered",
|
|
263
|
-
"checkout.interactive",
|
|
264
|
-
"checkout.recovery.started",
|
|
265
|
-
"checkout.recovery.completed",
|
|
266
|
-
"checkout.unmount",
|
|
267
|
-
"provider.load.started",
|
|
268
|
-
"provider.eligibility.checked",
|
|
269
|
-
"provider.availability.checked",
|
|
270
|
-
"provider.ready",
|
|
271
|
-
"provider.popup.opened",
|
|
272
|
-
"provider.overlay.opened",
|
|
273
|
-
"provider.overlay.returned",
|
|
274
|
-
"provider.redirect.started",
|
|
275
|
-
"provider.redirect.resumed",
|
|
276
|
-
"vault.capture.requested",
|
|
277
|
-
"vault.widget.mounted",
|
|
278
|
-
"vault.widget.ready",
|
|
279
|
-
"vault.submission.started",
|
|
280
|
-
"vault.action.required",
|
|
281
|
-
"vault.three_ds.handoff",
|
|
282
|
-
"vault.three_ds.returned",
|
|
283
|
-
"vault.terminal",
|
|
284
|
-
"payment.method.selected",
|
|
285
|
-
"payment.intent.started",
|
|
286
|
-
"payment.intent.completed",
|
|
287
|
-
"payment.tokenization.started",
|
|
288
|
-
"payment.tokenization.completed",
|
|
289
|
-
"payment.processing.started",
|
|
290
|
-
"payment.processing.completed",
|
|
291
|
-
"payment.three_ds.handoff",
|
|
292
|
-
"payment.three_ds.returned",
|
|
293
|
-
"operation.retry",
|
|
294
|
-
"operation.deduplicated",
|
|
295
|
-
"operation.fallback",
|
|
296
|
-
"operation.cache.hit",
|
|
297
|
-
"operation.cache.miss",
|
|
298
|
-
"operation.recovery.started",
|
|
299
|
-
"operation.recovery.completed",
|
|
300
|
-
"operation.state_transition"
|
|
301
|
-
];
|
|
302
|
-
var TELEMETRY_REQUEST_CATEGORIES = [
|
|
303
|
-
"session_create",
|
|
304
|
-
"session_read",
|
|
305
|
-
"intent_create",
|
|
306
|
-
"process_payment",
|
|
307
|
-
"vault_capture",
|
|
308
|
-
"account_snapshot",
|
|
309
|
-
"provider_sdk",
|
|
310
|
-
"other"
|
|
311
|
-
];
|
|
312
|
-
var TELEMETRY_STATUS_CLASSES = [
|
|
313
|
-
"2xx",
|
|
314
|
-
"3xx",
|
|
315
|
-
"4xx",
|
|
316
|
-
"5xx",
|
|
317
|
-
"network_error",
|
|
318
|
-
"timeout",
|
|
319
|
-
"unknown"
|
|
320
|
-
];
|
|
321
|
-
var TELEMETRY_CHECKOUT_MODES = ["full", "auto", "confirm", "unknown"];
|
|
322
|
-
var TELEMETRY_LAYOUTS = ["embedded", "buttons", "automatic", "unknown"];
|
|
323
|
-
var TELEMETRY_DURATION_MODES = ["machine", "buyer", "total"];
|
|
324
|
-
var TELEMETRY_EXPECTED_OUTCOMES = [
|
|
325
|
-
"action_required",
|
|
326
|
-
"customer_abandoned",
|
|
327
|
-
"payment_cancelled",
|
|
328
|
-
"payment_declined",
|
|
329
|
-
"payment_succeeded",
|
|
330
|
-
"validation_rejected"
|
|
331
|
-
];
|
|
332
|
-
var UUID_V4 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
333
|
-
var SDK_VERSION = /^\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.-]{1,32})?$/;
|
|
334
|
-
var ERROR_CODES = new Set(TELEMETRY_ERROR_CODES);
|
|
335
|
-
var STAGES = new Set(TELEMETRY_STAGES);
|
|
336
|
-
var PROVIDERS = new Set(TELEMETRY_PROVIDERS);
|
|
337
|
-
var PAYMENT_METHODS = new Set(TELEMETRY_PAYMENT_METHOD_CATEGORIES);
|
|
338
|
-
var LOG_NAMES = new Set(TELEMETRY_LOG_NAMES);
|
|
339
|
-
var CHECKOUT_MODES = new Set(TELEMETRY_CHECKOUT_MODES);
|
|
340
|
-
var LAYOUTS = new Set(TELEMETRY_LAYOUTS);
|
|
341
|
-
var REQUEST_CATEGORIES = new Set(TELEMETRY_REQUEST_CATEGORIES);
|
|
342
|
-
var STATUS_CLASSES = new Set(TELEMETRY_STATUS_CLASSES);
|
|
343
|
-
var DURATION_MODES = new Set(TELEMETRY_DURATION_MODES);
|
|
344
|
-
var EXPECTED_OUTCOMES = new Set(TELEMETRY_EXPECTED_OUTCOMES);
|
|
345
|
-
var SDK_PACKAGES = new Set(TELEMETRY_SDK_PACKAGES);
|
|
346
|
-
function enumOr(value, allowed, fallback) {
|
|
347
|
-
return typeof value === "string" && allowed.has(value) ? value : fallback;
|
|
348
|
-
}
|
|
349
|
-
function createUuidV4() {
|
|
350
|
-
try {
|
|
351
|
-
const id = globalThis.crypto.randomUUID();
|
|
352
|
-
if (UUID_V4.test(id)) return id;
|
|
353
|
-
} catch {
|
|
354
|
-
}
|
|
355
|
-
const bytes = new Uint8Array(16);
|
|
356
|
-
try {
|
|
357
|
-
globalThis.crypto.getRandomValues(bytes);
|
|
358
|
-
} catch {
|
|
359
|
-
for (let index = 0; index < bytes.length; index += 1) {
|
|
360
|
-
bytes[index] = Math.floor(Math.random() * 256);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
bytes[6] = bytes[6] & 15 | 64;
|
|
364
|
-
bytes[8] = bytes[8] & 63 | 128;
|
|
365
|
-
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
366
|
-
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
367
|
-
}
|
|
368
|
-
function safeUuid(value) {
|
|
369
|
-
return typeof value === "string" && UUID_V4.test(value) ? value : createUuidV4();
|
|
370
|
-
}
|
|
371
|
-
function safeAttempt(value) {
|
|
372
|
-
return typeof value === "number" && Number.isInteger(value) && value >= 0 && value <= 100 ? value : void 0;
|
|
373
|
-
}
|
|
374
|
-
function safeSequence(value) {
|
|
375
|
-
return Number.isSafeInteger(value) && value >= 0 ? Math.min(value, 1e6) : 0;
|
|
376
|
-
}
|
|
377
|
-
function safeDuration(value) {
|
|
378
|
-
if (!Number.isFinite(value) || value < 0) return 0;
|
|
379
|
-
return Math.min(Math.round(value), 12e4);
|
|
380
|
-
}
|
|
381
|
-
function addCommonFields(event, input) {
|
|
382
|
-
const attempt = safeAttempt(input.attempt);
|
|
383
|
-
if (input.provider && PROVIDERS.has(input.provider)) event.provider = input.provider;
|
|
384
|
-
if (attempt !== void 0) event.attempt = attempt;
|
|
385
|
-
if (input.statusClass) event.statusClass = enumOr(input.statusClass, STATUS_CLASSES, "unknown");
|
|
386
|
-
if (input.requestCategory) {
|
|
387
|
-
event.requestCategory = enumOr(input.requestCategory, REQUEST_CATEGORIES, "other");
|
|
388
|
-
}
|
|
389
|
-
if (input.paymentMethodCategory) {
|
|
390
|
-
event.paymentMethodCategory = enumOr(
|
|
391
|
-
input.paymentMethodCategory,
|
|
392
|
-
PAYMENT_METHODS,
|
|
393
|
-
"unknown"
|
|
394
|
-
);
|
|
395
|
-
}
|
|
396
|
-
if (input.checkoutMode) {
|
|
397
|
-
event.checkoutMode = enumOr(input.checkoutMode, CHECKOUT_MODES, "unknown");
|
|
398
|
-
}
|
|
399
|
-
if (input.layout) event.layout = enumOr(input.layout, LAYOUTS, "unknown");
|
|
400
|
-
return event;
|
|
401
|
-
}
|
|
402
|
-
function buildTelemetryErrorEvent(input) {
|
|
403
|
-
return addCommonFields(
|
|
404
|
-
{
|
|
405
|
-
eventId: safeUuid(input.eventId),
|
|
406
|
-
class: "technical_error",
|
|
407
|
-
code: enumOr(input.errorCode, ERROR_CODES, "INTERNAL_SDK_ERROR"),
|
|
408
|
-
stage: enumOr(input.stage, STAGES, "sdk_initialize"),
|
|
409
|
-
sequence: safeSequence(input.sequence)
|
|
410
|
-
},
|
|
411
|
-
input
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
function buildTelemetryLogEvent(input) {
|
|
415
|
-
return addCommonFields(
|
|
416
|
-
{
|
|
417
|
-
eventId: safeUuid(input.eventId),
|
|
418
|
-
class: "lifecycle",
|
|
419
|
-
name: enumOr(input.name, LOG_NAMES, "operation.retry"),
|
|
420
|
-
stage: enumOr(input.stage, STAGES, "sdk_initialize"),
|
|
421
|
-
sequence: safeSequence(input.sequence)
|
|
422
|
-
},
|
|
423
|
-
input
|
|
424
|
-
);
|
|
425
|
-
}
|
|
426
|
-
function buildTelemetryTerminalEvent(input) {
|
|
427
|
-
const commonInput = {
|
|
428
|
-
...input,
|
|
429
|
-
stage: input.stage ?? "completion"
|
|
430
|
-
};
|
|
431
|
-
return addCommonFields(
|
|
432
|
-
{
|
|
433
|
-
eventId: safeUuid(input.eventId),
|
|
434
|
-
class: "expected_outcome",
|
|
435
|
-
outcome: enumOr(input.outcome, EXPECTED_OUTCOMES, "customer_abandoned"),
|
|
436
|
-
stage: enumOr(input.stage, STAGES, "completion"),
|
|
437
|
-
sequence: safeSequence(input.sequence)
|
|
438
|
-
},
|
|
439
|
-
commonInput
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
function buildTelemetryPerformanceEvent(input) {
|
|
443
|
-
return addCommonFields(
|
|
444
|
-
{
|
|
445
|
-
eventId: safeUuid(input.eventId),
|
|
446
|
-
class: "performance",
|
|
447
|
-
stage: enumOr(input.stage, STAGES, "sdk_initialize"),
|
|
448
|
-
sequence: safeSequence(input.sequence),
|
|
449
|
-
durationMs: safeDuration(input.durationMs),
|
|
450
|
-
durationMode: enumOr(input.durationMode, DURATION_MODES, "machine")
|
|
451
|
-
},
|
|
452
|
-
input
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
function serializeTelemetryBatch(events, options) {
|
|
456
|
-
const sanitizedEvents = events.slice(0, TELEMETRY_MAX_BATCH_EVENTS).flatMap((event) => {
|
|
457
|
-
if (event.class === "technical_error") {
|
|
458
|
-
return [buildTelemetryErrorEvent({ ...event, errorCode: event.code })];
|
|
459
|
-
}
|
|
460
|
-
if (event.class === "lifecycle") return [buildTelemetryLogEvent(event)];
|
|
461
|
-
if (event.class === "expected_outcome") return [buildTelemetryTerminalEvent(event)];
|
|
462
|
-
if (event.class === "performance") return [buildTelemetryPerformanceEvent(event)];
|
|
463
|
-
return [];
|
|
464
|
-
});
|
|
465
|
-
const envelope = {
|
|
466
|
-
schemaVersion: TELEMETRY_SCHEMA_VERSION,
|
|
467
|
-
batchId: safeUuid(options.batchId),
|
|
468
|
-
correlationId: safeUuid(options.correlationId),
|
|
469
|
-
sdk: {
|
|
470
|
-
package: enumOr(options.sdkPackage, SDK_PACKAGES, "@flopay/shared"),
|
|
471
|
-
version: SDK_VERSION.test(options.sdkVersion) ? options.sdkVersion : "0.0.0"
|
|
472
|
-
},
|
|
473
|
-
events: sanitizedEvents
|
|
474
|
-
};
|
|
475
|
-
return JSON.stringify(envelope);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
// src/config.ts
|
|
479
|
-
var ENV_URL_MAP = {
|
|
480
|
-
local: "https://flo.ngrok.pro",
|
|
481
|
-
staging: "https://api.stage.flopay.com",
|
|
482
|
-
production: "https://api.flopay.com"
|
|
483
|
-
};
|
|
484
|
-
var globalEnvironment = "staging";
|
|
485
|
-
function configureFlopay(config) {
|
|
486
|
-
globalEnvironment = config.environment;
|
|
487
|
-
}
|
|
488
|
-
function getConfiguredBillingApiUrl() {
|
|
489
|
-
return ENV_URL_MAP[globalEnvironment];
|
|
490
|
-
}
|
|
491
|
-
function getFloPayEnvironment() {
|
|
492
|
-
return globalEnvironment;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// src/payment-logos.generated.ts
|
|
496
|
-
var VENDORED_LOGO_METHODS = [
|
|
497
|
-
"alipay",
|
|
498
|
-
"bancontact",
|
|
499
|
-
"blik",
|
|
500
|
-
"eps",
|
|
501
|
-
"giropay",
|
|
502
|
-
"ideal",
|
|
503
|
-
"klarna",
|
|
504
|
-
"p24",
|
|
505
|
-
"sepa_debit",
|
|
506
|
-
"wechat_pay"
|
|
507
|
-
];
|
|
508
|
-
|
|
509
|
-
// src/constants.ts
|
|
510
|
-
var SDK_VERSION2 = "1.4.3";
|
|
511
|
-
var FLO_SDK_VERSION_HEADER = "x-flo-sdk-version";
|
|
512
|
-
var BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
513
|
-
var BILLING_API_URL_PRODUCTION = "https://api.flopay.com";
|
|
514
|
-
var DEFAULT_API_BASE_URL = BILLING_API_URL_STAGING;
|
|
515
|
-
var BILLING_API_URL = BILLING_API_URL_STAGING;
|
|
516
|
-
function resolveBillingApiUrl(billingApiUrl) {
|
|
517
|
-
if (billingApiUrl) return billingApiUrl;
|
|
518
|
-
if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_FLOPAY_ENV) {
|
|
519
|
-
const env = process.env.NEXT_PUBLIC_FLOPAY_ENV;
|
|
520
|
-
if (env === "production") return BILLING_API_URL_PRODUCTION;
|
|
521
|
-
return BILLING_API_URL_STAGING;
|
|
522
|
-
}
|
|
523
|
-
return getConfiguredBillingApiUrl();
|
|
524
|
-
}
|
|
525
|
-
var DEFAULT_API_VERSION = "2024-01-01";
|
|
526
|
-
var DEFAULT_APPEARANCE = {
|
|
527
|
-
theme: "default",
|
|
528
|
-
variables: {
|
|
529
|
-
colorPrimary: "#4A49FF",
|
|
530
|
-
colorBackground: "#FFFFFF",
|
|
531
|
-
colorText: "#262833",
|
|
532
|
-
colorDanger: "#DF1B41",
|
|
533
|
-
borderRadius: "8px",
|
|
534
|
-
fontFamily: "Poppins, system-ui, sans-serif",
|
|
535
|
-
fontSizeBase: "16px",
|
|
536
|
-
spacingUnit: "4px"
|
|
537
|
-
}
|
|
538
|
-
};
|
|
539
|
-
var FLAT_APPEARANCE = {
|
|
540
|
-
theme: "flat",
|
|
541
|
-
variables: {
|
|
542
|
-
...DEFAULT_APPEARANCE.variables,
|
|
543
|
-
borderRadius: "4px"
|
|
544
|
-
}
|
|
545
|
-
};
|
|
546
|
-
var NIGHT_APPEARANCE = {
|
|
547
|
-
theme: "night",
|
|
548
|
-
variables: {
|
|
549
|
-
colorPrimary: "#7B7BFF",
|
|
550
|
-
colorBackground: "#1A1A2E",
|
|
551
|
-
colorText: "#E0E0E0",
|
|
552
|
-
colorDanger: "#FF6B6B",
|
|
553
|
-
borderRadius: "8px",
|
|
554
|
-
fontFamily: "Poppins, system-ui, sans-serif",
|
|
555
|
-
fontSizeBase: "16px",
|
|
556
|
-
spacingUnit: "4px"
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
var MODERN_LIGHT_APPEARANCE = {
|
|
560
|
-
theme: "default",
|
|
561
|
-
variables: {
|
|
562
|
-
colorPrimary: "#1785E0",
|
|
563
|
-
colorBackground: "#FFFFFF",
|
|
564
|
-
colorText: "#0F172A",
|
|
565
|
-
colorDanger: "#EF4444",
|
|
566
|
-
borderRadius: "12px",
|
|
567
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
568
|
-
fontSizeBase: "15px",
|
|
569
|
-
spacingUnit: "5px"
|
|
570
|
-
},
|
|
571
|
-
rules: {
|
|
572
|
-
".Input": {
|
|
573
|
-
padding: "14px 16px",
|
|
574
|
-
border: "1.5px solid #E5E7EB",
|
|
575
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.04)"
|
|
576
|
-
},
|
|
577
|
-
".Input:focus": {
|
|
578
|
-
borderColor: "#1785E0",
|
|
579
|
-
boxShadow: "0 0 0 4px rgba(23,133,224,0.12)"
|
|
580
|
-
},
|
|
581
|
-
".Label": {
|
|
582
|
-
fontWeight: "500",
|
|
583
|
-
color: "#475569",
|
|
584
|
-
marginBottom: "6px"
|
|
585
|
-
},
|
|
586
|
-
".Tab": {
|
|
587
|
-
padding: "12px 16px",
|
|
588
|
-
borderRadius: "12px",
|
|
589
|
-
border: "1.5px solid #E5E7EB"
|
|
590
|
-
},
|
|
591
|
-
".Tab:hover": {
|
|
592
|
-
borderColor: "#CBD5E1"
|
|
593
|
-
},
|
|
594
|
-
".Tab--selected": {
|
|
595
|
-
borderColor: "#1785E0",
|
|
596
|
-
boxShadow: "0 0 0 1px #1785E0"
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
var MODERN_DARK_APPEARANCE = {
|
|
601
|
-
theme: "night",
|
|
602
|
-
variables: {
|
|
603
|
-
colorPrimary: "#60A5FA",
|
|
604
|
-
colorBackground: "#0B1220",
|
|
605
|
-
colorText: "#F1F5F9",
|
|
606
|
-
colorDanger: "#F87171",
|
|
607
|
-
borderRadius: "12px",
|
|
608
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
609
|
-
fontSizeBase: "15px",
|
|
610
|
-
spacingUnit: "5px"
|
|
611
|
-
},
|
|
612
|
-
rules: {
|
|
613
|
-
".Input": {
|
|
614
|
-
backgroundColor: "#111827",
|
|
615
|
-
padding: "14px 16px",
|
|
616
|
-
border: "1.5px solid #1F2937",
|
|
617
|
-
color: "#F1F5F9",
|
|
618
|
-
boxShadow: "none"
|
|
619
|
-
},
|
|
620
|
-
".Input:focus": {
|
|
621
|
-
borderColor: "#60A5FA",
|
|
622
|
-
boxShadow: "0 0 0 4px rgba(96,165,250,0.18)"
|
|
623
|
-
},
|
|
624
|
-
".Label": {
|
|
625
|
-
fontWeight: "500",
|
|
626
|
-
color: "#94A3B8",
|
|
627
|
-
marginBottom: "6px"
|
|
628
|
-
},
|
|
629
|
-
".Tab": {
|
|
630
|
-
padding: "12px 16px",
|
|
631
|
-
borderRadius: "12px",
|
|
632
|
-
border: "1.5px solid #1F2937",
|
|
633
|
-
backgroundColor: "#111827",
|
|
634
|
-
color: "#F1F5F9"
|
|
635
|
-
},
|
|
636
|
-
".Tab:hover": {
|
|
637
|
-
borderColor: "#374151"
|
|
638
|
-
},
|
|
639
|
-
".Tab--selected": {
|
|
640
|
-
borderColor: "#60A5FA",
|
|
641
|
-
boxShadow: "0 0 0 1px #60A5FA"
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
var BOLD_LIGHT_APPEARANCE = {
|
|
646
|
-
theme: "default",
|
|
647
|
-
variables: {
|
|
648
|
-
colorPrimary: "#1785E0",
|
|
649
|
-
colorBackground: "#FFFFFF",
|
|
650
|
-
colorText: "#0C2B4D",
|
|
651
|
-
colorDanger: "#DC2626",
|
|
652
|
-
borderRadius: "12px",
|
|
653
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
654
|
-
fontSizeBase: "16px",
|
|
655
|
-
spacingUnit: "5px"
|
|
656
|
-
},
|
|
657
|
-
rules: {
|
|
658
|
-
".Input": {
|
|
659
|
-
padding: "14px 16px",
|
|
660
|
-
border: "2px solid #E5E7EB"
|
|
661
|
-
},
|
|
662
|
-
".Input:focus": {
|
|
663
|
-
borderColor: "#1785E0",
|
|
664
|
-
boxShadow: "0 0 0 3px rgba(23,133,224,0.2)"
|
|
665
|
-
},
|
|
666
|
-
".Label": {
|
|
667
|
-
fontWeight: "600",
|
|
668
|
-
color: "#0C2B4D"
|
|
669
|
-
},
|
|
670
|
-
".Tab": {
|
|
671
|
-
padding: "14px 18px",
|
|
672
|
-
border: "2px solid #E5E7EB",
|
|
673
|
-
fontWeight: "600"
|
|
674
|
-
},
|
|
675
|
-
".Tab--selected": {
|
|
676
|
-
borderColor: "#1785E0",
|
|
677
|
-
boxShadow: "0 0 0 1px #1785E0"
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
};
|
|
681
|
-
var BOLD_DARK_APPEARANCE = {
|
|
682
|
-
theme: "night",
|
|
683
|
-
variables: {
|
|
684
|
-
colorPrimary: "#60A5FA",
|
|
685
|
-
colorBackground: "#0C2B4D",
|
|
686
|
-
colorText: "#FFFFFF",
|
|
687
|
-
colorDanger: "#F87171",
|
|
688
|
-
borderRadius: "12px",
|
|
689
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
690
|
-
fontSizeBase: "16px",
|
|
691
|
-
spacingUnit: "5px"
|
|
692
|
-
},
|
|
693
|
-
rules: {
|
|
694
|
-
".Input": {
|
|
695
|
-
backgroundColor: "#1E3A8A",
|
|
696
|
-
padding: "14px 16px",
|
|
697
|
-
border: "2px solid #1E40AF",
|
|
698
|
-
color: "#FFFFFF"
|
|
699
|
-
},
|
|
700
|
-
".Input:focus": {
|
|
701
|
-
borderColor: "#60A5FA",
|
|
702
|
-
boxShadow: "0 0 0 3px rgba(96,165,250,0.25)"
|
|
703
|
-
},
|
|
704
|
-
".Label": {
|
|
705
|
-
fontWeight: "600",
|
|
706
|
-
color: "#DBEAFE"
|
|
707
|
-
},
|
|
708
|
-
".Tab": {
|
|
709
|
-
padding: "14px 18px",
|
|
710
|
-
border: "2px solid #1E40AF",
|
|
711
|
-
backgroundColor: "#1E3A8A",
|
|
712
|
-
color: "#FFFFFF",
|
|
713
|
-
fontWeight: "600"
|
|
714
|
-
},
|
|
715
|
-
".Tab--selected": {
|
|
716
|
-
borderColor: "#60A5FA",
|
|
717
|
-
boxShadow: "0 0 0 1px #60A5FA"
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
var GLASS_LIGHT_APPEARANCE = {
|
|
722
|
-
theme: "default",
|
|
723
|
-
variables: {
|
|
724
|
-
colorPrimary: "#1785E0",
|
|
725
|
-
colorBackground: "#FFFFFF",
|
|
726
|
-
colorText: "#1E293B",
|
|
727
|
-
colorDanger: "#EF4444",
|
|
728
|
-
borderRadius: "16px",
|
|
729
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
730
|
-
fontSizeBase: "15px",
|
|
731
|
-
spacingUnit: "5px"
|
|
732
|
-
},
|
|
733
|
-
rules: {
|
|
734
|
-
".Input": {
|
|
735
|
-
backgroundColor: "rgba(255,255,255,0.6)",
|
|
736
|
-
backdropFilter: "blur(10px)",
|
|
737
|
-
padding: "14px 16px",
|
|
738
|
-
border: "1px solid rgba(255,255,255,0.6)",
|
|
739
|
-
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 3px rgba(23,133,224,0.08)"
|
|
740
|
-
},
|
|
741
|
-
".Input:focus": {
|
|
742
|
-
borderColor: "rgba(23,133,224,0.5)",
|
|
743
|
-
boxShadow: "0 0 0 3px rgba(23,133,224,0.15)"
|
|
744
|
-
},
|
|
745
|
-
".Label": {
|
|
746
|
-
fontWeight: "500",
|
|
747
|
-
color: "#475569"
|
|
748
|
-
},
|
|
749
|
-
".Tab": {
|
|
750
|
-
padding: "12px 16px",
|
|
751
|
-
backgroundColor: "rgba(255,255,255,0.5)",
|
|
752
|
-
border: "1px solid rgba(255,255,255,0.6)",
|
|
753
|
-
borderRadius: "14px"
|
|
754
|
-
},
|
|
755
|
-
".Tab--selected": {
|
|
756
|
-
borderColor: "rgba(23,133,224,0.6)",
|
|
757
|
-
boxShadow: "0 0 0 1px rgba(23,133,224,0.6)"
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
};
|
|
761
|
-
var GLASS_DARK_APPEARANCE = {
|
|
762
|
-
theme: "night",
|
|
763
|
-
variables: {
|
|
764
|
-
colorPrimary: "#60A5FA",
|
|
765
|
-
colorBackground: "#0F172A",
|
|
766
|
-
colorText: "#F1F5F9",
|
|
767
|
-
colorDanger: "#F87171",
|
|
768
|
-
borderRadius: "16px",
|
|
769
|
-
fontFamily: "Inter, system-ui, sans-serif",
|
|
770
|
-
fontSizeBase: "15px",
|
|
771
|
-
spacingUnit: "5px"
|
|
772
|
-
},
|
|
773
|
-
rules: {
|
|
774
|
-
".Input": {
|
|
775
|
-
backgroundColor: "rgba(15,23,42,0.6)",
|
|
776
|
-
backdropFilter: "blur(10px)",
|
|
777
|
-
padding: "14px 16px",
|
|
778
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
779
|
-
color: "#F1F5F9"
|
|
780
|
-
},
|
|
781
|
-
".Input:focus": {
|
|
782
|
-
borderColor: "rgba(96,165,250,0.5)",
|
|
783
|
-
boxShadow: "0 0 0 3px rgba(96,165,250,0.2)"
|
|
784
|
-
},
|
|
785
|
-
".Label": {
|
|
786
|
-
fontWeight: "500",
|
|
787
|
-
color: "#94A3B8"
|
|
788
|
-
},
|
|
789
|
-
".Tab": {
|
|
790
|
-
padding: "12px 16px",
|
|
791
|
-
backgroundColor: "rgba(15,23,42,0.6)",
|
|
792
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
793
|
-
borderRadius: "14px",
|
|
794
|
-
color: "#F1F5F9"
|
|
795
|
-
},
|
|
796
|
-
".Tab--selected": {
|
|
797
|
-
borderColor: "rgba(96,165,250,0.6)",
|
|
798
|
-
boxShadow: "0 0 0 1px rgba(96,165,250,0.6)"
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
};
|
|
802
|
-
var BUTTONS_LAYOUT_DEFAULT = {};
|
|
803
|
-
var BUTTONS_LAYOUT_MINIMAL = {
|
|
804
|
-
cardButton: {
|
|
805
|
-
border: "none",
|
|
806
|
-
backgroundColor: "#f9fafb",
|
|
807
|
-
boxShadow: "none"
|
|
808
|
-
},
|
|
809
|
-
cardFormContainer: {
|
|
810
|
-
backgroundColor: "#f9fafb",
|
|
811
|
-
border: "none"
|
|
812
|
-
},
|
|
813
|
-
cardInputBorder: "#e5e7eb",
|
|
814
|
-
backButtonIcon: {
|
|
815
|
-
backgroundColor: "#e5e7eb"
|
|
816
|
-
},
|
|
817
|
-
submitButton: {
|
|
818
|
-
borderRadius: "6px"
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
var BUTTONS_LAYOUT_ROUNDED = {
|
|
822
|
-
cardButton: {
|
|
823
|
-
borderRadius: "9999px",
|
|
824
|
-
border: "1px solid #e5e7eb",
|
|
825
|
-
boxShadow: "0 1px 3px rgba(0,0,0,0.06)"
|
|
826
|
-
},
|
|
827
|
-
cardFormContainer: {
|
|
828
|
-
borderRadius: "16px",
|
|
829
|
-
border: "1px solid #e5e7eb",
|
|
830
|
-
boxShadow: "0 2px 8px rgba(0,0,0,0.06)"
|
|
831
|
-
},
|
|
832
|
-
cardInputBorder: "#d1d5db",
|
|
833
|
-
submitButton: {
|
|
834
|
-
borderRadius: "9999px"
|
|
835
|
-
},
|
|
836
|
-
backButtonIcon: {
|
|
837
|
-
backgroundColor: "#f3f4f6"
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
var BUTTONS_LAYOUT_DARK = {
|
|
841
|
-
cardButton: {
|
|
842
|
-
backgroundColor: "#1f2937",
|
|
843
|
-
color: "#f9fafb",
|
|
844
|
-
border: "1px solid #374151",
|
|
845
|
-
boxShadow: "none"
|
|
846
|
-
},
|
|
847
|
-
cardFormContainer: {
|
|
848
|
-
backgroundColor: "#111827",
|
|
849
|
-
border: "1px solid #374151"
|
|
850
|
-
},
|
|
851
|
-
cardInputBorder: "#4b5563",
|
|
852
|
-
cardInputColor: "#f9fafb",
|
|
853
|
-
cardInputPlaceholderColor: "#6b7280",
|
|
854
|
-
cardInputBackground: "#1f2937",
|
|
855
|
-
nameInput: {
|
|
856
|
-
backgroundColor: "#1f2937",
|
|
857
|
-
color: "#f9fafb"
|
|
858
|
-
},
|
|
859
|
-
backButton: {
|
|
860
|
-
color: "#9ca3af"
|
|
861
|
-
},
|
|
862
|
-
backButtonIcon: {
|
|
863
|
-
backgroundColor: "#374151"
|
|
864
|
-
},
|
|
865
|
-
submitButton: {
|
|
866
|
-
backgroundColor: "#6366f1"
|
|
867
|
-
},
|
|
868
|
-
title: {
|
|
869
|
-
color: "#f9fafb"
|
|
870
|
-
},
|
|
871
|
-
countrySelect: {
|
|
872
|
-
backgroundColor: "#1f2937",
|
|
873
|
-
color: "#f9fafb"
|
|
874
|
-
},
|
|
875
|
-
zipInput: {
|
|
876
|
-
backgroundColor: "#1f2937",
|
|
877
|
-
color: "#f9fafb"
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
|
-
var BUTTONS_LAYOUT_MODERN_LIGHT = {
|
|
881
|
-
cardFormContainer: {
|
|
882
|
-
backgroundColor: "#FAFAFA",
|
|
883
|
-
borderRadius: "20px",
|
|
884
|
-
border: "1px solid #E5E7EB",
|
|
885
|
-
boxShadow: "0 8px 24px rgba(15,23,42,0.04)",
|
|
886
|
-
padding: "24px"
|
|
887
|
-
},
|
|
888
|
-
cardButton: {
|
|
889
|
-
backgroundColor: "#FFFFFF",
|
|
890
|
-
borderRadius: "14px",
|
|
891
|
-
border: "1.5px solid #E5E7EB",
|
|
892
|
-
boxShadow: "0 1px 2px rgba(15,23,42,0.04)",
|
|
893
|
-
padding: "14px 18px"
|
|
894
|
-
},
|
|
895
|
-
cardInputBorder: "#E5E7EB",
|
|
896
|
-
nameInput: {
|
|
897
|
-
backgroundColor: "#FFFFFF",
|
|
898
|
-
border: "1.5px solid #E5E7EB",
|
|
899
|
-
borderRadius: "14px",
|
|
900
|
-
padding: "14px 16px"
|
|
901
|
-
},
|
|
902
|
-
submitButton: {
|
|
903
|
-
backgroundColor: "#1785E0",
|
|
904
|
-
borderRadius: "14px",
|
|
905
|
-
padding: "16px 24px",
|
|
906
|
-
boxShadow: "0 4px 14px rgba(23,133,224,0.25)",
|
|
907
|
-
fontWeight: "600"
|
|
908
|
-
},
|
|
909
|
-
title: {
|
|
910
|
-
color: "#0F172A",
|
|
911
|
-
fontWeight: "600"
|
|
912
|
-
},
|
|
913
|
-
titleFontSize: "20px",
|
|
914
|
-
backButton: { color: "#64748B" },
|
|
915
|
-
backButtonIcon: { backgroundColor: "#F1F5F9" }
|
|
916
|
-
};
|
|
917
|
-
var BUTTONS_LAYOUT_MODERN_DARK = {
|
|
918
|
-
cardFormContainer: {
|
|
919
|
-
backgroundColor: "#111827",
|
|
920
|
-
borderRadius: "20px",
|
|
921
|
-
border: "1px solid #1F2937",
|
|
922
|
-
boxShadow: "0 8px 24px rgba(0,0,0,0.2)",
|
|
923
|
-
padding: "24px"
|
|
924
|
-
},
|
|
925
|
-
cardButton: {
|
|
926
|
-
backgroundColor: "#0B1220",
|
|
927
|
-
borderRadius: "14px",
|
|
928
|
-
border: "1.5px solid #1F2937",
|
|
929
|
-
color: "#F1F5F9",
|
|
930
|
-
padding: "14px 18px"
|
|
931
|
-
},
|
|
932
|
-
cardInputBorder: "#1F2937",
|
|
933
|
-
cardInputBackground: "#111827",
|
|
934
|
-
cardInputColor: "#F1F5F9",
|
|
935
|
-
cardInputPlaceholderColor: "#64748B",
|
|
936
|
-
nameInput: {
|
|
937
|
-
backgroundColor: "#111827",
|
|
938
|
-
border: "1.5px solid #1F2937",
|
|
939
|
-
borderRadius: "14px",
|
|
940
|
-
padding: "14px 16px",
|
|
941
|
-
color: "#F1F5F9"
|
|
942
|
-
},
|
|
943
|
-
submitButton: {
|
|
944
|
-
backgroundColor: "#60A5FA",
|
|
945
|
-
borderRadius: "14px",
|
|
946
|
-
padding: "16px 24px",
|
|
947
|
-
boxShadow: "0 4px 14px rgba(96,165,250,0.3)",
|
|
948
|
-
fontWeight: "600",
|
|
949
|
-
color: "#0B1220"
|
|
950
|
-
},
|
|
951
|
-
title: {
|
|
952
|
-
color: "#F1F5F9",
|
|
953
|
-
fontWeight: "600"
|
|
954
|
-
},
|
|
955
|
-
titleFontSize: "20px",
|
|
956
|
-
backButton: { color: "#94A3B8" },
|
|
957
|
-
backButtonIcon: { backgroundColor: "#1F2937" },
|
|
958
|
-
countrySelect: { backgroundColor: "#111827", color: "#F1F5F9" },
|
|
959
|
-
zipInput: { backgroundColor: "#111827", color: "#F1F5F9" }
|
|
960
|
-
};
|
|
961
|
-
var BUTTONS_LAYOUT_BOLD_LIGHT = {
|
|
962
|
-
cardFormContainer: {
|
|
963
|
-
backgroundColor: "#EFF6FF",
|
|
964
|
-
borderRadius: "20px",
|
|
965
|
-
border: "2px solid #1785E0",
|
|
966
|
-
padding: "24px"
|
|
967
|
-
},
|
|
968
|
-
cardButton: {
|
|
969
|
-
backgroundColor: "#FFFFFF",
|
|
970
|
-
borderRadius: "12px",
|
|
971
|
-
border: "2px solid #1785E0",
|
|
972
|
-
color: "#1785E0",
|
|
973
|
-
fontWeight: "700",
|
|
974
|
-
padding: "14px 18px"
|
|
975
|
-
},
|
|
976
|
-
cardInputBorder: "#E5E7EB",
|
|
977
|
-
nameInput: {
|
|
978
|
-
backgroundColor: "#FFFFFF",
|
|
979
|
-
border: "2px solid #E5E7EB",
|
|
980
|
-
borderRadius: "12px",
|
|
981
|
-
padding: "14px 16px",
|
|
982
|
-
fontWeight: "500"
|
|
983
|
-
},
|
|
984
|
-
submitButton: {
|
|
985
|
-
background: "linear-gradient(135deg, #1785E0 0%, #0EA5E9 100%)",
|
|
986
|
-
borderRadius: "9999px",
|
|
987
|
-
padding: "16px 24px",
|
|
988
|
-
boxShadow: "0 10px 25px rgba(23,133,224,0.35)",
|
|
989
|
-
fontWeight: "700",
|
|
990
|
-
color: "#FFFFFF",
|
|
991
|
-
border: "none"
|
|
992
|
-
},
|
|
993
|
-
submitButtonFontSize: "17px",
|
|
994
|
-
title: {
|
|
995
|
-
color: "#0C2B4D",
|
|
996
|
-
fontWeight: "800",
|
|
997
|
-
letterSpacing: "-0.02em"
|
|
998
|
-
},
|
|
999
|
-
titleFontSize: "22px",
|
|
1000
|
-
backButton: { color: "#1785E0", fontWeight: "600" },
|
|
1001
|
-
backButtonIcon: { backgroundColor: "#DBEAFE" }
|
|
1002
|
-
};
|
|
1003
|
-
var BUTTONS_LAYOUT_BOLD_DARK = {
|
|
1004
|
-
cardFormContainer: {
|
|
1005
|
-
backgroundColor: "#1E3A8A",
|
|
1006
|
-
borderRadius: "20px",
|
|
1007
|
-
border: "2px solid #60A5FA",
|
|
1008
|
-
padding: "24px"
|
|
1009
|
-
},
|
|
1010
|
-
cardButton: {
|
|
1011
|
-
backgroundColor: "#0C2B4D",
|
|
1012
|
-
borderRadius: "12px",
|
|
1013
|
-
border: "2px solid #60A5FA",
|
|
1014
|
-
color: "#60A5FA",
|
|
1015
|
-
fontWeight: "700",
|
|
1016
|
-
padding: "14px 18px"
|
|
1017
|
-
},
|
|
1018
|
-
cardInputBorder: "#1E40AF",
|
|
1019
|
-
cardInputBackground: "#1E3A8A",
|
|
1020
|
-
cardInputColor: "#FFFFFF",
|
|
1021
|
-
cardInputPlaceholderColor: "#60A5FA",
|
|
1022
|
-
nameInput: {
|
|
1023
|
-
backgroundColor: "#1E3A8A",
|
|
1024
|
-
border: "2px solid #1E40AF",
|
|
1025
|
-
borderRadius: "12px",
|
|
1026
|
-
padding: "14px 16px",
|
|
1027
|
-
fontWeight: "500",
|
|
1028
|
-
color: "#FFFFFF"
|
|
1029
|
-
},
|
|
1030
|
-
submitButton: {
|
|
1031
|
-
background: "linear-gradient(135deg, #60A5FA 0%, #38BDF8 100%)",
|
|
1032
|
-
borderRadius: "9999px",
|
|
1033
|
-
padding: "16px 24px",
|
|
1034
|
-
boxShadow: "0 10px 25px rgba(96,165,250,0.35)",
|
|
1035
|
-
fontWeight: "700",
|
|
1036
|
-
color: "#FFFFFF",
|
|
1037
|
-
border: "none"
|
|
1038
|
-
},
|
|
1039
|
-
submitButtonFontSize: "17px",
|
|
1040
|
-
title: {
|
|
1041
|
-
color: "#FFFFFF",
|
|
1042
|
-
fontWeight: "800",
|
|
1043
|
-
letterSpacing: "-0.02em"
|
|
1044
|
-
},
|
|
1045
|
-
titleFontSize: "22px",
|
|
1046
|
-
backButton: { color: "#DBEAFE", fontWeight: "600" },
|
|
1047
|
-
backButtonIcon: { backgroundColor: "#1E40AF" },
|
|
1048
|
-
countrySelect: { backgroundColor: "#1E3A8A", color: "#FFFFFF" },
|
|
1049
|
-
zipInput: { backgroundColor: "#1E3A8A", color: "#FFFFFF" }
|
|
1050
|
-
};
|
|
1051
|
-
var BUTTONS_LAYOUT_GLASS_LIGHT = {
|
|
1052
|
-
cardFormContainer: {
|
|
1053
|
-
background: "linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%)",
|
|
1054
|
-
borderRadius: "24px",
|
|
1055
|
-
border: "1px solid rgba(255,255,255,0.6)",
|
|
1056
|
-
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 40px rgba(23,133,224,0.15)",
|
|
1057
|
-
padding: "28px"
|
|
1058
|
-
},
|
|
1059
|
-
cardButton: {
|
|
1060
|
-
backgroundColor: "rgba(255,255,255,0.7)",
|
|
1061
|
-
backdropFilter: "blur(20px)",
|
|
1062
|
-
borderRadius: "16px",
|
|
1063
|
-
border: "1px solid rgba(255,255,255,0.6)",
|
|
1064
|
-
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.5), 0 4px 16px rgba(23,133,224,0.1)",
|
|
1065
|
-
padding: "14px 18px"
|
|
1066
|
-
},
|
|
1067
|
-
cardInputBorder: "rgba(255,255,255,0.6)",
|
|
1068
|
-
nameInput: {
|
|
1069
|
-
backgroundColor: "rgba(255,255,255,0.6)",
|
|
1070
|
-
backdropFilter: "blur(10px)",
|
|
1071
|
-
border: "1px solid rgba(255,255,255,0.6)",
|
|
1072
|
-
borderRadius: "14px",
|
|
1073
|
-
padding: "14px 16px"
|
|
1074
|
-
},
|
|
1075
|
-
submitButton: {
|
|
1076
|
-
backgroundColor: "rgba(23,133,224,0.95)",
|
|
1077
|
-
backdropFilter: "blur(10px)",
|
|
1078
|
-
borderRadius: "16px",
|
|
1079
|
-
padding: "16px 24px",
|
|
1080
|
-
boxShadow: "0 10px 30px rgba(23,133,224,0.3), inset 0 1px 0 rgba(255,255,255,0.2)",
|
|
1081
|
-
fontWeight: "600",
|
|
1082
|
-
color: "#FFFFFF"
|
|
1083
|
-
},
|
|
1084
|
-
title: {
|
|
1085
|
-
color: "#1E293B",
|
|
1086
|
-
fontWeight: "600",
|
|
1087
|
-
letterSpacing: "-0.01em"
|
|
1088
|
-
},
|
|
1089
|
-
titleFontSize: "20px",
|
|
1090
|
-
backButton: { color: "#1785E0", fontWeight: "500" },
|
|
1091
|
-
backButtonIcon: { backgroundColor: "rgba(255,255,255,0.7)" }
|
|
1092
|
-
};
|
|
1093
|
-
var BUTTONS_LAYOUT_GLASS_DARK = {
|
|
1094
|
-
cardFormContainer: {
|
|
1095
|
-
background: "linear-gradient(135deg, #0C2B4D 0%, #0F172A 100%)",
|
|
1096
|
-
borderRadius: "24px",
|
|
1097
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
1098
|
-
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.06), 0 20px 50px rgba(0,0,0,0.4)",
|
|
1099
|
-
padding: "28px"
|
|
1100
|
-
},
|
|
1101
|
-
cardButton: {
|
|
1102
|
-
backgroundColor: "rgba(15,23,42,0.6)",
|
|
1103
|
-
backdropFilter: "blur(20px)",
|
|
1104
|
-
borderRadius: "16px",
|
|
1105
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
1106
|
-
boxShadow: "inset 0 1px 0 rgba(255,255,255,0.05), 0 4px 16px rgba(0,0,0,0.3)",
|
|
1107
|
-
padding: "14px 18px",
|
|
1108
|
-
color: "#F1F5F9"
|
|
1109
|
-
},
|
|
1110
|
-
cardInputBorder: "rgba(255,255,255,0.08)",
|
|
1111
|
-
cardInputBackground: "rgba(15,23,42,0.6)",
|
|
1112
|
-
cardInputColor: "#F1F5F9",
|
|
1113
|
-
cardInputPlaceholderColor: "#64748B",
|
|
1114
|
-
nameInput: {
|
|
1115
|
-
backgroundColor: "rgba(15,23,42,0.6)",
|
|
1116
|
-
backdropFilter: "blur(10px)",
|
|
1117
|
-
border: "1px solid rgba(255,255,255,0.08)",
|
|
1118
|
-
borderRadius: "14px",
|
|
1119
|
-
padding: "14px 16px",
|
|
1120
|
-
color: "#F1F5F9"
|
|
1121
|
-
},
|
|
1122
|
-
submitButton: {
|
|
1123
|
-
backgroundColor: "rgba(96,165,250,0.9)",
|
|
1124
|
-
backdropFilter: "blur(10px)",
|
|
1125
|
-
borderRadius: "16px",
|
|
1126
|
-
padding: "16px 24px",
|
|
1127
|
-
boxShadow: "0 10px 30px rgba(96,165,250,0.35), inset 0 1px 0 rgba(255,255,255,0.15)",
|
|
1128
|
-
fontWeight: "600",
|
|
1129
|
-
color: "#0F172A"
|
|
1130
|
-
},
|
|
1131
|
-
title: {
|
|
1132
|
-
color: "#F1F5F9",
|
|
1133
|
-
fontWeight: "600",
|
|
1134
|
-
letterSpacing: "-0.01em"
|
|
1135
|
-
},
|
|
1136
|
-
titleFontSize: "20px",
|
|
1137
|
-
backButton: { color: "#60A5FA", fontWeight: "500" },
|
|
1138
|
-
backButtonIcon: { backgroundColor: "rgba(255,255,255,0.08)" },
|
|
1139
|
-
countrySelect: { backgroundColor: "rgba(15,23,42,0.6)", color: "#F1F5F9" },
|
|
1140
|
-
zipInput: { backgroundColor: "rgba(15,23,42,0.6)", color: "#F1F5F9" }
|
|
1141
|
-
};
|
|
1142
|
-
function resolveButtonsLayoutTheme(theme) {
|
|
1143
|
-
switch (theme) {
|
|
1144
|
-
case "minimal":
|
|
1145
|
-
return BUTTONS_LAYOUT_MINIMAL;
|
|
1146
|
-
case "rounded":
|
|
1147
|
-
return BUTTONS_LAYOUT_ROUNDED;
|
|
1148
|
-
case "dark":
|
|
1149
|
-
return BUTTONS_LAYOUT_DARK;
|
|
1150
|
-
case "modern-light":
|
|
1151
|
-
return BUTTONS_LAYOUT_MODERN_LIGHT;
|
|
1152
|
-
case "modern-dark":
|
|
1153
|
-
return BUTTONS_LAYOUT_MODERN_DARK;
|
|
1154
|
-
case "bold-light":
|
|
1155
|
-
return BUTTONS_LAYOUT_BOLD_LIGHT;
|
|
1156
|
-
case "bold-dark":
|
|
1157
|
-
return BUTTONS_LAYOUT_BOLD_DARK;
|
|
1158
|
-
case "glass-light":
|
|
1159
|
-
return BUTTONS_LAYOUT_GLASS_LIGHT;
|
|
1160
|
-
case "glass-dark":
|
|
1161
|
-
return BUTTONS_LAYOUT_GLASS_DARK;
|
|
1162
|
-
default:
|
|
1163
|
-
return BUTTONS_LAYOUT_DEFAULT;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
var THEMES = {
|
|
1167
|
-
"modern-light": { appearance: MODERN_LIGHT_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_MODERN_LIGHT },
|
|
1168
|
-
"modern-dark": { appearance: MODERN_DARK_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_MODERN_DARK },
|
|
1169
|
-
"bold-light": { appearance: BOLD_LIGHT_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_BOLD_LIGHT },
|
|
1170
|
-
"bold-dark": { appearance: BOLD_DARK_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_BOLD_DARK },
|
|
1171
|
-
"glass-light": { appearance: GLASS_LIGHT_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_GLASS_LIGHT },
|
|
1172
|
-
"glass-dark": { appearance: GLASS_DARK_APPEARANCE, buttonsLayout: BUTTONS_LAYOUT_GLASS_DARK }
|
|
1173
|
-
};
|
|
1174
|
-
function resolveTheme(id) {
|
|
1175
|
-
if (!id || id === "classic") return void 0;
|
|
1176
|
-
return THEMES[id];
|
|
1177
|
-
}
|
|
1178
|
-
function stripeExpressMethodToOptionKey(method) {
|
|
1179
|
-
switch (method) {
|
|
1180
|
-
case "apple_pay":
|
|
1181
|
-
return "applePay";
|
|
1182
|
-
case "google_pay":
|
|
1183
|
-
return "googlePay";
|
|
1184
|
-
case "amazon_pay":
|
|
1185
|
-
return "amazonPay";
|
|
1186
|
-
default:
|
|
1187
|
-
return method;
|
|
1188
|
-
}
|
|
1189
|
-
}
|
|
1190
|
-
function buildPlaceholderMark(glyph, discColor, glyphColor) {
|
|
1191
|
-
return `<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${discColor}"/><text x="11" y="15.5" text-anchor="middle" font-size="13" font-weight="700" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" fill="${glyphColor}">${glyph}</text></svg>`;
|
|
1192
|
-
}
|
|
1193
|
-
function buildBankMark(discColor, glyphColor) {
|
|
1194
|
-
return `<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${discColor}"/><g fill="${glyphColor}"><path d="M11 4 L17.5 8 L4.5 8 Z"/><rect x="5" y="8.4" width="12" height="1.2" rx="0.3"/><rect x="5.9" y="10" width="1.5" height="5"/><rect x="8.55" y="10" width="1.5" height="5"/><rect x="11.95" y="10" width="1.5" height="5"/><rect x="14.6" y="10" width="1.5" height="5"/><rect x="4.6" y="15.4" width="12.8" height="1.5" rx="0.3"/></g></svg>`;
|
|
1195
|
-
}
|
|
1196
|
-
var SEPA_COUNTRIES = [
|
|
1197
|
-
"AT",
|
|
1198
|
-
"BE",
|
|
1199
|
-
"BG",
|
|
1200
|
-
"CY",
|
|
1201
|
-
"CZ",
|
|
1202
|
-
"DE",
|
|
1203
|
-
"DK",
|
|
1204
|
-
"EE",
|
|
1205
|
-
"ES",
|
|
1206
|
-
"FI",
|
|
1207
|
-
"FR",
|
|
1208
|
-
"GR",
|
|
1209
|
-
"HR",
|
|
1210
|
-
"HU",
|
|
1211
|
-
"IE",
|
|
1212
|
-
"IT",
|
|
1213
|
-
"LT",
|
|
1214
|
-
"LU",
|
|
1215
|
-
"LV",
|
|
1216
|
-
"MT",
|
|
1217
|
-
"NL",
|
|
1218
|
-
"PL",
|
|
1219
|
-
"PT",
|
|
1220
|
-
"RO",
|
|
1221
|
-
"SE",
|
|
1222
|
-
"SI",
|
|
1223
|
-
"SK",
|
|
1224
|
-
"IS",
|
|
1225
|
-
"LI",
|
|
1226
|
-
"NO",
|
|
1227
|
-
// EEA non-EU
|
|
1228
|
-
"CH",
|
|
1229
|
-
"GB",
|
|
1230
|
-
"MC",
|
|
1231
|
-
"SM",
|
|
1232
|
-
"AD",
|
|
1233
|
-
"VA"
|
|
1234
|
-
// non-EEA SEPA participants
|
|
1235
|
-
];
|
|
1236
|
-
var BANK_TRANSFER_COUNTRIES = [...SEPA_COUNTRIES, "JP", "MX", "US"];
|
|
1237
|
-
var STRIPE_METHOD_MATRIX = {
|
|
1238
|
-
// ─── Express wallets ────────────────────────────────────────────────────
|
|
1239
|
-
apple_pay: {
|
|
1240
|
-
displayName: "Apple Pay",
|
|
1241
|
-
currencies: ["*"],
|
|
1242
|
-
express: true,
|
|
1243
|
-
needsExplicitConfirm: false
|
|
1244
|
-
},
|
|
1245
|
-
google_pay: {
|
|
1246
|
-
displayName: "Google Pay",
|
|
1247
|
-
currencies: ["*"],
|
|
1248
|
-
express: true,
|
|
1249
|
-
needsExplicitConfirm: false
|
|
1250
|
-
},
|
|
1251
|
-
paypal: {
|
|
1252
|
-
displayName: "PayPal",
|
|
1253
|
-
currencies: ["eur", "gbp", "usd", "cad", "aud", "nzd", "chf", "jpy", "pln", "sek", "nok", "dkk", "czk", "huf"],
|
|
1254
|
-
express: true,
|
|
1255
|
-
needsExplicitConfirm: false
|
|
1256
|
-
},
|
|
1257
|
-
link: {
|
|
1258
|
-
displayName: "Link",
|
|
1259
|
-
currencies: ["usd", "eur"],
|
|
1260
|
-
express: true,
|
|
1261
|
-
needsExplicitConfirm: false
|
|
1262
|
-
},
|
|
1263
|
-
amazon_pay: {
|
|
1264
|
-
displayName: "Amazon Pay",
|
|
1265
|
-
currencies: ["usd", "eur", "gbp"],
|
|
1266
|
-
express: true,
|
|
1267
|
-
needsExplicitConfirm: false
|
|
1268
|
-
},
|
|
1269
|
-
// ─── Klarna: PaymentElement tile, explicit confirm ─────────────────────
|
|
1270
|
-
// Klarna renders as a PaymentElement tile (NOT express) so it always appears
|
|
1271
|
-
// when the backend includes it in `enabledPaymentMethods`. Stripe's
|
|
1272
|
-
// ExpressCheckoutElement only paints a Klarna button in eligible *real*
|
|
1273
|
-
// browsers (never headless), which made it effectively invisible and looked
|
|
1274
|
-
// like an SDK-level disable — as a tile it's purely backend-driven. Klarna
|
|
1275
|
-
// may redirect during confirm, but it still surfaces a deliberate "Pay with
|
|
1276
|
-
// Klarna" step: it omits `needsExplicitConfirm: false`, so the default
|
|
1277
|
-
// `needsStripeMethodExplicitConfirm(...) === true` applies — unlike the
|
|
1278
|
-
// auto-confirm APMs below.
|
|
1279
|
-
klarna: {
|
|
1280
|
-
displayName: "Klarna",
|
|
1281
|
-
currencies: ["usd", "eur", "gbp", "aud", "nzd", "cad", "chf", "sek", "nok", "dkk", "pln", "czk", "ron"],
|
|
1282
|
-
amounts: { usd: { min: 100 }, eur: { min: 100 }, gbp: { min: 100 } },
|
|
1283
|
-
// Default (explicit "Pay with Klarna" button) — Klarna's PaymentElement can
|
|
1284
|
-
// collect inline data and isn't a pure redirect-only method, so surface a
|
|
1285
|
-
// deliberate confirm rather than auto-submitting on tile click.
|
|
1286
|
-
theme: {
|
|
1287
|
-
light: {
|
|
1288
|
-
backgroundColor: "#FFB3C7",
|
|
1289
|
-
textColor: "#0A0B09",
|
|
1290
|
-
borderColor: "#FFB3C7",
|
|
1291
|
-
logoSvg: buildPlaceholderMark("K", "#0A0B09", "#FFB3C7")
|
|
1292
|
-
},
|
|
1293
|
-
dark: {
|
|
1294
|
-
backgroundColor: "#FFB3C7",
|
|
1295
|
-
textColor: "#0A0B09",
|
|
1296
|
-
borderColor: "#FFB3C7",
|
|
1297
|
-
logoSvg: buildPlaceholderMark("K", "#0A0B09", "#FFB3C7")
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
},
|
|
1301
|
-
// ─── PaymentElement APMs: auto-confirm (redirect-only, no Pay button) ───
|
|
1302
|
-
// Affirm and Cash App Pay are pure redirect/handoff methods with no inline
|
|
1303
|
-
// inputs, so they auto-submit on tile click (`needsExplicitConfirm: false`).
|
|
1304
|
-
//
|
|
1305
|
-
// Affirm currently rejects on non-USD currencies via
|
|
1306
|
-
// /v1/elements/sessions, hence the narrow currency list. Below $35.00 USD
|
|
1307
|
-
// it returns `amount_too_small` and blanks out the whole accordion, hence
|
|
1308
|
-
// the explicit min — see `filterStripeMethodsByAmount` for the gate.
|
|
1309
|
-
affirm: {
|
|
1310
|
-
displayName: "Affirm",
|
|
1311
|
-
currencies: ["usd"],
|
|
1312
|
-
countries: ["US", "CA"],
|
|
1313
|
-
amounts: { usd: { min: 3500, max: 3e6 } },
|
|
1314
|
-
needsExplicitConfirm: false,
|
|
1315
|
-
theme: {
|
|
1316
|
-
light: {
|
|
1317
|
-
backgroundColor: "#060F33",
|
|
1318
|
-
textColor: "#FFFFFF",
|
|
1319
|
-
borderColor: "#060F33",
|
|
1320
|
-
logoSvg: buildPlaceholderMark("a", "#FFFFFF", "#060F33")
|
|
1321
|
-
},
|
|
1322
|
-
dark: {
|
|
1323
|
-
backgroundColor: "#0FA0EA",
|
|
1324
|
-
textColor: "#060F33",
|
|
1325
|
-
borderColor: "#0FA0EA",
|
|
1326
|
-
logoSvg: buildPlaceholderMark("a", "#060F33", "#FFFFFF")
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
},
|
|
1330
|
-
cashapp: {
|
|
1331
|
-
displayName: "Cash App Pay",
|
|
1332
|
-
currencies: ["usd"],
|
|
1333
|
-
countries: ["US"],
|
|
1334
|
-
// Cash App Pay cannot process a $0 (or sub-$0.50) charge — Stripe rejects
|
|
1335
|
-
// `amount_too_small`. Range per Stripe: USD 0.50 – 999,999.99. Keeps a
|
|
1336
|
-
// free-trial ($0 today) cart from surfacing a Cash App button.
|
|
1337
|
-
amounts: { usd: { min: 50, max: 99999999 } },
|
|
1338
|
-
needsExplicitConfirm: false,
|
|
1339
|
-
theme: {
|
|
1340
|
-
light: {
|
|
1341
|
-
backgroundColor: "#00D54B",
|
|
1342
|
-
textColor: "#0A1F0E",
|
|
1343
|
-
borderColor: "#00D54B",
|
|
1344
|
-
logoSvg: buildPlaceholderMark("$", "#0A1F0E", "#00D54B")
|
|
1345
|
-
},
|
|
1346
|
-
dark: {
|
|
1347
|
-
backgroundColor: "#00D54B",
|
|
1348
|
-
textColor: "#0A1F0E",
|
|
1349
|
-
borderColor: "#00D54B",
|
|
1350
|
-
logoSvg: buildPlaceholderMark("$", "#0A1F0E", "#00D54B")
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
},
|
|
1354
|
-
// ─── PaymentElement APMs: default (explicit Pay button) ─────────────────
|
|
1355
|
-
// These methods either render an inline form (IBAN, bank picker, …) or
|
|
1356
|
-
// ship with a Name input by default. Either way the buyer expects to
|
|
1357
|
-
// review and confirm with a deliberate click, so we surface a Pay button
|
|
1358
|
-
// and never auto-submit on a `change` event.
|
|
1359
|
-
afterpay_clearpay: {
|
|
1360
|
-
displayName: "Afterpay",
|
|
1361
|
-
currencies: ["usd", "aud", "cad", "gbp", "nzd"],
|
|
1362
|
-
countries: ["US", "CA", "GB", "AU", "NZ"],
|
|
1363
|
-
amounts: {
|
|
1364
|
-
usd: { min: 100, max: 2e5 },
|
|
1365
|
-
cad: { min: 100, max: 2e5 },
|
|
1366
|
-
gbp: { min: 100, max: 12e4 },
|
|
1367
|
-
aud: { min: 100, max: 2e5 },
|
|
1368
|
-
nzd: { min: 100, max: 2e5 }
|
|
1369
|
-
},
|
|
1370
|
-
// Afterpay's brand mint (#B2FCE4) with black wordmark/icon — the signature
|
|
1371
|
-
// palette from afterpay.com's brand system.
|
|
1372
|
-
theme: {
|
|
1373
|
-
light: {
|
|
1374
|
-
backgroundColor: "#B2FCE4",
|
|
1375
|
-
textColor: "#0A0B09",
|
|
1376
|
-
borderColor: "#B2FCE4",
|
|
1377
|
-
logoSvg: buildPlaceholderMark("A", "#0A0B09", "#B2FCE4")
|
|
1378
|
-
},
|
|
1379
|
-
dark: {
|
|
1380
|
-
backgroundColor: "#B2FCE4",
|
|
1381
|
-
textColor: "#0A0B09",
|
|
1382
|
-
borderColor: "#B2FCE4",
|
|
1383
|
-
logoSvg: buildPlaceholderMark("A", "#0A0B09", "#B2FCE4")
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
},
|
|
1387
|
-
alipay: {
|
|
1388
|
-
displayName: "Alipay",
|
|
1389
|
-
// Presentment currencies only — Alipay is offered to USD / CNY carts.
|
|
1390
|
-
currencies: ["usd", "cny"],
|
|
1391
|
-
theme: {
|
|
1392
|
-
light: {
|
|
1393
|
-
backgroundColor: "#1677FF",
|
|
1394
|
-
textColor: "#FFFFFF",
|
|
1395
|
-
borderColor: "#1677FF",
|
|
1396
|
-
logoSvg: buildPlaceholderMark("A", "#FFFFFF", "#1677FF")
|
|
1397
|
-
},
|
|
1398
|
-
dark: {
|
|
1399
|
-
backgroundColor: "#1677FF",
|
|
1400
|
-
textColor: "#FFFFFF",
|
|
1401
|
-
borderColor: "#1677FF",
|
|
1402
|
-
logoSvg: buildPlaceholderMark("A", "#FFFFFF", "#1677FF")
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
},
|
|
1406
|
-
au_becs_debit: { displayName: "BECS Direct Debit", currencies: ["aud"], countries: ["AU"] },
|
|
1407
|
-
bacs_debit: { displayName: "Bacs Debit", currencies: ["gbp"], countries: ["GB"] },
|
|
1408
|
-
bancontact: {
|
|
1409
|
-
displayName: "Bancontact",
|
|
1410
|
-
currencies: ["eur"],
|
|
1411
|
-
countries: ["BE"],
|
|
1412
|
-
theme: {
|
|
1413
|
-
light: {
|
|
1414
|
-
backgroundColor: "#FFDD55",
|
|
1415
|
-
textColor: "#1E3791",
|
|
1416
|
-
borderColor: "#FFDD55",
|
|
1417
|
-
logoSvg: buildPlaceholderMark("B", "#1E3791", "#FFDD55")
|
|
1418
|
-
},
|
|
1419
|
-
dark: {
|
|
1420
|
-
backgroundColor: "#1E3791",
|
|
1421
|
-
textColor: "#FFDD55",
|
|
1422
|
-
borderColor: "#1E3791",
|
|
1423
|
-
logoSvg: buildPlaceholderMark("B", "#FFDD55", "#1E3791")
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
},
|
|
1427
|
-
bizum: {
|
|
1428
|
-
displayName: "Bizum",
|
|
1429
|
-
currencies: ["eur"],
|
|
1430
|
-
countries: ["ES"],
|
|
1431
|
-
theme: {
|
|
1432
|
-
light: {
|
|
1433
|
-
backgroundColor: "#00BFB3",
|
|
1434
|
-
textColor: "#FFFFFF",
|
|
1435
|
-
borderColor: "#00BFB3",
|
|
1436
|
-
logoSvg: buildPlaceholderMark("B", "#FFFFFF", "#00BFB3")
|
|
1437
|
-
},
|
|
1438
|
-
dark: {
|
|
1439
|
-
backgroundColor: "#00BFB3",
|
|
1440
|
-
textColor: "#FFFFFF",
|
|
1441
|
-
borderColor: "#00BFB3",
|
|
1442
|
-
logoSvg: buildPlaceholderMark("B", "#FFFFFF", "#00BFB3")
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
},
|
|
1446
|
-
blik: {
|
|
1447
|
-
displayName: "BLIK",
|
|
1448
|
-
currencies: ["pln"],
|
|
1449
|
-
countries: ["PL"],
|
|
1450
|
-
theme: {
|
|
1451
|
-
light: {
|
|
1452
|
-
backgroundColor: "#000000",
|
|
1453
|
-
textColor: "#FFFFFF",
|
|
1454
|
-
borderColor: "#000000",
|
|
1455
|
-
logoSvg: buildPlaceholderMark("B", "#FFFFFF", "#000000")
|
|
1456
|
-
},
|
|
1457
|
-
dark: {
|
|
1458
|
-
backgroundColor: "#FFFFFF",
|
|
1459
|
-
textColor: "#000000",
|
|
1460
|
-
borderColor: "#FFFFFF",
|
|
1461
|
-
logoSvg: buildPlaceholderMark("B", "#000000", "#FFFFFF")
|
|
1462
|
-
}
|
|
1463
|
-
}
|
|
1464
|
-
},
|
|
1465
|
-
boleto: { displayName: "Boleto", currencies: ["brl"], countries: ["BR"] },
|
|
1466
|
-
customer_balance: {
|
|
1467
|
-
displayName: "Bank Transfer",
|
|
1468
|
-
currencies: ["eur", "usd"],
|
|
1469
|
-
countries: BANK_TRANSFER_COUNTRIES,
|
|
1470
|
-
theme: {
|
|
1471
|
-
light: {
|
|
1472
|
-
backgroundColor: "#1F2937",
|
|
1473
|
-
textColor: "#FFFFFF",
|
|
1474
|
-
borderColor: "#1F2937",
|
|
1475
|
-
logoSvg: buildBankMark("#1F2937", "#FFFFFF")
|
|
1476
|
-
},
|
|
1477
|
-
dark: {
|
|
1478
|
-
backgroundColor: "#374151",
|
|
1479
|
-
textColor: "#FFFFFF",
|
|
1480
|
-
borderColor: "#374151",
|
|
1481
|
-
logoSvg: buildBankMark("#374151", "#FFFFFF")
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
},
|
|
1485
|
-
eps: {
|
|
1486
|
-
displayName: "EPS",
|
|
1487
|
-
currencies: ["eur"],
|
|
1488
|
-
countries: ["AT"],
|
|
1489
|
-
theme: {
|
|
1490
|
-
light: {
|
|
1491
|
-
backgroundColor: "#C8102E",
|
|
1492
|
-
textColor: "#FFFFFF",
|
|
1493
|
-
borderColor: "#C8102E",
|
|
1494
|
-
logoSvg: buildPlaceholderMark("E", "#FFFFFF", "#C8102E")
|
|
1495
|
-
},
|
|
1496
|
-
dark: {
|
|
1497
|
-
backgroundColor: "#C8102E",
|
|
1498
|
-
textColor: "#FFFFFF",
|
|
1499
|
-
borderColor: "#C8102E",
|
|
1500
|
-
logoSvg: buildPlaceholderMark("E", "#FFFFFF", "#C8102E")
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
},
|
|
1504
|
-
giropay: {
|
|
1505
|
-
displayName: "Giropay",
|
|
1506
|
-
currencies: ["eur"],
|
|
1507
|
-
countries: ["DE"],
|
|
1508
|
-
theme: {
|
|
1509
|
-
light: {
|
|
1510
|
-
backgroundColor: "#0F4197",
|
|
1511
|
-
textColor: "#FFFFFF",
|
|
1512
|
-
borderColor: "#0F4197",
|
|
1513
|
-
logoSvg: buildPlaceholderMark("G", "#FFFFFF", "#0F4197")
|
|
1514
|
-
},
|
|
1515
|
-
dark: {
|
|
1516
|
-
backgroundColor: "#0F4197",
|
|
1517
|
-
textColor: "#FFFFFF",
|
|
1518
|
-
borderColor: "#0F4197",
|
|
1519
|
-
logoSvg: buildPlaceholderMark("G", "#FFFFFF", "#0F4197")
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
},
|
|
1523
|
-
ideal: {
|
|
1524
|
-
displayName: "iDEAL",
|
|
1525
|
-
currencies: ["eur"],
|
|
1526
|
-
countries: ["NL"],
|
|
1527
|
-
theme: {
|
|
1528
|
-
light: {
|
|
1529
|
-
backgroundColor: "#CC0066",
|
|
1530
|
-
textColor: "#FFFFFF",
|
|
1531
|
-
borderColor: "#CC0066",
|
|
1532
|
-
logoSvg: buildPlaceholderMark("i", "#FFFFFF", "#CC0066")
|
|
1533
|
-
},
|
|
1534
|
-
dark: {
|
|
1535
|
-
backgroundColor: "#CC0066",
|
|
1536
|
-
textColor: "#FFFFFF",
|
|
1537
|
-
borderColor: "#CC0066",
|
|
1538
|
-
logoSvg: buildPlaceholderMark("i", "#FFFFFF", "#CC0066")
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
},
|
|
1542
|
-
konbini: { displayName: "Konbini", currencies: ["jpy"], countries: ["JP"] },
|
|
1543
|
-
kr_card: {
|
|
1544
|
-
displayName: "Korean Card",
|
|
1545
|
-
currencies: ["krw"],
|
|
1546
|
-
countries: ["KR"],
|
|
1547
|
-
theme: {
|
|
1548
|
-
light: {
|
|
1549
|
-
backgroundColor: "#0B3D91",
|
|
1550
|
-
textColor: "#FFFFFF",
|
|
1551
|
-
borderColor: "#0B3D91",
|
|
1552
|
-
logoSvg: buildPlaceholderMark("K", "#FFFFFF", "#0B3D91")
|
|
1553
|
-
},
|
|
1554
|
-
dark: {
|
|
1555
|
-
backgroundColor: "#0B3D91",
|
|
1556
|
-
textColor: "#FFFFFF",
|
|
1557
|
-
borderColor: "#0B3D91",
|
|
1558
|
-
logoSvg: buildPlaceholderMark("K", "#FFFFFF", "#0B3D91")
|
|
1559
|
-
}
|
|
1560
|
-
}
|
|
1561
|
-
},
|
|
1562
|
-
multibanco: { displayName: "Multibanco", currencies: ["eur"], countries: ["PT"] },
|
|
1563
|
-
oxxo: { displayName: "OXXO", currencies: ["mxn"], countries: ["MX"] },
|
|
1564
|
-
p24: {
|
|
1565
|
-
displayName: "Przelewy24",
|
|
1566
|
-
currencies: ["eur", "pln"],
|
|
1567
|
-
countries: ["PL"],
|
|
1568
|
-
theme: {
|
|
1569
|
-
light: {
|
|
1570
|
-
backgroundColor: "#D90F1B",
|
|
1571
|
-
textColor: "#FFFFFF",
|
|
1572
|
-
borderColor: "#D90F1B",
|
|
1573
|
-
logoSvg: buildPlaceholderMark("P", "#FFFFFF", "#D90F1B")
|
|
1574
|
-
},
|
|
1575
|
-
dark: {
|
|
1576
|
-
backgroundColor: "#D90F1B",
|
|
1577
|
-
textColor: "#FFFFFF",
|
|
1578
|
-
borderColor: "#D90F1B",
|
|
1579
|
-
logoSvg: buildPlaceholderMark("P", "#FFFFFF", "#D90F1B")
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
},
|
|
1583
|
-
paynow: { displayName: "PayNow", currencies: ["sgd"], countries: ["SG"] },
|
|
1584
|
-
pix: { displayName: "Pix", currencies: ["brl"], countries: ["BR"] },
|
|
1585
|
-
promptpay: { displayName: "PromptPay", currencies: ["thb"], countries: ["TH"] },
|
|
1586
|
-
sepa_debit: {
|
|
1587
|
-
displayName: "SEPA Debit",
|
|
1588
|
-
currencies: ["eur"],
|
|
1589
|
-
countries: SEPA_COUNTRIES,
|
|
1590
|
-
theme: {
|
|
1591
|
-
// SEPA itself isn't a brand with a saturated palette — use a neutral
|
|
1592
|
-
// bank-blue that reads as "European bank transfer" without leaning
|
|
1593
|
-
// on a specific institution.
|
|
1594
|
-
light: {
|
|
1595
|
-
backgroundColor: "#10298E",
|
|
1596
|
-
textColor: "#FFFFFF",
|
|
1597
|
-
borderColor: "#10298E",
|
|
1598
|
-
logoSvg: buildPlaceholderMark("\u20AC", "#FFFFFF", "#10298E")
|
|
1599
|
-
},
|
|
1600
|
-
dark: {
|
|
1601
|
-
backgroundColor: "#3056D3",
|
|
1602
|
-
textColor: "#FFFFFF",
|
|
1603
|
-
borderColor: "#3056D3",
|
|
1604
|
-
logoSvg: buildPlaceholderMark("\u20AC", "#FFFFFF", "#3056D3")
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
},
|
|
1608
|
-
sofort: {
|
|
1609
|
-
displayName: "Sofort",
|
|
1610
|
-
currencies: ["eur"],
|
|
1611
|
-
countries: ["AT", "BE", "DE", "ES", "IT", "NL"],
|
|
1612
|
-
theme: {
|
|
1613
|
-
light: {
|
|
1614
|
-
backgroundColor: "#EF809F",
|
|
1615
|
-
textColor: "#FFFFFF",
|
|
1616
|
-
borderColor: "#EF809F",
|
|
1617
|
-
logoSvg: buildPlaceholderMark("S", "#FFFFFF", "#EF809F")
|
|
1618
|
-
},
|
|
1619
|
-
dark: {
|
|
1620
|
-
backgroundColor: "#EF809F",
|
|
1621
|
-
textColor: "#FFFFFF",
|
|
1622
|
-
borderColor: "#EF809F",
|
|
1623
|
-
logoSvg: buildPlaceholderMark("S", "#FFFFFF", "#EF809F")
|
|
1624
|
-
}
|
|
1625
|
-
}
|
|
1626
|
-
},
|
|
1627
|
-
upi: {
|
|
1628
|
-
displayName: "UPI",
|
|
1629
|
-
currencies: ["inr"],
|
|
1630
|
-
countries: ["IN"],
|
|
1631
|
-
theme: {
|
|
1632
|
-
light: {
|
|
1633
|
-
backgroundColor: "#FF7909",
|
|
1634
|
-
textColor: "#FFFFFF",
|
|
1635
|
-
borderColor: "#FF7909",
|
|
1636
|
-
logoSvg: buildPlaceholderMark("U", "#FFFFFF", "#FF7909")
|
|
1637
|
-
},
|
|
1638
|
-
dark: {
|
|
1639
|
-
backgroundColor: "#FF7909",
|
|
1640
|
-
textColor: "#FFFFFF",
|
|
1641
|
-
borderColor: "#FF7909",
|
|
1642
|
-
logoSvg: buildPlaceholderMark("U", "#FFFFFF", "#FF7909")
|
|
1643
|
-
}
|
|
1644
|
-
}
|
|
1645
|
-
},
|
|
1646
|
-
us_bank_account: { displayName: "US Bank Account", currencies: ["usd"], countries: ["US"] },
|
|
1647
|
-
wechat_pay: {
|
|
1648
|
-
displayName: "WeChat Pay",
|
|
1649
|
-
// Presentment currencies only — WeChat Pay is offered to USD / CNY carts.
|
|
1650
|
-
currencies: ["usd", "cny"],
|
|
1651
|
-
theme: {
|
|
1652
|
-
light: {
|
|
1653
|
-
backgroundColor: "#07C160",
|
|
1654
|
-
textColor: "#FFFFFF",
|
|
1655
|
-
borderColor: "#07C160",
|
|
1656
|
-
logoSvg: buildPlaceholderMark("W", "#FFFFFF", "#07C160")
|
|
1657
|
-
},
|
|
1658
|
-
dark: {
|
|
1659
|
-
backgroundColor: "#07C160",
|
|
1660
|
-
textColor: "#FFFFFF",
|
|
1661
|
-
borderColor: "#07C160",
|
|
1662
|
-
logoSvg: buildPlaceholderMark("W", "#FFFFFF", "#07C160")
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
},
|
|
1666
|
-
zip: { displayName: "Zip", currencies: ["aud"], countries: ["AU", "NZ"] }
|
|
1667
|
-
};
|
|
1668
|
-
function hasVendoredStripeMethodLogo(type) {
|
|
1669
|
-
if (!type) return false;
|
|
1670
|
-
return VENDORED_LOGO_METHODS.includes(type);
|
|
1671
|
-
}
|
|
1672
|
-
var STRIPE_EXPRESS_METHODS = Object.entries(STRIPE_METHOD_MATRIX).filter(([, entry]) => entry.express).map(([key]) => key);
|
|
1673
|
-
var STRIPE_EXPRESS_METHODS_SET = new Set(STRIPE_EXPRESS_METHODS);
|
|
1674
|
-
var STRIPE_METHOD_CURRENCIES = Object.fromEntries(
|
|
1675
|
-
Object.entries(STRIPE_METHOD_MATRIX).map(([key, entry]) => [key, entry.currencies])
|
|
1676
|
-
);
|
|
1677
|
-
var STRIPE_METHOD_COUNTRIES = Object.fromEntries(
|
|
1678
|
-
Object.entries(STRIPE_METHOD_MATRIX).filter(([, entry]) => entry.countries).map(([key, entry]) => [key, entry.countries])
|
|
1679
|
-
);
|
|
1680
|
-
function getStripeMethodDisplayName(type) {
|
|
1681
|
-
if (!type) return "this method";
|
|
1682
|
-
const entry = STRIPE_METHOD_MATRIX[type];
|
|
1683
|
-
if (entry) return entry.displayName;
|
|
1684
|
-
return type.split("_").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
1685
|
-
}
|
|
1686
|
-
function needsStripeMethodExplicitConfirm(type) {
|
|
1687
|
-
if (!type) return true;
|
|
1688
|
-
const entry = STRIPE_METHOD_MATRIX[type];
|
|
1689
|
-
if (!entry) return true;
|
|
1690
|
-
return entry.needsExplicitConfirm !== false;
|
|
1691
|
-
}
|
|
1692
|
-
function resolveStripeMethodBrandVariant(type, themeId) {
|
|
1693
|
-
if (!type) return null;
|
|
1694
|
-
const entry = STRIPE_METHOD_MATRIX[type];
|
|
1695
|
-
if (!entry?.theme) return null;
|
|
1696
|
-
const isDark = typeof themeId === "string" && themeId.endsWith("-dark");
|
|
1697
|
-
return (isDark ? entry.theme.dark : entry.theme.light) ?? entry.theme.light ?? null;
|
|
1698
|
-
}
|
|
1699
|
-
function filterStripeMethodsByCurrency(methods, currency) {
|
|
1700
|
-
if (!methods?.length) return [];
|
|
1701
|
-
if (!currency) return [...methods];
|
|
1702
|
-
const target = currency.trim().toLowerCase();
|
|
1703
|
-
if (!target) return [...methods];
|
|
1704
|
-
return methods.filter((method) => {
|
|
1705
|
-
const supported = STRIPE_METHOD_CURRENCIES[method];
|
|
1706
|
-
if (!supported) return true;
|
|
1707
|
-
return supported.includes("*") || supported.includes(target);
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
function filterStripeMethodsByCountry(methods, country) {
|
|
1711
|
-
if (!methods?.length) return [];
|
|
1712
|
-
if (!country) return [...methods];
|
|
1713
|
-
const target = country.trim().toUpperCase();
|
|
1714
|
-
if (!target) return [...methods];
|
|
1715
|
-
return methods.filter((method) => {
|
|
1716
|
-
const supported = STRIPE_METHOD_COUNTRIES[method];
|
|
1717
|
-
if (!supported) return true;
|
|
1718
|
-
return supported.includes("*") || supported.includes(target);
|
|
1719
|
-
});
|
|
1720
|
-
}
|
|
1721
|
-
var STRIPE_METHOD_AMOUNT_LIMITS = Object.fromEntries(
|
|
1722
|
-
Object.entries(STRIPE_METHOD_MATRIX).filter(([, entry]) => entry.amounts).map(([key, entry]) => [key, entry.amounts])
|
|
1723
|
-
);
|
|
1724
|
-
function filterStripeMethodsByAmount(methods, currency, amountInMinorUnits) {
|
|
1725
|
-
if (!methods?.length) return [];
|
|
1726
|
-
if (!currency || typeof amountInMinorUnits !== "number" || !Number.isFinite(amountInMinorUnits)) {
|
|
1727
|
-
return [...methods];
|
|
1728
|
-
}
|
|
1729
|
-
const target = currency.trim().toLowerCase();
|
|
1730
|
-
if (!target) return [...methods];
|
|
1731
|
-
return methods.filter((method) => {
|
|
1732
|
-
const perCurrency = STRIPE_METHOD_AMOUNT_LIMITS[method];
|
|
1733
|
-
if (!perCurrency) return true;
|
|
1734
|
-
const limits = perCurrency[target];
|
|
1735
|
-
if (!limits) return true;
|
|
1736
|
-
if (typeof limits.min === "number" && amountInMinorUnits < limits.min) return false;
|
|
1737
|
-
if (typeof limits.max === "number" && amountInMinorUnits > limits.max) return false;
|
|
1738
|
-
return true;
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
function partitionStripeMethods(enabledPaymentMethods, options) {
|
|
1742
|
-
if (!enabledPaymentMethods?.length) {
|
|
1743
|
-
return { expressMethods: [], paymentElementMethods: [] };
|
|
1744
|
-
}
|
|
1745
|
-
const expressMethods = [];
|
|
1746
|
-
const paymentElementMethods = [];
|
|
1747
|
-
const seenExpress = /* @__PURE__ */ new Set();
|
|
1748
|
-
const seenElement = /* @__PURE__ */ new Set();
|
|
1749
|
-
for (const raw of enabledPaymentMethods) {
|
|
1750
|
-
if (typeof raw !== "string") continue;
|
|
1751
|
-
const method = raw.trim();
|
|
1752
|
-
if (!method || method === "card") continue;
|
|
1753
|
-
if (options?.excludePaypal && method === "paypal") continue;
|
|
1754
|
-
if (STRIPE_EXPRESS_METHODS_SET.has(method)) {
|
|
1755
|
-
if (seenExpress.has(method)) continue;
|
|
1756
|
-
seenExpress.add(method);
|
|
1757
|
-
expressMethods.push(method);
|
|
1758
|
-
} else {
|
|
1759
|
-
if (seenElement.has(method)) continue;
|
|
1760
|
-
seenElement.add(method);
|
|
1761
|
-
paymentElementMethods.push(method);
|
|
1762
|
-
}
|
|
1763
|
-
}
|
|
1764
|
-
return { expressMethods, paymentElementMethods };
|
|
1765
|
-
}
|
|
1766
|
-
var ELEMENT_TYPES = [
|
|
1767
|
-
"payment",
|
|
1768
|
-
"address"
|
|
1769
|
-
];
|
|
1770
|
-
var SUPPORTED_CARD_BRANDS = [
|
|
1771
|
-
"visa",
|
|
1772
|
-
"mastercard",
|
|
1773
|
-
"mastercard_debit",
|
|
1774
|
-
"amex",
|
|
1775
|
-
"discover"
|
|
1776
|
-
];
|
|
1777
|
-
var CURRENCY_MAP = {
|
|
1778
|
-
// EUR (VAT applies)
|
|
1779
|
-
AT: { currency: "EUR", symbol: "\u20AC", country: "Austria", countryCode: "AT", tax: 1 },
|
|
1780
|
-
BE: { currency: "EUR", symbol: "\u20AC", country: "Belgium", countryCode: "BE", tax: 1 },
|
|
1781
|
-
CY: { currency: "EUR", symbol: "\u20AC", country: "Cyprus", countryCode: "CY", tax: 1 },
|
|
1782
|
-
DE: { currency: "EUR", symbol: "\u20AC", country: "Germany", countryCode: "DE", tax: 1 },
|
|
1783
|
-
EE: { currency: "EUR", symbol: "\u20AC", country: "Estonia", countryCode: "EE", tax: 1 },
|
|
1784
|
-
ES: { currency: "EUR", symbol: "\u20AC", country: "Spain", countryCode: "ES", tax: 1 },
|
|
1785
|
-
FI: { currency: "EUR", symbol: "\u20AC", country: "Finland", countryCode: "FI", tax: 1 },
|
|
1786
|
-
FR: { currency: "EUR", symbol: "\u20AC", country: "France", countryCode: "FR", tax: 1 },
|
|
1787
|
-
GR: { currency: "EUR", symbol: "\u20AC", country: "Greece", countryCode: "GR", tax: 1 },
|
|
1788
|
-
HR: { currency: "EUR", symbol: "\u20AC", country: "Croatia", countryCode: "HR", tax: 1 },
|
|
1789
|
-
IE: { currency: "EUR", symbol: "\u20AC", country: "Ireland", countryCode: "IE", tax: 1 },
|
|
1790
|
-
IT: { currency: "EUR", symbol: "\u20AC", country: "Italy", countryCode: "IT", tax: 1 },
|
|
1791
|
-
LT: { currency: "EUR", symbol: "\u20AC", country: "Lithuania", countryCode: "LT", tax: 1 },
|
|
1792
|
-
LU: { currency: "EUR", symbol: "\u20AC", country: "Luxembourg", countryCode: "LU", tax: 1 },
|
|
1793
|
-
LV: { currency: "EUR", symbol: "\u20AC", country: "Latvia", countryCode: "LV", tax: 1 },
|
|
1794
|
-
MT: { currency: "EUR", symbol: "\u20AC", country: "Malta", countryCode: "MT", tax: 1 },
|
|
1795
|
-
NL: { currency: "EUR", symbol: "\u20AC", country: "Netherlands", countryCode: "NL", tax: 1 },
|
|
1796
|
-
PT: { currency: "EUR", symbol: "\u20AC", country: "Portugal", countryCode: "PT", tax: 1 },
|
|
1797
|
-
SI: { currency: "EUR", symbol: "\u20AC", country: "Slovenia", countryCode: "SI", tax: 1 },
|
|
1798
|
-
SK: { currency: "EUR", symbol: "\u20AC", country: "Slovakia", countryCode: "SK", tax: 1 },
|
|
1799
|
-
BG: { currency: "EUR", symbol: "\u20AC", country: "Bulgaria", countryCode: "BG", tax: 1 },
|
|
1800
|
-
RO: { currency: "EUR", symbol: "\u20AC", country: "Romania", countryCode: "RO", tax: 1 },
|
|
1801
|
-
CZ: { currency: "EUR", symbol: "\u20AC", country: "Czech Republic", countryCode: "CZ", tax: 1 },
|
|
1802
|
-
SE: { currency: "EUR", symbol: "\u20AC", country: "Sweden", countryCode: "SE", tax: 1 },
|
|
1803
|
-
DK: { currency: "EUR", symbol: "\u20AC", country: "Denmark", countryCode: "DK", tax: 1 },
|
|
1804
|
-
PL: { currency: "EUR", symbol: "\u20AC", country: "Poland", countryCode: "PL", tax: 1 },
|
|
1805
|
-
HU: { currency: "EUR", symbol: "\u20AC", country: "Hungary", countryCode: "HU", tax: 1 },
|
|
1806
|
-
// GBP (VAT applies)
|
|
1807
|
-
GB: { currency: "GBP", symbol: "\xA3", country: "United Kingdom", countryCode: "GB", tax: 1 },
|
|
1808
|
-
// USD (no VAT)
|
|
1809
|
-
US: { currency: "USD", symbol: "$", country: "United States", countryCode: "US", tax: 0 },
|
|
1810
|
-
// CAD (no VAT)
|
|
1811
|
-
CA: { currency: "CAD", symbol: "CA$", country: "Canada", countryCode: "CA", tax: 0 },
|
|
1812
|
-
// NZD (no VAT)
|
|
1813
|
-
NZ: { currency: "NZD", symbol: "NZ$", country: "New Zealand", countryCode: "NZ", tax: 0 },
|
|
1814
|
-
// AUD (no VAT)
|
|
1815
|
-
AU: { currency: "AUD", symbol: "AU$", country: "Australia", countryCode: "AU", tax: 0 }
|
|
1816
|
-
};
|
|
1817
|
-
var DEFAULT_CURRENCY = {
|
|
1818
|
-
currency: "USD",
|
|
1819
|
-
symbol: "$",
|
|
1820
|
-
country: "United States",
|
|
1821
|
-
countryCode: "US",
|
|
1822
|
-
tax: 0
|
|
1823
|
-
};
|
|
1824
|
-
function getPostalCodeLabel(countryCode) {
|
|
1825
|
-
switch (countryCode.toUpperCase()) {
|
|
1826
|
-
case "US":
|
|
1827
|
-
return "ZIP Code";
|
|
1828
|
-
case "GB":
|
|
1829
|
-
return "Postcode";
|
|
1830
|
-
case "CA":
|
|
1831
|
-
return "Postal Code";
|
|
1832
|
-
case "AU":
|
|
1833
|
-
case "NZ":
|
|
1834
|
-
return "Postcode";
|
|
1835
|
-
case "IE":
|
|
1836
|
-
return "Eircode";
|
|
1837
|
-
default:
|
|
1838
|
-
return "Postal Code";
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
var regionNames = new Intl.DisplayNames(["en"], { type: "region" });
|
|
1842
|
-
function codeToFlag(code) {
|
|
1843
|
-
return [...code.toUpperCase()].map((c) => String.fromCodePoint(127462 - 65 + c.charCodeAt(0))).join("");
|
|
1844
|
-
}
|
|
1845
|
-
var PRIORITY_CODES = ["US", "GB", "CA", "AU", "NZ", "IE", "DE", "FR"];
|
|
1846
|
-
var ALL_CODES = [
|
|
1847
|
-
"AD",
|
|
1848
|
-
"AE",
|
|
1849
|
-
"AF",
|
|
1850
|
-
"AG",
|
|
1851
|
-
"AL",
|
|
1852
|
-
"AM",
|
|
1853
|
-
"AO",
|
|
1854
|
-
"AR",
|
|
1855
|
-
"AT",
|
|
1856
|
-
"AU",
|
|
1857
|
-
"AZ",
|
|
1858
|
-
"BA",
|
|
1859
|
-
"BB",
|
|
1860
|
-
"BD",
|
|
1861
|
-
"BE",
|
|
1862
|
-
"BF",
|
|
1863
|
-
"BG",
|
|
1864
|
-
"BH",
|
|
1865
|
-
"BI",
|
|
1866
|
-
"BJ",
|
|
1867
|
-
"BN",
|
|
1868
|
-
"BO",
|
|
1869
|
-
"BR",
|
|
1870
|
-
"BS",
|
|
1871
|
-
"BT",
|
|
1872
|
-
"BW",
|
|
1873
|
-
"BY",
|
|
1874
|
-
"BZ",
|
|
1875
|
-
"CA",
|
|
1876
|
-
"CD",
|
|
1877
|
-
"CF",
|
|
1878
|
-
"CG",
|
|
1879
|
-
"CH",
|
|
1880
|
-
"CI",
|
|
1881
|
-
"CL",
|
|
1882
|
-
"CM",
|
|
1883
|
-
"CN",
|
|
1884
|
-
"CO",
|
|
1885
|
-
"CR",
|
|
1886
|
-
"CU",
|
|
1887
|
-
"CV",
|
|
1888
|
-
"CY",
|
|
1889
|
-
"CZ",
|
|
1890
|
-
"DE",
|
|
1891
|
-
"DJ",
|
|
1892
|
-
"DK",
|
|
1893
|
-
"DM",
|
|
1894
|
-
"DO",
|
|
1895
|
-
"DZ",
|
|
1896
|
-
"EC",
|
|
1897
|
-
"EE",
|
|
1898
|
-
"EG",
|
|
1899
|
-
"ER",
|
|
1900
|
-
"ES",
|
|
1901
|
-
"ET",
|
|
1902
|
-
"FI",
|
|
1903
|
-
"FJ",
|
|
1904
|
-
"FM",
|
|
1905
|
-
"FR",
|
|
1906
|
-
"GA",
|
|
1907
|
-
"GB",
|
|
1908
|
-
"GD",
|
|
1909
|
-
"GE",
|
|
1910
|
-
"GH",
|
|
1911
|
-
"GM",
|
|
1912
|
-
"GN",
|
|
1913
|
-
"GQ",
|
|
1914
|
-
"GR",
|
|
1915
|
-
"GT",
|
|
1916
|
-
"GW",
|
|
1917
|
-
"GY",
|
|
1918
|
-
"HN",
|
|
1919
|
-
"HR",
|
|
1920
|
-
"HT",
|
|
1921
|
-
"HU",
|
|
1922
|
-
"ID",
|
|
1923
|
-
"IE",
|
|
1924
|
-
"IL",
|
|
1925
|
-
"IN",
|
|
1926
|
-
"IQ",
|
|
1927
|
-
"IR",
|
|
1928
|
-
"IS",
|
|
1929
|
-
"IT",
|
|
1930
|
-
"JM",
|
|
1931
|
-
"JO",
|
|
1932
|
-
"JP",
|
|
1933
|
-
"KE",
|
|
1934
|
-
"KG",
|
|
1935
|
-
"KH",
|
|
1936
|
-
"KI",
|
|
1937
|
-
"KM",
|
|
1938
|
-
"KN",
|
|
1939
|
-
"KR",
|
|
1940
|
-
"KW",
|
|
1941
|
-
"KZ",
|
|
1942
|
-
"LA",
|
|
1943
|
-
"LB",
|
|
1944
|
-
"LC",
|
|
1945
|
-
"LI",
|
|
1946
|
-
"LK",
|
|
1947
|
-
"LR",
|
|
1948
|
-
"LS",
|
|
1949
|
-
"LT",
|
|
1950
|
-
"LU",
|
|
1951
|
-
"LV",
|
|
1952
|
-
"LY",
|
|
1953
|
-
"MA",
|
|
1954
|
-
"MC",
|
|
1955
|
-
"MD",
|
|
1956
|
-
"ME",
|
|
1957
|
-
"MG",
|
|
1958
|
-
"MH",
|
|
1959
|
-
"MK",
|
|
1960
|
-
"ML",
|
|
1961
|
-
"MM",
|
|
1962
|
-
"MN",
|
|
1963
|
-
"MR",
|
|
1964
|
-
"MT",
|
|
1965
|
-
"MU",
|
|
1966
|
-
"MV",
|
|
1967
|
-
"MW",
|
|
1968
|
-
"MX",
|
|
1969
|
-
"MY",
|
|
1970
|
-
"MZ",
|
|
1971
|
-
"NA",
|
|
1972
|
-
"NE",
|
|
1973
|
-
"NG",
|
|
1974
|
-
"NI",
|
|
1975
|
-
"NL",
|
|
1976
|
-
"NO",
|
|
1977
|
-
"NP",
|
|
1978
|
-
"NR",
|
|
1979
|
-
"NZ",
|
|
1980
|
-
"OM",
|
|
1981
|
-
"PA",
|
|
1982
|
-
"PE",
|
|
1983
|
-
"PG",
|
|
1984
|
-
"PH",
|
|
1985
|
-
"PK",
|
|
1986
|
-
"PL",
|
|
1987
|
-
"PT",
|
|
1988
|
-
"PW",
|
|
1989
|
-
"PY",
|
|
1990
|
-
"QA",
|
|
1991
|
-
"RO",
|
|
1992
|
-
"RS",
|
|
1993
|
-
"RU",
|
|
1994
|
-
"RW",
|
|
1995
|
-
"SA",
|
|
1996
|
-
"SB",
|
|
1997
|
-
"SC",
|
|
1998
|
-
"SD",
|
|
1999
|
-
"SE",
|
|
2000
|
-
"SG",
|
|
2001
|
-
"SI",
|
|
2002
|
-
"SK",
|
|
2003
|
-
"SL",
|
|
2004
|
-
"SM",
|
|
2005
|
-
"SN",
|
|
2006
|
-
"SO",
|
|
2007
|
-
"SR",
|
|
2008
|
-
"SS",
|
|
2009
|
-
"ST",
|
|
2010
|
-
"SV",
|
|
2011
|
-
"SY",
|
|
2012
|
-
"SZ",
|
|
2013
|
-
"TD",
|
|
2014
|
-
"TG",
|
|
2015
|
-
"TH",
|
|
2016
|
-
"TJ",
|
|
2017
|
-
"TL",
|
|
2018
|
-
"TM",
|
|
2019
|
-
"TN",
|
|
2020
|
-
"TO",
|
|
2021
|
-
"TR",
|
|
2022
|
-
"TT",
|
|
2023
|
-
"TV",
|
|
2024
|
-
"TW",
|
|
2025
|
-
"TZ",
|
|
2026
|
-
"UA",
|
|
2027
|
-
"UG",
|
|
2028
|
-
"US",
|
|
2029
|
-
"UY",
|
|
2030
|
-
"UZ",
|
|
2031
|
-
"VA",
|
|
2032
|
-
"VC",
|
|
2033
|
-
"VE",
|
|
2034
|
-
"VN",
|
|
2035
|
-
"VU",
|
|
2036
|
-
"WS",
|
|
2037
|
-
"XK",
|
|
2038
|
-
"YE",
|
|
2039
|
-
"ZA",
|
|
2040
|
-
"ZM",
|
|
2041
|
-
"ZW"
|
|
2042
|
-
];
|
|
2043
|
-
function buildCountryOption(code) {
|
|
2044
|
-
return { code, name: regionNames.of(code) ?? code, flag: codeToFlag(code) };
|
|
2045
|
-
}
|
|
2046
|
-
var prioritySet = new Set(PRIORITY_CODES);
|
|
2047
|
-
var rest = ALL_CODES.filter((c) => !prioritySet.has(c));
|
|
2048
|
-
var COUNTRY_OPTIONS = [
|
|
2049
|
-
...PRIORITY_CODES.map(buildCountryOption),
|
|
2050
|
-
...rest.map(buildCountryOption)
|
|
2051
|
-
];
|
|
2052
|
-
function getCountryByCode(code) {
|
|
2053
|
-
return COUNTRY_OPTIONS.find((c) => c.code === code);
|
|
2054
|
-
}
|
|
2055
|
-
var DEFAULT_AVS_CONFIG = {
|
|
2056
|
-
country: true,
|
|
2057
|
-
postal_code: true
|
|
2058
|
-
};
|
|
2059
|
-
function resolveAVSConfig(enableAVS) {
|
|
2060
|
-
if (!enableAVS) return null;
|
|
2061
|
-
if (enableAVS === true) return DEFAULT_AVS_CONFIG;
|
|
2062
|
-
return enableAVS;
|
|
2063
|
-
}
|
|
2064
|
-
function isAVSFieldVisible(field, country) {
|
|
2065
|
-
if (field === void 0 || field === false) return false;
|
|
2066
|
-
if (field === true) return true;
|
|
2067
|
-
const normalizedCountry = country.trim().toUpperCase();
|
|
2068
|
-
return field.some((code) => code.trim().toUpperCase() === normalizedCountry);
|
|
2069
|
-
}
|
|
2070
|
-
function isAVSEnabled(enableAVS) {
|
|
2071
|
-
const config = resolveAVSConfig(enableAVS);
|
|
2072
|
-
if (!config) return false;
|
|
2073
|
-
return Object.values(config).some(
|
|
2074
|
-
(v) => v === true || Array.isArray(v) && v.length > 0
|
|
2075
|
-
);
|
|
2076
|
-
}
|
|
2077
|
-
var US_STATES = [
|
|
2078
|
-
{ code: "AL", name: "Alabama" },
|
|
2079
|
-
{ code: "AK", name: "Alaska" },
|
|
2080
|
-
{ code: "AZ", name: "Arizona" },
|
|
2081
|
-
{ code: "AR", name: "Arkansas" },
|
|
2082
|
-
{ code: "CA", name: "California" },
|
|
2083
|
-
{ code: "CO", name: "Colorado" },
|
|
2084
|
-
{ code: "CT", name: "Connecticut" },
|
|
2085
|
-
{ code: "DE", name: "Delaware" },
|
|
2086
|
-
{ code: "DC", name: "District of Columbia" },
|
|
2087
|
-
{ code: "FL", name: "Florida" },
|
|
2088
|
-
{ code: "GA", name: "Georgia" },
|
|
2089
|
-
{ code: "HI", name: "Hawaii" },
|
|
2090
|
-
{ code: "ID", name: "Idaho" },
|
|
2091
|
-
{ code: "IL", name: "Illinois" },
|
|
2092
|
-
{ code: "IN", name: "Indiana" },
|
|
2093
|
-
{ code: "IA", name: "Iowa" },
|
|
2094
|
-
{ code: "KS", name: "Kansas" },
|
|
2095
|
-
{ code: "KY", name: "Kentucky" },
|
|
2096
|
-
{ code: "LA", name: "Louisiana" },
|
|
2097
|
-
{ code: "ME", name: "Maine" },
|
|
2098
|
-
{ code: "MD", name: "Maryland" },
|
|
2099
|
-
{ code: "MA", name: "Massachusetts" },
|
|
2100
|
-
{ code: "MI", name: "Michigan" },
|
|
2101
|
-
{ code: "MN", name: "Minnesota" },
|
|
2102
|
-
{ code: "MS", name: "Mississippi" },
|
|
2103
|
-
{ code: "MO", name: "Missouri" },
|
|
2104
|
-
{ code: "MT", name: "Montana" },
|
|
2105
|
-
{ code: "NE", name: "Nebraska" },
|
|
2106
|
-
{ code: "NV", name: "Nevada" },
|
|
2107
|
-
{ code: "NH", name: "New Hampshire" },
|
|
2108
|
-
{ code: "NJ", name: "New Jersey" },
|
|
2109
|
-
{ code: "NM", name: "New Mexico" },
|
|
2110
|
-
{ code: "NY", name: "New York" },
|
|
2111
|
-
{ code: "NC", name: "North Carolina" },
|
|
2112
|
-
{ code: "ND", name: "North Dakota" },
|
|
2113
|
-
{ code: "OH", name: "Ohio" },
|
|
2114
|
-
{ code: "OK", name: "Oklahoma" },
|
|
2115
|
-
{ code: "OR", name: "Oregon" },
|
|
2116
|
-
{ code: "PA", name: "Pennsylvania" },
|
|
2117
|
-
{ code: "RI", name: "Rhode Island" },
|
|
2118
|
-
{ code: "SC", name: "South Carolina" },
|
|
2119
|
-
{ code: "SD", name: "South Dakota" },
|
|
2120
|
-
{ code: "TN", name: "Tennessee" },
|
|
2121
|
-
{ code: "TX", name: "Texas" },
|
|
2122
|
-
{ code: "UT", name: "Utah" },
|
|
2123
|
-
{ code: "VT", name: "Vermont" },
|
|
2124
|
-
{ code: "VA", name: "Virginia" },
|
|
2125
|
-
{ code: "WA", name: "Washington" },
|
|
2126
|
-
{ code: "WV", name: "West Virginia" },
|
|
2127
|
-
{ code: "WI", name: "Wisconsin" },
|
|
2128
|
-
{ code: "WY", name: "Wyoming" }
|
|
2129
|
-
];
|
|
2130
|
-
var CA_PROVINCES = [
|
|
2131
|
-
{ code: "AB", name: "Alberta" },
|
|
2132
|
-
{ code: "BC", name: "British Columbia" },
|
|
2133
|
-
{ code: "MB", name: "Manitoba" },
|
|
2134
|
-
{ code: "NB", name: "New Brunswick" },
|
|
2135
|
-
{ code: "NL", name: "Newfoundland and Labrador" },
|
|
2136
|
-
{ code: "NS", name: "Nova Scotia" },
|
|
2137
|
-
{ code: "NT", name: "Northwest Territories" },
|
|
2138
|
-
{ code: "NU", name: "Nunavut" },
|
|
2139
|
-
{ code: "ON", name: "Ontario" },
|
|
2140
|
-
{ code: "PE", name: "Prince Edward Island" },
|
|
2141
|
-
{ code: "QC", name: "Quebec" },
|
|
2142
|
-
{ code: "SK", name: "Saskatchewan" },
|
|
2143
|
-
{ code: "YT", name: "Yukon" }
|
|
2144
|
-
];
|
|
2145
|
-
function getStateOptions(country) {
|
|
2146
|
-
switch (country.toUpperCase()) {
|
|
2147
|
-
case "US":
|
|
2148
|
-
return US_STATES;
|
|
2149
|
-
case "CA":
|
|
2150
|
-
return CA_PROVINCES;
|
|
2151
|
-
default:
|
|
2152
|
-
return null;
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
function getStateLabel(countryCode) {
|
|
2156
|
-
switch (countryCode.toUpperCase()) {
|
|
2157
|
-
case "US":
|
|
2158
|
-
return "State";
|
|
2159
|
-
case "CA":
|
|
2160
|
-
return "Province";
|
|
2161
|
-
case "GB":
|
|
2162
|
-
return "County";
|
|
2163
|
-
case "AU":
|
|
2164
|
-
return "State / Territory";
|
|
2165
|
-
default:
|
|
2166
|
-
return "State / Province / Region";
|
|
2167
|
-
}
|
|
2168
|
-
}
|
|
2169
|
-
|
|
2170
|
-
// src/postal-code-lookup.ts
|
|
2171
|
-
var US_ZIP_PREFIX_RANGES = [
|
|
2172
|
-
[5, 5, "NY"],
|
|
2173
|
-
[10, 27, "MA"],
|
|
2174
|
-
[28, 29, "RI"],
|
|
2175
|
-
[30, 38, "NH"],
|
|
2176
|
-
[39, 49, "ME"],
|
|
2177
|
-
[50, 59, "VT"],
|
|
2178
|
-
[60, 69, "CT"],
|
|
2179
|
-
[70, 89, "NJ"],
|
|
2180
|
-
[100, 149, "NY"],
|
|
2181
|
-
[150, 196, "PA"],
|
|
2182
|
-
[197, 199, "DE"],
|
|
2183
|
-
[200, 205, "DC"],
|
|
2184
|
-
[206, 219, "MD"],
|
|
2185
|
-
[220, 246, "VA"],
|
|
2186
|
-
[247, 268, "WV"],
|
|
2187
|
-
[270, 289, "NC"],
|
|
2188
|
-
[290, 299, "SC"],
|
|
2189
|
-
[300, 319, "GA"],
|
|
2190
|
-
[320, 349, "FL"],
|
|
2191
|
-
[350, 369, "AL"],
|
|
2192
|
-
[370, 385, "TN"],
|
|
2193
|
-
[386, 397, "MS"],
|
|
2194
|
-
[398, 399, "GA"],
|
|
2195
|
-
[400, 427, "KY"],
|
|
2196
|
-
[430, 459, "OH"],
|
|
2197
|
-
[460, 479, "IN"],
|
|
2198
|
-
[480, 499, "MI"],
|
|
2199
|
-
[500, 528, "IA"],
|
|
2200
|
-
[530, 549, "WI"],
|
|
2201
|
-
[550, 567, "MN"],
|
|
2202
|
-
[570, 577, "SD"],
|
|
2203
|
-
[580, 588, "ND"],
|
|
2204
|
-
[590, 599, "MT"],
|
|
2205
|
-
[600, 629, "IL"],
|
|
2206
|
-
[630, 658, "MO"],
|
|
2207
|
-
[660, 679, "KS"],
|
|
2208
|
-
[680, 693, "NE"],
|
|
2209
|
-
[700, 714, "LA"],
|
|
2210
|
-
[716, 729, "AR"],
|
|
2211
|
-
[730, 749, "OK"],
|
|
2212
|
-
[750, 799, "TX"],
|
|
2213
|
-
[800, 816, "CO"],
|
|
2214
|
-
[820, 831, "WY"],
|
|
2215
|
-
[832, 838, "ID"],
|
|
2216
|
-
[840, 847, "UT"],
|
|
2217
|
-
[850, 865, "AZ"],
|
|
2218
|
-
[870, 884, "NM"],
|
|
2219
|
-
[889, 898, "NV"],
|
|
2220
|
-
[900, 961, "CA"],
|
|
2221
|
-
[967, 968, "HI"],
|
|
2222
|
-
[970, 979, "OR"],
|
|
2223
|
-
[980, 994, "WA"],
|
|
2224
|
-
[995, 999, "AK"]
|
|
2225
|
-
];
|
|
2226
|
-
var CA_FSA_FIRST_LETTER_TO_PROVINCE = {
|
|
2227
|
-
A: "NL",
|
|
2228
|
-
B: "NS",
|
|
2229
|
-
C: "PE",
|
|
2230
|
-
E: "NB",
|
|
2231
|
-
G: "QC",
|
|
2232
|
-
H: "QC",
|
|
2233
|
-
J: "QC",
|
|
2234
|
-
K: "ON",
|
|
2235
|
-
L: "ON",
|
|
2236
|
-
M: "ON",
|
|
2237
|
-
N: "ON",
|
|
2238
|
-
P: "ON",
|
|
2239
|
-
R: "MB",
|
|
2240
|
-
S: "SK",
|
|
2241
|
-
T: "AB",
|
|
2242
|
-
V: "BC",
|
|
2243
|
-
X: "NT",
|
|
2244
|
-
Y: "YT"
|
|
2245
|
-
};
|
|
2246
|
-
function deriveUsState(zip) {
|
|
2247
|
-
const digits = zip.replace(/\D/g, "");
|
|
2248
|
-
if (digits.length < 5) return null;
|
|
2249
|
-
const prefix = Number.parseInt(digits.slice(0, 3), 10);
|
|
2250
|
-
if (!Number.isFinite(prefix)) return null;
|
|
2251
|
-
for (const [start, end, code] of US_ZIP_PREFIX_RANGES) {
|
|
2252
|
-
if (prefix >= start && prefix <= end) return code;
|
|
2253
|
-
}
|
|
2254
|
-
return null;
|
|
2255
|
-
}
|
|
2256
|
-
function deriveCaProvince(postalCode) {
|
|
2257
|
-
const compact = postalCode.replace(/\s+/g, "").toUpperCase();
|
|
2258
|
-
if (!/^[A-Z]\d[A-Z]\d[A-Z]\d$/.test(compact)) return null;
|
|
2259
|
-
const firstLetter = compact[0] ?? "";
|
|
2260
|
-
return CA_FSA_FIRST_LETTER_TO_PROVINCE[firstLetter] ?? null;
|
|
2261
|
-
}
|
|
2262
|
-
function getStateFromPostalCode(country, postalCode) {
|
|
2263
|
-
if (!country || !postalCode) return null;
|
|
2264
|
-
const normalizedCountry = country.trim().toUpperCase();
|
|
2265
|
-
const normalizedZip = postalCode.trim();
|
|
2266
|
-
if (!normalizedZip) return null;
|
|
2267
|
-
switch (normalizedCountry) {
|
|
2268
|
-
case "US":
|
|
2269
|
-
return deriveUsState(normalizedZip);
|
|
2270
|
-
case "CA":
|
|
2271
|
-
return deriveCaProvince(normalizedZip);
|
|
2272
|
-
default:
|
|
2273
|
-
return null;
|
|
2274
|
-
}
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
// src/postal-code-validation.ts
|
|
2278
|
-
var isPostalCodeModule = __toESM(require("validator/lib/isPostalCode.js"), 1);
|
|
2279
|
-
var mod = isPostalCodeModule;
|
|
2280
|
-
var isPostalCode = typeof mod.default === "function" ? mod.default : mod.default?.default;
|
|
2281
|
-
if (typeof isPostalCode !== "function") {
|
|
2282
|
-
throw new Error(
|
|
2283
|
-
"validator/lib/isPostalCode.js interop failed: unexpected module shape. This likely means the bundler's CJS/ESM interop changed."
|
|
2284
|
-
);
|
|
2285
|
-
}
|
|
2286
|
-
var SUPPORTED_LOCALES = new Set(
|
|
2287
|
-
mod.locales.map((code) => code.toUpperCase())
|
|
2288
|
-
);
|
|
2289
|
-
var COUNTRY_ALIASES = {
|
|
2290
|
-
AUSTRALIA: "AU",
|
|
2291
|
-
BRAZIL: "BR",
|
|
2292
|
-
CANADA: "CA",
|
|
2293
|
-
CH: "CH",
|
|
2294
|
-
DENMARK: "DK",
|
|
2295
|
-
DE: "DE",
|
|
2296
|
-
DEUTSCHLAND: "DE",
|
|
2297
|
-
FRANCE: "FR",
|
|
2298
|
-
GB: "GB",
|
|
2299
|
-
GERMANY: "DE",
|
|
2300
|
-
GREATBRITAIN: "GB",
|
|
2301
|
-
GREAT_BRITAIN: "GB",
|
|
2302
|
-
INDIA: "IN",
|
|
2303
|
-
IRELAND: "IE",
|
|
2304
|
-
ITALY: "IT",
|
|
2305
|
-
JAPAN: "JP",
|
|
2306
|
-
MEXICO: "MX",
|
|
2307
|
-
NETHERLANDS: "NL",
|
|
2308
|
-
NEWZEALAND: "NZ",
|
|
2309
|
-
NORWAY: "NO",
|
|
2310
|
-
POLAND: "PL",
|
|
2311
|
-
PORTUGAL: "PT",
|
|
2312
|
-
SINGAPORE: "SG",
|
|
2313
|
-
SOUTHAFRICA: "ZA",
|
|
2314
|
-
SPAIN: "ES",
|
|
2315
|
-
SWEDEN: "SE",
|
|
2316
|
-
SWITZERLAND: "CH",
|
|
2317
|
-
UK: "GB",
|
|
2318
|
-
UNITEDKINGDOM: "GB",
|
|
2319
|
-
UNITEDSTATES: "US",
|
|
2320
|
-
US: "US",
|
|
2321
|
-
USA: "US",
|
|
2322
|
-
"UNITED STATES": "US",
|
|
2323
|
-
"UNITED KINGDOM": "GB",
|
|
2324
|
-
"GREAT BRITAIN": "GB",
|
|
2325
|
-
ENGLAND: "GB"
|
|
2326
|
-
};
|
|
2327
|
-
function normalizeCountryToIso2(country) {
|
|
2328
|
-
const upper = (country ?? "").trim().toUpperCase();
|
|
2329
|
-
if (!upper) return null;
|
|
2330
|
-
if (upper.length === 2) return upper;
|
|
2331
|
-
return COUNTRY_ALIASES[upper] ?? null;
|
|
2332
|
-
}
|
|
2333
|
-
var POSTAL_CODE_EXAMPLES = {
|
|
2334
|
-
AU: "2000",
|
|
2335
|
-
BR: "01000-000",
|
|
2336
|
-
CA: "A1A 1A1",
|
|
2337
|
-
CH: "8001",
|
|
2338
|
-
DE: "10115",
|
|
2339
|
-
DK: "1050",
|
|
2340
|
-
ES: "28001",
|
|
2341
|
-
FR: "75008",
|
|
2342
|
-
GB: "SW1A 1AA",
|
|
2343
|
-
IE: "D02 X285",
|
|
2344
|
-
IN: "110001",
|
|
2345
|
-
IT: "00118",
|
|
2346
|
-
JP: "100-0001",
|
|
2347
|
-
MX: "06500",
|
|
2348
|
-
NL: "1012 JS",
|
|
2349
|
-
NO: "0150",
|
|
2350
|
-
NZ: "6011",
|
|
2351
|
-
PL: "00-001",
|
|
2352
|
-
PT: "1100-148",
|
|
2353
|
-
SE: "111 22",
|
|
2354
|
-
SG: "018989",
|
|
2355
|
-
US: "12345 or 12345-6789",
|
|
2356
|
-
ZA: "8001"
|
|
2357
|
-
};
|
|
2358
|
-
function isPostalCodeSupported(country) {
|
|
2359
|
-
const iso2 = normalizeCountryToIso2(country);
|
|
2360
|
-
return iso2 !== null && SUPPORTED_LOCALES.has(iso2);
|
|
2361
|
-
}
|
|
2362
|
-
function isValidPostalCode(country, postalCode) {
|
|
2363
|
-
const trimmed = (postalCode ?? "").trim();
|
|
2364
|
-
if (!trimmed) return true;
|
|
2365
|
-
const iso2 = normalizeCountryToIso2(country);
|
|
2366
|
-
if (iso2 === null || !SUPPORTED_LOCALES.has(iso2)) return true;
|
|
2367
|
-
try {
|
|
2368
|
-
return isPostalCode(trimmed, iso2);
|
|
2369
|
-
} catch {
|
|
2370
|
-
return true;
|
|
2371
|
-
}
|
|
2372
|
-
}
|
|
2373
|
-
function getPostalCodeExample(country) {
|
|
2374
|
-
const iso2 = normalizeCountryToIso2(country);
|
|
2375
|
-
return iso2 ? POSTAL_CODE_EXAMPLES[iso2] : void 0;
|
|
2376
|
-
}
|
|
2377
|
-
|
|
2378
|
-
// src/checkout-payload.ts
|
|
2379
|
-
function nonBlank(value) {
|
|
2380
|
-
if (typeof value !== "string") return void 0;
|
|
2381
|
-
const trimmed = value.trim();
|
|
2382
|
-
return trimmed.length > 0 ? trimmed : void 0;
|
|
2383
|
-
}
|
|
2384
|
-
function resolveSessionCurrency(sessionCurrency, items, subscriptions, products) {
|
|
2385
|
-
const session = nonBlank(sessionCurrency);
|
|
2386
|
-
if (session) return session;
|
|
2387
|
-
for (const item of items ?? []) {
|
|
2388
|
-
const c = nonBlank(item.currency);
|
|
2389
|
-
if (c) return c;
|
|
2390
|
-
}
|
|
2391
|
-
for (const sub of subscriptions ?? []) {
|
|
2392
|
-
const c = nonBlank(sub.currency);
|
|
2393
|
-
if (c) return c;
|
|
2394
|
-
}
|
|
2395
|
-
for (const product of products ?? []) {
|
|
2396
|
-
const c = nonBlank(product.currency);
|
|
2397
|
-
if (c) return c;
|
|
2398
|
-
}
|
|
2399
|
-
return null;
|
|
2400
|
-
}
|
|
2401
|
-
function foldIntoProducts(items, subscriptions) {
|
|
2402
|
-
const products = [];
|
|
2403
|
-
for (const sub of subscriptions ?? []) {
|
|
2404
|
-
products.push({
|
|
2405
|
-
type: "subscription",
|
|
2406
|
-
code: nonBlank(sub.code) ?? nonBlank(sub.providerPlanId),
|
|
2407
|
-
providerPlanId: sub.providerPlanId,
|
|
2408
|
-
name: nonBlank(sub.subscriptionName) ?? nonBlank(sub.providerPlanName) ?? null,
|
|
2409
|
-
subscriptionName: sub.subscriptionName ?? null,
|
|
2410
|
-
providerPlanName: sub.providerPlanName ?? null,
|
|
2411
|
-
quantity: sub.quantity,
|
|
2412
|
-
totalAmount: sub.totalAmount,
|
|
2413
|
-
overrideAmount: sub.overrideAmount,
|
|
2414
|
-
currency: sub.currency,
|
|
2415
|
-
metadata: sub.metadata
|
|
2416
|
-
});
|
|
2417
|
-
}
|
|
2418
|
-
for (const item of items ?? []) {
|
|
2419
|
-
products.push({
|
|
2420
|
-
type: "item",
|
|
2421
|
-
code: nonBlank(item.code) ?? nonBlank(item.providerItemId),
|
|
2422
|
-
providerItemId: item.providerItemId,
|
|
2423
|
-
name: nonBlank(item.itemName) ?? nonBlank(item.providerItemName) ?? null,
|
|
2424
|
-
itemName: item.itemName ?? null,
|
|
2425
|
-
providerItemName: item.providerItemName ?? null,
|
|
2426
|
-
quantity: item.quantity,
|
|
2427
|
-
totalAmount: item.totalAmount,
|
|
2428
|
-
overrideAmount: item.overrideAmount,
|
|
2429
|
-
currency: item.currency,
|
|
2430
|
-
metadata: item.metadata
|
|
2431
|
-
});
|
|
2432
|
-
}
|
|
2433
|
-
return products;
|
|
2434
|
-
}
|
|
2435
|
-
function buildProductPayload(product, sessionCurrency) {
|
|
2436
|
-
const code = nonBlank(product.code) ?? nonBlank(product.providerItemId) ?? nonBlank(product.providerPlanId);
|
|
2437
|
-
if (!code) {
|
|
2438
|
-
throw new Error(
|
|
2439
|
-
"CheckoutProduct requires `code` (or the deprecated `providerItemId` / `providerPlanId`)."
|
|
2440
|
-
);
|
|
2441
|
-
}
|
|
2442
|
-
const name = nonBlank(product.name) ?? nonBlank(product.itemName) ?? nonBlank(product.providerItemName) ?? nonBlank(product.subscriptionName) ?? nonBlank(product.providerPlanName) ?? null;
|
|
2443
|
-
const payload = {
|
|
2444
|
-
type: product.type,
|
|
2445
|
-
code,
|
|
2446
|
-
name,
|
|
2447
|
-
quantity: product.quantity ?? 1,
|
|
2448
|
-
totalAmount: product.totalAmount,
|
|
2449
|
-
overrideAmount: product.overrideAmount ?? null,
|
|
2450
|
-
currency: nonBlank(product.currency) ?? sessionCurrency
|
|
2451
|
-
};
|
|
2452
|
-
if (product.metadata) {
|
|
2453
|
-
payload["metadata"] = product.metadata;
|
|
2454
|
-
}
|
|
2455
|
-
return payload;
|
|
2456
|
-
}
|
|
2457
|
-
function buildItemPayload(item, sessionCurrency) {
|
|
2458
|
-
const code = nonBlank(item.code) ?? nonBlank(item.providerItemId);
|
|
2459
|
-
if (!code) {
|
|
2460
|
-
throw new Error("CheckoutItem requires either `code` or the deprecated `providerItemId`.");
|
|
2461
|
-
}
|
|
2462
|
-
const itemName = nonBlank(item.itemName) ?? nonBlank(item.providerItemName) ?? null;
|
|
2463
|
-
const payload = {
|
|
2464
|
-
code,
|
|
2465
|
-
providerItemId: nonBlank(item.providerItemId) ?? code,
|
|
2466
|
-
itemName,
|
|
2467
|
-
providerItemName: nonBlank(item.providerItemName) ?? itemName,
|
|
2468
|
-
quantity: item.quantity ?? 1,
|
|
2469
|
-
totalAmount: item.totalAmount,
|
|
2470
|
-
overrideAmount: item.overrideAmount ?? null,
|
|
2471
|
-
currency: nonBlank(item.currency) ?? sessionCurrency
|
|
2472
|
-
};
|
|
2473
|
-
if (item.metadata) {
|
|
2474
|
-
payload["metadata"] = item.metadata;
|
|
2475
|
-
}
|
|
2476
|
-
return payload;
|
|
2477
|
-
}
|
|
2478
|
-
function buildSubscriptionPayload(subscription, sessionCurrency) {
|
|
2479
|
-
const code = nonBlank(subscription.code) ?? nonBlank(subscription.providerPlanId);
|
|
2480
|
-
if (!code) {
|
|
2481
|
-
throw new Error(
|
|
2482
|
-
"CheckoutSubscription requires either `code` or the deprecated `providerPlanId`."
|
|
2483
|
-
);
|
|
2484
|
-
}
|
|
2485
|
-
const subscriptionName = nonBlank(subscription.subscriptionName) ?? nonBlank(subscription.providerPlanName) ?? null;
|
|
2486
|
-
const payload = {
|
|
2487
|
-
code,
|
|
2488
|
-
providerPlanId: nonBlank(subscription.providerPlanId) ?? code,
|
|
2489
|
-
subscriptionName,
|
|
2490
|
-
providerPlanName: nonBlank(subscription.providerPlanName) ?? subscriptionName,
|
|
2491
|
-
quantity: subscription.quantity ?? 1,
|
|
2492
|
-
totalAmount: subscription.totalAmount,
|
|
2493
|
-
overrideAmount: subscription.overrideAmount ?? null,
|
|
2494
|
-
currency: nonBlank(subscription.currency) ?? sessionCurrency
|
|
2495
|
-
};
|
|
2496
|
-
if (subscription.metadata) {
|
|
2497
|
-
payload["metadata"] = subscription.metadata;
|
|
2498
|
-
}
|
|
2499
|
-
return payload;
|
|
2500
|
-
}
|
|
2501
|
-
|
|
2502
|
-
// src/display.ts
|
|
2503
|
-
function buildCheckoutDisplayData(session, options = {}) {
|
|
2504
|
-
const itemsList = [];
|
|
2505
|
-
const products = session.products ?? [];
|
|
2506
|
-
const subscriptions = products.filter((p) => p.type === "subscription");
|
|
2507
|
-
const items = products.filter((p) => p.type !== "subscription");
|
|
2508
|
-
const resolvedCurrency = resolveSessionCurrency(session.currency, void 0, void 0, products);
|
|
2509
|
-
const currency = (resolvedCurrency ?? "USD").toUpperCase();
|
|
2510
|
-
for (const sub of subscriptions) {
|
|
2511
|
-
const originalPrice = sub.totalAmount ?? 0;
|
|
2512
|
-
const discountedPrice = sub.overrideAmount ?? originalPrice;
|
|
2513
|
-
let name = sub.name || sub.code || "Subscription";
|
|
2514
|
-
if (name === "4-WEEK PLAN" && discountedPrice <= 1) {
|
|
2515
|
-
name = "7-DAY TRIAL: FULL ACCESS";
|
|
2516
|
-
}
|
|
2517
|
-
itemsList.push({
|
|
2518
|
-
name,
|
|
2519
|
-
quantity: sub.quantity,
|
|
2520
|
-
price: discountedPrice,
|
|
2521
|
-
originalPrice
|
|
2522
|
-
});
|
|
2523
|
-
}
|
|
2524
|
-
const hideItems = options.hideBundledItems === true && subscriptions.length > 0 && items.length > 0;
|
|
2525
|
-
if (!hideItems) {
|
|
2526
|
-
for (const item of items) {
|
|
2527
|
-
const originalPrice = item.totalAmount ?? 0;
|
|
2528
|
-
const discountedPrice = item.overrideAmount ?? originalPrice;
|
|
2529
|
-
itemsList.push({
|
|
2530
|
-
name: item.name || item.code || "Item",
|
|
2531
|
-
quantity: item.quantity,
|
|
2532
|
-
price: discountedPrice,
|
|
2533
|
-
originalPrice
|
|
2534
|
-
});
|
|
2535
|
-
}
|
|
2536
|
-
}
|
|
2537
|
-
if (itemsList.length === 0) {
|
|
2538
|
-
itemsList.push({
|
|
2539
|
-
name: "Purchase",
|
|
2540
|
-
quantity: 1,
|
|
2541
|
-
price: session.amount / 100,
|
|
2542
|
-
originalPrice: session.amount / 100
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
const lineOriginalTotal = itemsList.reduce((sum, i) => sum + i.originalPrice * i.quantity, 0);
|
|
2546
|
-
const lineTotal = itemsList.reduce((sum, i) => sum + i.price * i.quantity, 0);
|
|
2547
|
-
const hasBackendTotals = typeof session.totalAmount === "number" && Number.isFinite(session.totalAmount);
|
|
2548
|
-
const hasBackendSubtotal = typeof session.subtotalAmount === "number" && Number.isFinite(session.subtotalAmount);
|
|
2549
|
-
const hasBackendDiscount = typeof session.discountAmount === "number" && Number.isFinite(session.discountAmount);
|
|
2550
|
-
const total = hasBackendTotals ? session.totalAmount : lineTotal;
|
|
2551
|
-
const originalTotal = hasBackendSubtotal ? session.subtotalAmount : lineOriginalTotal;
|
|
2552
|
-
const totalSave = Math.max(0, originalTotal - total);
|
|
2553
|
-
const discountPercent = originalTotal > 0 ? Math.round(totalSave / originalTotal * 100) : 0;
|
|
2554
|
-
return {
|
|
2555
|
-
items: itemsList,
|
|
2556
|
-
currency,
|
|
2557
|
-
total,
|
|
2558
|
-
originalTotal,
|
|
2559
|
-
totalSave,
|
|
2560
|
-
discountPercent,
|
|
2561
|
-
...hasBackendDiscount ? { couponDiscount: session.discountAmount } : {}
|
|
2562
|
-
};
|
|
2563
|
-
}
|
|
2564
|
-
|
|
2565
|
-
// src/validation.ts
|
|
2566
|
-
function getCurrencyByCountry(countryCode) {
|
|
2567
|
-
return CURRENCY_MAP[countryCode.toUpperCase()] ?? DEFAULT_CURRENCY;
|
|
2568
|
-
}
|
|
2569
|
-
function isValidPublishableKey(key) {
|
|
2570
|
-
return /^pk_(test|live)_[A-Za-z0-9]+$/.test(key);
|
|
2571
|
-
}
|
|
2572
|
-
function isValidSecretKey(key) {
|
|
2573
|
-
return /^sk_(test|live)_[A-Za-z0-9]+$/.test(key);
|
|
2574
|
-
}
|
|
2575
|
-
function isSetupIntentClientSecret(clientSecret) {
|
|
2576
|
-
return typeof clientSecret === "string" && clientSecret.startsWith("seti_");
|
|
2577
|
-
}
|
|
2578
|
-
|
|
2579
|
-
// src/idempotency.ts
|
|
2580
|
-
var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
2581
|
-
var MAX_IDEMPOTENCY_KEY_LENGTH = 255;
|
|
2582
|
-
var IDEMPOTENCY_IN_PROGRESS_CODE = "IdempotencyKeyInProgress";
|
|
2583
|
-
function getSecureRandomSource() {
|
|
2584
|
-
const source = globalThis.crypto;
|
|
2585
|
-
if (!source) return void 0;
|
|
2586
|
-
if (typeof source.randomUUID === "function" || typeof source.getRandomValues === "function") {
|
|
2587
|
-
return source;
|
|
2588
|
-
}
|
|
2589
|
-
return void 0;
|
|
2590
|
-
}
|
|
2591
|
-
function generateIdempotencyKey() {
|
|
2592
|
-
const source = getSecureRandomSource();
|
|
2593
|
-
if (!source) return void 0;
|
|
2594
|
-
if (typeof source.randomUUID === "function") {
|
|
2595
|
-
return source.randomUUID();
|
|
2596
|
-
}
|
|
2597
|
-
const bytes = new Uint8Array(16);
|
|
2598
|
-
source.getRandomValues(bytes);
|
|
2599
|
-
return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2600
|
-
}
|
|
2601
|
-
function resolveIdempotencyKey(supplied) {
|
|
2602
|
-
if (supplied === void 0) {
|
|
2603
|
-
return generateIdempotencyKey();
|
|
2604
|
-
}
|
|
2605
|
-
if (typeof supplied !== "string" || supplied.trim() === "") {
|
|
2606
|
-
throw new FloPayError(
|
|
2607
|
-
"idempotencyKey must be a non-empty string identifying exactly one checkout creation.",
|
|
2608
|
-
"validation_error",
|
|
2609
|
-
{ code: "InvalidIdempotencyKey", param: "idempotencyKey" }
|
|
2610
|
-
);
|
|
2611
|
-
}
|
|
2612
|
-
if (supplied.length > MAX_IDEMPOTENCY_KEY_LENGTH) {
|
|
2613
|
-
throw new FloPayError(
|
|
2614
|
-
`idempotencyKey must be at most ${MAX_IDEMPOTENCY_KEY_LENGTH} characters.`,
|
|
2615
|
-
"validation_error",
|
|
2616
|
-
{ code: "InvalidIdempotencyKey", param: "idempotencyKey" }
|
|
2617
|
-
);
|
|
2618
|
-
}
|
|
2619
|
-
return supplied;
|
|
2620
|
-
}
|
|
2621
|
-
|
|
2622
|
-
// src/uuid.ts
|
|
2623
|
-
var UUID_V42 = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
2624
|
-
function isUuidV4(value) {
|
|
2625
|
-
return typeof value === "string" && UUID_V42.test(value);
|
|
2626
|
-
}
|
|
2627
|
-
function randomUuidV4() {
|
|
2628
|
-
try {
|
|
2629
|
-
const id = globalThis.crypto.randomUUID();
|
|
2630
|
-
if (UUID_V42.test(id)) return id;
|
|
2631
|
-
} catch {
|
|
2632
|
-
}
|
|
2633
|
-
const bytes = new Uint8Array(16);
|
|
2634
|
-
try {
|
|
2635
|
-
globalThis.crypto.getRandomValues(bytes);
|
|
2636
|
-
} catch {
|
|
2637
|
-
for (let index = 0; index < bytes.length; index += 1) {
|
|
2638
|
-
bytes[index] = Math.floor(Math.random() * 256);
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
bytes[6] = bytes[6] & 15 | 64;
|
|
2642
|
-
bytes[8] = bytes[8] & 63 | 128;
|
|
2643
|
-
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2644
|
-
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
2645
|
-
}
|
|
2646
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2647
|
-
0 && (module.exports = {
|
|
2648
|
-
BILLING_API_URL,
|
|
2649
|
-
BILLING_API_URL_PRODUCTION,
|
|
2650
|
-
BILLING_API_URL_STAGING,
|
|
2651
|
-
BOLD_DARK_APPEARANCE,
|
|
2652
|
-
BOLD_LIGHT_APPEARANCE,
|
|
2653
|
-
BUTTONS_LAYOUT_BOLD_DARK,
|
|
2654
|
-
BUTTONS_LAYOUT_BOLD_LIGHT,
|
|
2655
|
-
BUTTONS_LAYOUT_DARK,
|
|
2656
|
-
BUTTONS_LAYOUT_DEFAULT,
|
|
2657
|
-
BUTTONS_LAYOUT_GLASS_DARK,
|
|
2658
|
-
BUTTONS_LAYOUT_GLASS_LIGHT,
|
|
2659
|
-
BUTTONS_LAYOUT_MINIMAL,
|
|
2660
|
-
BUTTONS_LAYOUT_MODERN_DARK,
|
|
2661
|
-
BUTTONS_LAYOUT_MODERN_LIGHT,
|
|
2662
|
-
BUTTONS_LAYOUT_ROUNDED,
|
|
2663
|
-
CA_PROVINCES,
|
|
2664
|
-
COUNTRY_OPTIONS,
|
|
2665
|
-
CURRENCY_MAP,
|
|
2666
|
-
DEFAULT_API_BASE_URL,
|
|
2667
|
-
DEFAULT_API_VERSION,
|
|
2668
|
-
DEFAULT_APPEARANCE,
|
|
2669
|
-
DEFAULT_CURRENCY,
|
|
2670
|
-
ELEMENT_TYPES,
|
|
2671
|
-
FLAT_APPEARANCE,
|
|
2672
|
-
FLO_SDK_VERSION_HEADER,
|
|
2673
|
-
FloPayError,
|
|
2674
|
-
GLASS_DARK_APPEARANCE,
|
|
2675
|
-
GLASS_LIGHT_APPEARANCE,
|
|
2676
|
-
IDEMPOTENCY_IN_PROGRESS_CODE,
|
|
2677
|
-
IDEMPOTENCY_KEY_HEADER,
|
|
2678
|
-
MAX_IDEMPOTENCY_KEY_LENGTH,
|
|
2679
|
-
MODERN_DARK_APPEARANCE,
|
|
2680
|
-
MODERN_LIGHT_APPEARANCE,
|
|
2681
|
-
NIGHT_APPEARANCE,
|
|
2682
|
-
SDK_VERSION,
|
|
2683
|
-
STRIPE_EXPRESS_METHODS,
|
|
2684
|
-
STRIPE_METHOD_AMOUNT_LIMITS,
|
|
2685
|
-
STRIPE_METHOD_COUNTRIES,
|
|
2686
|
-
STRIPE_METHOD_CURRENCIES,
|
|
2687
|
-
STRIPE_METHOD_MATRIX,
|
|
2688
|
-
SUPPORTED_CARD_BRANDS,
|
|
2689
|
-
TELEMETRY_ERROR_CODES,
|
|
2690
|
-
TELEMETRY_LOG_NAMES,
|
|
2691
|
-
TELEMETRY_MAX_BATCH_BYTES,
|
|
2692
|
-
TELEMETRY_MAX_BATCH_EVENTS,
|
|
2693
|
-
TELEMETRY_SCHEMA_VERSION,
|
|
2694
|
-
TELEMETRY_SDK_PACKAGES,
|
|
2695
|
-
THEMES,
|
|
2696
|
-
US_STATES,
|
|
2697
|
-
UUID_V4,
|
|
2698
|
-
apiError,
|
|
2699
|
-
authenticationError,
|
|
2700
|
-
buildCheckoutDisplayData,
|
|
2701
|
-
buildItemPayload,
|
|
2702
|
-
buildProductPayload,
|
|
2703
|
-
buildSubscriptionPayload,
|
|
2704
|
-
buildTelemetryErrorEvent,
|
|
2705
|
-
buildTelemetryLogEvent,
|
|
2706
|
-
buildTelemetryPerformanceEvent,
|
|
2707
|
-
buildTelemetryTerminalEvent,
|
|
2708
|
-
configureFlopay,
|
|
2709
|
-
filterStripeMethodsByAmount,
|
|
2710
|
-
filterStripeMethodsByCountry,
|
|
2711
|
-
filterStripeMethodsByCurrency,
|
|
2712
|
-
foldIntoProducts,
|
|
2713
|
-
generateIdempotencyKey,
|
|
2714
|
-
getConfiguredBillingApiUrl,
|
|
2715
|
-
getCountryByCode,
|
|
2716
|
-
getCurrencyByCountry,
|
|
2717
|
-
getFloPayEnvironment,
|
|
2718
|
-
getPostalCodeExample,
|
|
2719
|
-
getPostalCodeLabel,
|
|
2720
|
-
getStateFromPostalCode,
|
|
2721
|
-
getStateLabel,
|
|
2722
|
-
getStateOptions,
|
|
2723
|
-
getStripeMethodDisplayName,
|
|
2724
|
-
hasVendoredStripeMethodLogo,
|
|
2725
|
-
isAVSEnabled,
|
|
2726
|
-
isAVSFieldVisible,
|
|
2727
|
-
isPostalCodeSupported,
|
|
2728
|
-
isSetupIntentClientSecret,
|
|
2729
|
-
isUuidV4,
|
|
2730
|
-
isValidPostalCode,
|
|
2731
|
-
isValidPublishableKey,
|
|
2732
|
-
isValidSecretKey,
|
|
2733
|
-
needsStripeMethodExplicitConfirm,
|
|
2734
|
-
networkError,
|
|
2735
|
-
normalizeGatewayEnvironment,
|
|
2736
|
-
partitionStripeMethods,
|
|
2737
|
-
randomUuidV4,
|
|
2738
|
-
rateLimitError,
|
|
2739
|
-
resolveAVSConfig,
|
|
2740
|
-
resolveBillingApiUrl,
|
|
2741
|
-
resolveButtonsLayoutTheme,
|
|
2742
|
-
resolveIdempotencyKey,
|
|
2743
|
-
resolveSessionCurrency,
|
|
2744
|
-
resolveStripeMethodBrandVariant,
|
|
2745
|
-
resolveTheme,
|
|
2746
|
-
serializeTelemetryBatch,
|
|
2747
|
-
stripeExpressMethodToOptionKey,
|
|
2748
|
-
validationError
|
|
2749
|
-
});
|
|
2750
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";var Dt=Object.create;var b=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Ot=Object.getPrototypeOf,Ut=Object.prototype.hasOwnProperty;var wt=(e,t)=>{for(var r in t)b(e,r,{get:t[r],enumerable:!0})},Ce=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mt(t))!Ut.call(e,n)&&n!==r&&b(e,n,{get:()=>t[n],enumerable:!(o=Lt(t,n))||o.enumerable});return e};var Gt=(e,t,r)=>(r=e!=null?Dt(Ot(e)):{},Ce(t||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e)),Kt=e=>Ce(b({},"__esModule",{value:!0}),e);var _r={};wt(_r,{BILLING_API_URL:()=>Me,BILLING_API_URL_PRODUCTION:()=>z,BILLING_API_URL_STAGING:()=>C,BOLD_DARK_APPEARANCE:()=>X,BOLD_LIGHT_APPEARANCE:()=>j,BUTTONS_LAYOUT_BOLD_DARK:()=>P,BUTTONS_LAYOUT_BOLD_LIGHT:()=>I,BUTTONS_LAYOUT_DARK:()=>re,BUTTONS_LAYOUT_DEFAULT:()=>Q,BUTTONS_LAYOUT_GLASS_DARK:()=>_,BUTTONS_LAYOUT_GLASS_LIGHT:()=>R,BUTTONS_LAYOUT_MINIMAL:()=>ee,BUTTONS_LAYOUT_MODERN_DARK:()=>h,BUTTONS_LAYOUT_MODERN_LIGHT:()=>A,BUTTONS_LAYOUT_ROUNDED:()=>te,CA_PROVINCES:()=>le,COUNTRY_OPTIONS:()=>de,CURRENCY_MAP:()=>k,DEFAULT_API_BASE_URL:()=>Le,DEFAULT_API_VERSION:()=>Ue,DEFAULT_APPEARANCE:()=>q,DEFAULT_CURRENCY:()=>B,ELEMENT_TYPES:()=>Qe,FLAT_APPEARANCE:()=>we,FLO_SDK_VERSION_HEADER:()=>De,FloPayError:()=>p,GLASS_DARK_APPEARANCE:()=>J,GLASS_LIGHT_APPEARANCE:()=>$,IDEMPOTENCY_IN_PROGRESS_CODE:()=>At,IDEMPOTENCY_KEY_HEADER:()=>St,MAX_IDEMPOTENCY_KEY_LENGTH:()=>D,MODERN_DARK_APPEARANCE:()=>Z,MODERN_LIGHT_APPEARANCE:()=>W,NIGHT_APPEARANCE:()=>Ge,SDK_VERSION:()=>ve,STRIPE_EXPRESS_METHODS:()=>ne,STRIPE_METHOD_AMOUNT_LIMITS:()=>se,STRIPE_METHOD_COUNTRIES:()=>ie,STRIPE_METHOD_CURRENCIES:()=>ae,STRIPE_METHOD_MATRIX:()=>g,SUPPORTED_CARD_BRANDS:()=>et,TELEMETRY_ERROR_CODES:()=>U,TELEMETRY_LOG_NAMES:()=>w,TELEMETRY_MAX_BATCH_BYTES:()=>Ae,TELEMETRY_MAX_BATCH_EVENTS:()=>he,TELEMETRY_SCHEMA_VERSION:()=>Se,TELEMETRY_SDK_PACKAGES:()=>O,THEMES:()=>oe,US_STATES:()=>ue,UUID_V4:()=>L,apiError:()=>be,authenticationError:()=>xe,buildCheckoutDisplayData:()=>Ft,buildItemPayload:()=>Ct,buildProductPayload:()=>yt,buildSubscriptionPayload:()=>Et,buildTelemetryErrorEvent:()=>G,buildTelemetryLogEvent:()=>K,buildTelemetryPerformanceEvent:()=>Y,buildTelemetryTerminalEvent:()=>V,configureFlopay:()=>Re,filterStripeMethodsByAmount:()=>$e,filterStripeMethodsByCountry:()=>Xe,filterStripeMethodsByCurrency:()=>je,foldIntoProducts:()=>gt,generateIdempotencyKey:()=>me,getConfiguredBillingApiUrl:()=>S,getCountryByCode:()=>ot,getCurrencyByCountry:()=>bt,getFloPayEnvironment:()=>_e,getPostalCodeExample:()=>mt,getPostalCodeLabel:()=>tt,getStateFromPostalCode:()=>dt,getStateLabel:()=>st,getStateOptions:()=>it,getStripeMethodDisplayName:()=>qe,hasVendoredStripeMethodLogo:()=>ze,isAVSEnabled:()=>at,isAVSFieldVisible:()=>nt,isPostalCodeSupported:()=>lt,isSetupIntentClientSecret:()=>Tt,isUuidV4:()=>It,isValidPostalCode:()=>pt,isValidPublishableKey:()=>xt,isValidSecretKey:()=>ft,needsStripeMethodExplicitConfirm:()=>We,networkError:()=>Te,normalizeGatewayEnvironment:()=>Ee,partitionStripeMethods:()=>Je,randomUuidV4:()=>Pt,rateLimitError:()=>fe,resolveAVSConfig:()=>ce,resolveBillingApiUrl:()=>Oe,resolveButtonsLayoutTheme:()=>Ke,resolveIdempotencyKey:()=>ht,resolveSessionCurrency:()=>v,resolveStripeMethodBrandVariant:()=>Ze,resolveTheme:()=>Ve,serializeTelemetryBatch:()=>Pe,stripeExpressMethodToOptionKey:()=>Ye,validationError:()=>Fe});module.exports=Kt(_r);function Ee(e){if(e!=null)switch(e){case"sandbox":case"stage":return"sandbox";case"live":case"production":return"live";default:console.warn(`[FloPay] Unrecognized gateway environment "${e}". Expected one of: sandbox, live, stage, production. Falling back to undefined.`);return}}var p=class extends Error{constructor(t,r,o){super(t),this.name="FloPayError",this.type=r,this.code=o?.code,this.declineCode=o?.declineCode,this.param=o?.param,this.statusCode=o?.statusCode,Object.setPrototypeOf(this,new.target.prototype)}};function Fe(e,t){return new p(e,"validation_error",{param:t})}function be(e,t,r){return new p(e,"api_error",{code:t,statusCode:r})}function xe(e){return new p(e,"authentication_error")}function fe(e){return new p(e,"rate_limit_error")}function Te(e){return new p(e,"network_error")}var Se=1,O=["@flopay/shared","@flopay/js","@flopay/react"],Ae=32768,he=20,Vt=["stripe","paypal"],Yt=["card","wallet","paypal","apm","saved","unknown"],Ht=["callback","sdk_initialize","checkout_mount","session_create","session_read","session_first_byte","session_complete","checkout_data_ready","checkout_render","checkout_interactive","provider_load","provider_ready","overlay_open","overlay_return","redirect","redirect_resume","vault_request","vault_mount","vault_ready","vault_submit","tokenization","three_ds_handoff","three_ds_return","processing","recovery","completion","unmount","total_journey"],U=["CALLBACK_FAILED","CHECKOUT_SESSION_CREATE_FAILED","CONFIGURATION_INVALID","INTERNAL_SDK_ERROR","NETWORK_REQUEST_FAILED","PAYMENT_PROCESSING_FAILED","POPUP_BLOCKED","PROVIDER_LOAD_FAILED","PROVIDER_RUNTIME_FAILED","RECOVERY_FAILED","REDIRECT_RESUME_FAILED","REQUEST_TIMEOUT","SDK_INITIALIZATION_FAILED","THREE_DS_FAILED","TOKENIZATION_FAILED","VAULT_LOAD_FAILED","VAULT_SUBMIT_FAILED"],w=["sdk.initialize.started","sdk.initialize.ready","sdk.cache.hit","sdk.cache.miss","checkout.mount","session.create.started","session.read.started","session.request.first_byte","session.request.completed","checkout.data.ready","checkout.rendered","checkout.interactive","checkout.recovery.started","checkout.recovery.completed","checkout.unmount","provider.load.started","provider.eligibility.checked","provider.availability.checked","provider.ready","provider.popup.opened","provider.overlay.opened","provider.overlay.returned","provider.redirect.started","provider.redirect.resumed","vault.capture.requested","vault.widget.mounted","vault.widget.ready","vault.submission.started","vault.action.required","vault.three_ds.handoff","vault.three_ds.returned","vault.terminal","payment.method.selected","payment.intent.started","payment.intent.completed","payment.tokenization.started","payment.tokenization.completed","payment.processing.started","payment.processing.completed","payment.three_ds.handoff","payment.three_ds.returned","operation.retry","operation.deduplicated","operation.fallback","operation.cache.hit","operation.cache.miss","operation.recovery.started","operation.recovery.completed","operation.state_transition"],zt=["session_create","session_read","intent_create","process_payment","vault_capture","account_snapshot","provider_sdk","other"],qt=["2xx","3xx","4xx","5xx","network_error","timeout","unknown"],Wt=["full","auto","confirm","unknown"],Zt=["embedded","buttons","automatic","unknown"],jt=["machine","buyer","total"],Xt=["action_required","customer_abandoned","payment_cancelled","payment_declined","payment_succeeded","validation_rejected"],Ie=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,$t=/^\d{1,4}\.\d{1,4}\.\d{1,4}(?:-[0-9A-Za-z.-]{1,32})?$/,Jt=new Set(U),x=new Set(Ht),Qt=new Set(Vt),er=new Set(Yt),tr=new Set(w),rr=new Set(Wt),or=new Set(Zt),nr=new Set(zt),ar=new Set(qt),ir=new Set(jt),sr=new Set(Xt),dr=new Set(O);function u(e,t,r){return typeof e=="string"&&t.has(e)?e:r}function cr(){try{let r=globalThis.crypto.randomUUID();if(Ie.test(r))return r}catch{}let e=new Uint8Array(16);try{globalThis.crypto.getRandomValues(e)}catch{for(let r=0;r<e.length;r+=1)e[r]=Math.floor(Math.random()*256)}e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function y(e){return typeof e=="string"&&Ie.test(e)?e:cr()}function ur(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=100?e:void 0}function f(e){return Number.isSafeInteger(e)&&e>=0?Math.min(e,1e6):0}function lr(e){return!Number.isFinite(e)||e<0?0:Math.min(Math.round(e),12e4)}function T(e,t){let r=ur(t.attempt);return t.provider&&Qt.has(t.provider)&&(e.provider=t.provider),r!==void 0&&(e.attempt=r),t.statusClass&&(e.statusClass=u(t.statusClass,ar,"unknown")),t.requestCategory&&(e.requestCategory=u(t.requestCategory,nr,"other")),t.paymentMethodCategory&&(e.paymentMethodCategory=u(t.paymentMethodCategory,er,"unknown")),t.checkoutMode&&(e.checkoutMode=u(t.checkoutMode,rr,"unknown")),t.layout&&(e.layout=u(t.layout,or,"unknown")),e}function G(e){return T({eventId:y(e.eventId),class:"technical_error",code:u(e.errorCode,Jt,"INTERNAL_SDK_ERROR"),stage:u(e.stage,x,"sdk_initialize"),sequence:f(e.sequence)},e)}function K(e){return T({eventId:y(e.eventId),class:"lifecycle",name:u(e.name,tr,"operation.retry"),stage:u(e.stage,x,"sdk_initialize"),sequence:f(e.sequence)},e)}function V(e){let t={...e,stage:e.stage??"completion"};return T({eventId:y(e.eventId),class:"expected_outcome",outcome:u(e.outcome,sr,"customer_abandoned"),stage:u(e.stage,x,"completion"),sequence:f(e.sequence)},t)}function Y(e){return T({eventId:y(e.eventId),class:"performance",stage:u(e.stage,x,"sdk_initialize"),sequence:f(e.sequence),durationMs:lr(e.durationMs),durationMode:u(e.durationMode,ir,"machine")},e)}function Pe(e,t){let r=e.slice(0,20).flatMap(n=>n.class==="technical_error"?[G({...n,errorCode:n.code})]:n.class==="lifecycle"?[K(n)]:n.class==="expected_outcome"?[V(n)]:n.class==="performance"?[Y(n)]:[]),o={schemaVersion:1,batchId:y(t.batchId),correlationId:y(t.correlationId),sdk:{package:u(t.sdkPackage,dr,"@flopay/shared"),version:$t.test(t.sdkVersion)?t.sdkVersion:"0.0.0"},events:r};return JSON.stringify(o)}var pr={local:"https://flo.ngrok.pro",staging:"https://api.stage.flopay.com",production:"https://api.flopay.com"},H="staging";function Re(e){H=e.environment}function S(){return pr[H]}function _e(){return H}var ke=["alipay","bancontact","blik","eps","giropay","ideal","klarna","p24","sepa_debit","wechat_pay"];var ve="1.4.5",De="x-flo-sdk-version",C="https://api.stage.flopay.com",z="https://api.flopay.com",Le=C,Me=C;function Oe(e){return e||(typeof process<"u"&&process.env?.NEXT_PUBLIC_FLOPAY_ENV?process.env.NEXT_PUBLIC_FLOPAY_ENV==="production"?z:C:S())}var Ue="2024-01-01",q={theme:"default",variables:{colorPrimary:"#4A49FF",colorBackground:"#FFFFFF",colorText:"#262833",colorDanger:"#DF1B41",borderRadius:"8px",fontFamily:"Poppins, system-ui, sans-serif",fontSizeBase:"16px",spacingUnit:"4px"}},we={theme:"flat",variables:{...q.variables,borderRadius:"4px"}},Ge={theme:"night",variables:{colorPrimary:"#7B7BFF",colorBackground:"#1A1A2E",colorText:"#E0E0E0",colorDanger:"#FF6B6B",borderRadius:"8px",fontFamily:"Poppins, system-ui, sans-serif",fontSizeBase:"16px",spacingUnit:"4px"}},W={theme:"default",variables:{colorPrimary:"#1785E0",colorBackground:"#FFFFFF",colorText:"#0F172A",colorDanger:"#EF4444",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"15px",spacingUnit:"5px"},rules:{".Input":{padding:"14px 16px",border:"1.5px solid #E5E7EB",boxShadow:"0 1px 2px rgba(15,23,42,0.04)"},".Input:focus":{borderColor:"#1785E0",boxShadow:"0 0 0 4px rgba(23,133,224,0.12)"},".Label":{fontWeight:"500",color:"#475569",marginBottom:"6px"},".Tab":{padding:"12px 16px",borderRadius:"12px",border:"1.5px solid #E5E7EB"},".Tab:hover":{borderColor:"#CBD5E1"},".Tab--selected":{borderColor:"#1785E0",boxShadow:"0 0 0 1px #1785E0"}}},Z={theme:"night",variables:{colorPrimary:"#60A5FA",colorBackground:"#0B1220",colorText:"#F1F5F9",colorDanger:"#F87171",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"15px",spacingUnit:"5px"},rules:{".Input":{backgroundColor:"#111827",padding:"14px 16px",border:"1.5px solid #1F2937",color:"#F1F5F9",boxShadow:"none"},".Input:focus":{borderColor:"#60A5FA",boxShadow:"0 0 0 4px rgba(96,165,250,0.18)"},".Label":{fontWeight:"500",color:"#94A3B8",marginBottom:"6px"},".Tab":{padding:"12px 16px",borderRadius:"12px",border:"1.5px solid #1F2937",backgroundColor:"#111827",color:"#F1F5F9"},".Tab:hover":{borderColor:"#374151"},".Tab--selected":{borderColor:"#60A5FA",boxShadow:"0 0 0 1px #60A5FA"}}},j={theme:"default",variables:{colorPrimary:"#1785E0",colorBackground:"#FFFFFF",colorText:"#0C2B4D",colorDanger:"#DC2626",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"16px",spacingUnit:"5px"},rules:{".Input":{padding:"14px 16px",border:"2px solid #E5E7EB"},".Input:focus":{borderColor:"#1785E0",boxShadow:"0 0 0 3px rgba(23,133,224,0.2)"},".Label":{fontWeight:"600",color:"#0C2B4D"},".Tab":{padding:"14px 18px",border:"2px solid #E5E7EB",fontWeight:"600"},".Tab--selected":{borderColor:"#1785E0",boxShadow:"0 0 0 1px #1785E0"}}},X={theme:"night",variables:{colorPrimary:"#60A5FA",colorBackground:"#0C2B4D",colorText:"#FFFFFF",colorDanger:"#F87171",borderRadius:"12px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"16px",spacingUnit:"5px"},rules:{".Input":{backgroundColor:"#1E3A8A",padding:"14px 16px",border:"2px solid #1E40AF",color:"#FFFFFF"},".Input:focus":{borderColor:"#60A5FA",boxShadow:"0 0 0 3px rgba(96,165,250,0.25)"},".Label":{fontWeight:"600",color:"#DBEAFE"},".Tab":{padding:"14px 18px",border:"2px solid #1E40AF",backgroundColor:"#1E3A8A",color:"#FFFFFF",fontWeight:"600"},".Tab--selected":{borderColor:"#60A5FA",boxShadow:"0 0 0 1px #60A5FA"}}},$={theme:"default",variables:{colorPrimary:"#1785E0",colorBackground:"#FFFFFF",colorText:"#1E293B",colorDanger:"#EF4444",borderRadius:"16px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"15px",spacingUnit:"5px"},rules:{".Input":{backgroundColor:"rgba(255,255,255,0.6)",backdropFilter:"blur(10px)",padding:"14px 16px",border:"1px solid rgba(255,255,255,0.6)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.5), 0 1px 3px rgba(23,133,224,0.08)"},".Input:focus":{borderColor:"rgba(23,133,224,0.5)",boxShadow:"0 0 0 3px rgba(23,133,224,0.15)"},".Label":{fontWeight:"500",color:"#475569"},".Tab":{padding:"12px 16px",backgroundColor:"rgba(255,255,255,0.5)",border:"1px solid rgba(255,255,255,0.6)",borderRadius:"14px"},".Tab--selected":{borderColor:"rgba(23,133,224,0.6)",boxShadow:"0 0 0 1px rgba(23,133,224,0.6)"}}},J={theme:"night",variables:{colorPrimary:"#60A5FA",colorBackground:"#0F172A",colorText:"#F1F5F9",colorDanger:"#F87171",borderRadius:"16px",fontFamily:"Inter, system-ui, sans-serif",fontSizeBase:"15px",spacingUnit:"5px"},rules:{".Input":{backgroundColor:"rgba(15,23,42,0.6)",backdropFilter:"blur(10px)",padding:"14px 16px",border:"1px solid rgba(255,255,255,0.08)",color:"#F1F5F9"},".Input:focus":{borderColor:"rgba(96,165,250,0.5)",boxShadow:"0 0 0 3px rgba(96,165,250,0.2)"},".Label":{fontWeight:"500",color:"#94A3B8"},".Tab":{padding:"12px 16px",backgroundColor:"rgba(15,23,42,0.6)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"14px",color:"#F1F5F9"},".Tab--selected":{borderColor:"rgba(96,165,250,0.6)",boxShadow:"0 0 0 1px rgba(96,165,250,0.6)"}}},Q={},ee={cardButton:{border:"none",backgroundColor:"#f9fafb",boxShadow:"none"},cardFormContainer:{backgroundColor:"#f9fafb",border:"none"},cardInputBorder:"#e5e7eb",backButtonIcon:{backgroundColor:"#e5e7eb"},submitButton:{borderRadius:"6px"}},te={cardButton:{borderRadius:"9999px",border:"1px solid #e5e7eb",boxShadow:"0 1px 3px rgba(0,0,0,0.06)"},cardFormContainer:{borderRadius:"16px",border:"1px solid #e5e7eb",boxShadow:"0 2px 8px rgba(0,0,0,0.06)"},cardInputBorder:"#d1d5db",submitButton:{borderRadius:"9999px"},backButtonIcon:{backgroundColor:"#f3f4f6"}},re={cardButton:{backgroundColor:"#1f2937",color:"#f9fafb",border:"1px solid #374151",boxShadow:"none"},cardFormContainer:{backgroundColor:"#111827",border:"1px solid #374151"},cardInputBorder:"#4b5563",cardInputColor:"#f9fafb",cardInputPlaceholderColor:"#6b7280",cardInputBackground:"#1f2937",nameInput:{backgroundColor:"#1f2937",color:"#f9fafb"},backButton:{color:"#9ca3af"},backButtonIcon:{backgroundColor:"#374151"},submitButton:{backgroundColor:"#6366f1"},title:{color:"#f9fafb"},countrySelect:{backgroundColor:"#1f2937",color:"#f9fafb"},zipInput:{backgroundColor:"#1f2937",color:"#f9fafb"}},A={cardFormContainer:{backgroundColor:"#FAFAFA",borderRadius:"20px",border:"1px solid #E5E7EB",boxShadow:"0 8px 24px rgba(15,23,42,0.04)",padding:"24px"},cardButton:{backgroundColor:"#FFFFFF",borderRadius:"14px",border:"1.5px solid #E5E7EB",boxShadow:"0 1px 2px rgba(15,23,42,0.04)",padding:"14px 18px"},cardInputBorder:"#E5E7EB",nameInput:{backgroundColor:"#FFFFFF",border:"1.5px solid #E5E7EB",borderRadius:"14px",padding:"14px 16px"},submitButton:{backgroundColor:"#1785E0",borderRadius:"14px",padding:"16px 24px",boxShadow:"0 4px 14px rgba(23,133,224,0.25)",fontWeight:"600"},title:{color:"#0F172A",fontWeight:"600"},titleFontSize:"20px",backButton:{color:"#64748B"},backButtonIcon:{backgroundColor:"#F1F5F9"}},h={cardFormContainer:{backgroundColor:"#111827",borderRadius:"20px",border:"1px solid #1F2937",boxShadow:"0 8px 24px rgba(0,0,0,0.2)",padding:"24px"},cardButton:{backgroundColor:"#0B1220",borderRadius:"14px",border:"1.5px solid #1F2937",color:"#F1F5F9",padding:"14px 18px"},cardInputBorder:"#1F2937",cardInputBackground:"#111827",cardInputColor:"#F1F5F9",cardInputPlaceholderColor:"#64748B",nameInput:{backgroundColor:"#111827",border:"1.5px solid #1F2937",borderRadius:"14px",padding:"14px 16px",color:"#F1F5F9"},submitButton:{backgroundColor:"#60A5FA",borderRadius:"14px",padding:"16px 24px",boxShadow:"0 4px 14px rgba(96,165,250,0.3)",fontWeight:"600",color:"#0B1220"},title:{color:"#F1F5F9",fontWeight:"600"},titleFontSize:"20px",backButton:{color:"#94A3B8"},backButtonIcon:{backgroundColor:"#1F2937"},countrySelect:{backgroundColor:"#111827",color:"#F1F5F9"},zipInput:{backgroundColor:"#111827",color:"#F1F5F9"}},I={cardFormContainer:{backgroundColor:"#EFF6FF",borderRadius:"20px",border:"2px solid #1785E0",padding:"24px"},cardButton:{backgroundColor:"#FFFFFF",borderRadius:"12px",border:"2px solid #1785E0",color:"#1785E0",fontWeight:"700",padding:"14px 18px"},cardInputBorder:"#E5E7EB",nameInput:{backgroundColor:"#FFFFFF",border:"2px solid #E5E7EB",borderRadius:"12px",padding:"14px 16px",fontWeight:"500"},submitButton:{background:"linear-gradient(135deg, #1785E0 0%, #0EA5E9 100%)",borderRadius:"9999px",padding:"16px 24px",boxShadow:"0 10px 25px rgba(23,133,224,0.35)",fontWeight:"700",color:"#FFFFFF",border:"none"},submitButtonFontSize:"17px",title:{color:"#0C2B4D",fontWeight:"800",letterSpacing:"-0.02em"},titleFontSize:"22px",backButton:{color:"#1785E0",fontWeight:"600"},backButtonIcon:{backgroundColor:"#DBEAFE"}},P={cardFormContainer:{backgroundColor:"#1E3A8A",borderRadius:"20px",border:"2px solid #60A5FA",padding:"24px"},cardButton:{backgroundColor:"#0C2B4D",borderRadius:"12px",border:"2px solid #60A5FA",color:"#60A5FA",fontWeight:"700",padding:"14px 18px"},cardInputBorder:"#1E40AF",cardInputBackground:"#1E3A8A",cardInputColor:"#FFFFFF",cardInputPlaceholderColor:"#60A5FA",nameInput:{backgroundColor:"#1E3A8A",border:"2px solid #1E40AF",borderRadius:"12px",padding:"14px 16px",fontWeight:"500",color:"#FFFFFF"},submitButton:{background:"linear-gradient(135deg, #60A5FA 0%, #38BDF8 100%)",borderRadius:"9999px",padding:"16px 24px",boxShadow:"0 10px 25px rgba(96,165,250,0.35)",fontWeight:"700",color:"#FFFFFF",border:"none"},submitButtonFontSize:"17px",title:{color:"#FFFFFF",fontWeight:"800",letterSpacing:"-0.02em"},titleFontSize:"22px",backButton:{color:"#DBEAFE",fontWeight:"600"},backButtonIcon:{backgroundColor:"#1E40AF"},countrySelect:{backgroundColor:"#1E3A8A",color:"#FFFFFF"},zipInput:{backgroundColor:"#1E3A8A",color:"#FFFFFF"}},R={cardFormContainer:{background:"linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%)",borderRadius:"24px",border:"1px solid rgba(255,255,255,0.6)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.6), 0 12px 40px rgba(23,133,224,0.15)",padding:"28px"},cardButton:{backgroundColor:"rgba(255,255,255,0.7)",backdropFilter:"blur(20px)",borderRadius:"16px",border:"1px solid rgba(255,255,255,0.6)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.5), 0 4px 16px rgba(23,133,224,0.1)",padding:"14px 18px"},cardInputBorder:"rgba(255,255,255,0.6)",nameInput:{backgroundColor:"rgba(255,255,255,0.6)",backdropFilter:"blur(10px)",border:"1px solid rgba(255,255,255,0.6)",borderRadius:"14px",padding:"14px 16px"},submitButton:{backgroundColor:"rgba(23,133,224,0.95)",backdropFilter:"blur(10px)",borderRadius:"16px",padding:"16px 24px",boxShadow:"0 10px 30px rgba(23,133,224,0.3), inset 0 1px 0 rgba(255,255,255,0.2)",fontWeight:"600",color:"#FFFFFF"},title:{color:"#1E293B",fontWeight:"600",letterSpacing:"-0.01em"},titleFontSize:"20px",backButton:{color:"#1785E0",fontWeight:"500"},backButtonIcon:{backgroundColor:"rgba(255,255,255,0.7)"}},_={cardFormContainer:{background:"linear-gradient(135deg, #0C2B4D 0%, #0F172A 100%)",borderRadius:"24px",border:"1px solid rgba(255,255,255,0.08)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.06), 0 20px 50px rgba(0,0,0,0.4)",padding:"28px"},cardButton:{backgroundColor:"rgba(15,23,42,0.6)",backdropFilter:"blur(20px)",borderRadius:"16px",border:"1px solid rgba(255,255,255,0.08)",boxShadow:"inset 0 1px 0 rgba(255,255,255,0.05), 0 4px 16px rgba(0,0,0,0.3)",padding:"14px 18px",color:"#F1F5F9"},cardInputBorder:"rgba(255,255,255,0.08)",cardInputBackground:"rgba(15,23,42,0.6)",cardInputColor:"#F1F5F9",cardInputPlaceholderColor:"#64748B",nameInput:{backgroundColor:"rgba(15,23,42,0.6)",backdropFilter:"blur(10px)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"14px",padding:"14px 16px",color:"#F1F5F9"},submitButton:{backgroundColor:"rgba(96,165,250,0.9)",backdropFilter:"blur(10px)",borderRadius:"16px",padding:"16px 24px",boxShadow:"0 10px 30px rgba(96,165,250,0.35), inset 0 1px 0 rgba(255,255,255,0.15)",fontWeight:"600",color:"#0F172A"},title:{color:"#F1F5F9",fontWeight:"600",letterSpacing:"-0.01em"},titleFontSize:"20px",backButton:{color:"#60A5FA",fontWeight:"500"},backButtonIcon:{backgroundColor:"rgba(255,255,255,0.08)"},countrySelect:{backgroundColor:"rgba(15,23,42,0.6)",color:"#F1F5F9"},zipInput:{backgroundColor:"rgba(15,23,42,0.6)",color:"#F1F5F9"}};function Ke(e){switch(e){case"minimal":return ee;case"rounded":return te;case"dark":return re;case"modern-light":return A;case"modern-dark":return h;case"bold-light":return I;case"bold-dark":return P;case"glass-light":return R;case"glass-dark":return _;default:return Q}}var oe={"modern-light":{appearance:W,buttonsLayout:A},"modern-dark":{appearance:Z,buttonsLayout:h},"bold-light":{appearance:j,buttonsLayout:I},"bold-dark":{appearance:X,buttonsLayout:P},"glass-light":{appearance:$,buttonsLayout:R},"glass-dark":{appearance:J,buttonsLayout:_}};function Ve(e){if(!(!e||e==="classic"))return oe[e]}function Ye(e){switch(e){case"apple_pay":return"applePay";case"google_pay":return"googlePay";case"amazon_pay":return"amazonPay";default:return e}}function i(e,t,r){return`<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${t}"/><text x="11" y="15.5" text-anchor="middle" font-size="13" font-weight="700" font-family="-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif" fill="${r}">${e}</text></svg>`}function Be(e,t){return`<svg viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg" role="img" aria-hidden="true"><circle cx="11" cy="11" r="11" fill="${e}"/><g fill="${t}"><path d="M11 4 L17.5 8 L4.5 8 Z"/><rect x="5" y="8.4" width="12" height="1.2" rx="0.3"/><rect x="5.9" y="10" width="1.5" height="5"/><rect x="8.55" y="10" width="1.5" height="5"/><rect x="11.95" y="10" width="1.5" height="5"/><rect x="14.6" y="10" width="1.5" height="5"/><rect x="4.6" y="15.4" width="12.8" height="1.5" rx="0.3"/></g></svg>`}var He=["AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GR","HR","HU","IE","IT","LT","LU","LV","MT","NL","PL","PT","RO","SE","SI","SK","IS","LI","NO","CH","GB","MC","SM","AD","VA"],mr=[...He,"JP","MX","US"],g={apple_pay:{displayName:"Apple Pay",currencies:["*"],express:!0,needsExplicitConfirm:!1},google_pay:{displayName:"Google Pay",currencies:["*"],express:!0,needsExplicitConfirm:!1},paypal:{displayName:"PayPal",currencies:["eur","gbp","usd","cad","aud","nzd","chf","jpy","pln","sek","nok","dkk","czk","huf"],express:!0,needsExplicitConfirm:!1},link:{displayName:"Link",currencies:["usd","eur"],express:!0,needsExplicitConfirm:!1},amazon_pay:{displayName:"Amazon Pay",currencies:["usd","eur","gbp"],express:!0,needsExplicitConfirm:!1},klarna:{displayName:"Klarna",currencies:["usd","eur","gbp","aud","nzd","cad","chf","sek","nok","dkk","pln","czk","ron"],amounts:{usd:{min:100},eur:{min:100},gbp:{min:100}},theme:{light:{backgroundColor:"#FFB3C7",textColor:"#0A0B09",borderColor:"#FFB3C7",logoSvg:i("K","#0A0B09","#FFB3C7")},dark:{backgroundColor:"#FFB3C7",textColor:"#0A0B09",borderColor:"#FFB3C7",logoSvg:i("K","#0A0B09","#FFB3C7")}}},affirm:{displayName:"Affirm",currencies:["usd"],countries:["US","CA"],amounts:{usd:{min:3500,max:3e6}},needsExplicitConfirm:!1,theme:{light:{backgroundColor:"#060F33",textColor:"#FFFFFF",borderColor:"#060F33",logoSvg:i("a","#FFFFFF","#060F33")},dark:{backgroundColor:"#0FA0EA",textColor:"#060F33",borderColor:"#0FA0EA",logoSvg:i("a","#060F33","#FFFFFF")}}},cashapp:{displayName:"Cash App Pay",currencies:["usd"],countries:["US"],amounts:{usd:{min:50,max:99999999}},needsExplicitConfirm:!1,theme:{light:{backgroundColor:"#00D54B",textColor:"#0A1F0E",borderColor:"#00D54B",logoSvg:i("$","#0A1F0E","#00D54B")},dark:{backgroundColor:"#00D54B",textColor:"#0A1F0E",borderColor:"#00D54B",logoSvg:i("$","#0A1F0E","#00D54B")}}},afterpay_clearpay:{displayName:"Afterpay",currencies:["usd","aud","cad","gbp","nzd"],countries:["US","CA","GB","AU","NZ"],amounts:{usd:{min:100,max:2e5},cad:{min:100,max:2e5},gbp:{min:100,max:12e4},aud:{min:100,max:2e5},nzd:{min:100,max:2e5}},theme:{light:{backgroundColor:"#B2FCE4",textColor:"#0A0B09",borderColor:"#B2FCE4",logoSvg:i("A","#0A0B09","#B2FCE4")},dark:{backgroundColor:"#B2FCE4",textColor:"#0A0B09",borderColor:"#B2FCE4",logoSvg:i("A","#0A0B09","#B2FCE4")}}},alipay:{displayName:"Alipay",currencies:["usd","cny"],theme:{light:{backgroundColor:"#1677FF",textColor:"#FFFFFF",borderColor:"#1677FF",logoSvg:i("A","#FFFFFF","#1677FF")},dark:{backgroundColor:"#1677FF",textColor:"#FFFFFF",borderColor:"#1677FF",logoSvg:i("A","#FFFFFF","#1677FF")}}},au_becs_debit:{displayName:"BECS Direct Debit",currencies:["aud"],countries:["AU"]},bacs_debit:{displayName:"Bacs Debit",currencies:["gbp"],countries:["GB"]},bancontact:{displayName:"Bancontact",currencies:["eur"],countries:["BE"],theme:{light:{backgroundColor:"#FFDD55",textColor:"#1E3791",borderColor:"#FFDD55",logoSvg:i("B","#1E3791","#FFDD55")},dark:{backgroundColor:"#1E3791",textColor:"#FFDD55",borderColor:"#1E3791",logoSvg:i("B","#FFDD55","#1E3791")}}},bizum:{displayName:"Bizum",currencies:["eur"],countries:["ES"],theme:{light:{backgroundColor:"#00BFB3",textColor:"#FFFFFF",borderColor:"#00BFB3",logoSvg:i("B","#FFFFFF","#00BFB3")},dark:{backgroundColor:"#00BFB3",textColor:"#FFFFFF",borderColor:"#00BFB3",logoSvg:i("B","#FFFFFF","#00BFB3")}}},blik:{displayName:"BLIK",currencies:["pln"],countries:["PL"],theme:{light:{backgroundColor:"#000000",textColor:"#FFFFFF",borderColor:"#000000",logoSvg:i("B","#FFFFFF","#000000")},dark:{backgroundColor:"#FFFFFF",textColor:"#000000",borderColor:"#FFFFFF",logoSvg:i("B","#000000","#FFFFFF")}}},boleto:{displayName:"Boleto",currencies:["brl"],countries:["BR"]},customer_balance:{displayName:"Bank Transfer",currencies:["eur","usd"],countries:mr,theme:{light:{backgroundColor:"#1F2937",textColor:"#FFFFFF",borderColor:"#1F2937",logoSvg:Be("#1F2937","#FFFFFF")},dark:{backgroundColor:"#374151",textColor:"#FFFFFF",borderColor:"#374151",logoSvg:Be("#374151","#FFFFFF")}}},eps:{displayName:"EPS",currencies:["eur"],countries:["AT"],theme:{light:{backgroundColor:"#C8102E",textColor:"#FFFFFF",borderColor:"#C8102E",logoSvg:i("E","#FFFFFF","#C8102E")},dark:{backgroundColor:"#C8102E",textColor:"#FFFFFF",borderColor:"#C8102E",logoSvg:i("E","#FFFFFF","#C8102E")}}},giropay:{displayName:"Giropay",currencies:["eur"],countries:["DE"],theme:{light:{backgroundColor:"#0F4197",textColor:"#FFFFFF",borderColor:"#0F4197",logoSvg:i("G","#FFFFFF","#0F4197")},dark:{backgroundColor:"#0F4197",textColor:"#FFFFFF",borderColor:"#0F4197",logoSvg:i("G","#FFFFFF","#0F4197")}}},ideal:{displayName:"iDEAL",currencies:["eur"],countries:["NL"],theme:{light:{backgroundColor:"#CC0066",textColor:"#FFFFFF",borderColor:"#CC0066",logoSvg:i("i","#FFFFFF","#CC0066")},dark:{backgroundColor:"#CC0066",textColor:"#FFFFFF",borderColor:"#CC0066",logoSvg:i("i","#FFFFFF","#CC0066")}}},konbini:{displayName:"Konbini",currencies:["jpy"],countries:["JP"]},kr_card:{displayName:"Korean Card",currencies:["krw"],countries:["KR"],theme:{light:{backgroundColor:"#0B3D91",textColor:"#FFFFFF",borderColor:"#0B3D91",logoSvg:i("K","#FFFFFF","#0B3D91")},dark:{backgroundColor:"#0B3D91",textColor:"#FFFFFF",borderColor:"#0B3D91",logoSvg:i("K","#FFFFFF","#0B3D91")}}},multibanco:{displayName:"Multibanco",currencies:["eur"],countries:["PT"]},oxxo:{displayName:"OXXO",currencies:["mxn"],countries:["MX"]},p24:{displayName:"Przelewy24",currencies:["eur","pln"],countries:["PL"],theme:{light:{backgroundColor:"#D90F1B",textColor:"#FFFFFF",borderColor:"#D90F1B",logoSvg:i("P","#FFFFFF","#D90F1B")},dark:{backgroundColor:"#D90F1B",textColor:"#FFFFFF",borderColor:"#D90F1B",logoSvg:i("P","#FFFFFF","#D90F1B")}}},paynow:{displayName:"PayNow",currencies:["sgd"],countries:["SG"]},pix:{displayName:"Pix",currencies:["brl"],countries:["BR"]},promptpay:{displayName:"PromptPay",currencies:["thb"],countries:["TH"]},sepa_debit:{displayName:"SEPA Debit",currencies:["eur"],countries:He,theme:{light:{backgroundColor:"#10298E",textColor:"#FFFFFF",borderColor:"#10298E",logoSvg:i("\u20AC","#FFFFFF","#10298E")},dark:{backgroundColor:"#3056D3",textColor:"#FFFFFF",borderColor:"#3056D3",logoSvg:i("\u20AC","#FFFFFF","#3056D3")}}},sofort:{displayName:"Sofort",currencies:["eur"],countries:["AT","BE","DE","ES","IT","NL"],theme:{light:{backgroundColor:"#EF809F",textColor:"#FFFFFF",borderColor:"#EF809F",logoSvg:i("S","#FFFFFF","#EF809F")},dark:{backgroundColor:"#EF809F",textColor:"#FFFFFF",borderColor:"#EF809F",logoSvg:i("S","#FFFFFF","#EF809F")}}},upi:{displayName:"UPI",currencies:["inr"],countries:["IN"],theme:{light:{backgroundColor:"#FF7909",textColor:"#FFFFFF",borderColor:"#FF7909",logoSvg:i("U","#FFFFFF","#FF7909")},dark:{backgroundColor:"#FF7909",textColor:"#FFFFFF",borderColor:"#FF7909",logoSvg:i("U","#FFFFFF","#FF7909")}}},us_bank_account:{displayName:"US Bank Account",currencies:["usd"],countries:["US"]},wechat_pay:{displayName:"WeChat Pay",currencies:["usd","cny"],theme:{light:{backgroundColor:"#07C160",textColor:"#FFFFFF",borderColor:"#07C160",logoSvg:i("W","#FFFFFF","#07C160")},dark:{backgroundColor:"#07C160",textColor:"#FFFFFF",borderColor:"#07C160",logoSvg:i("W","#FFFFFF","#07C160")}}},zip:{displayName:"Zip",currencies:["aud"],countries:["AU","NZ"]}};function ze(e){return e?ke.includes(e):!1}var ne=Object.entries(g).filter(([,e])=>e.express).map(([e])=>e),gr=new Set(ne),ae=Object.fromEntries(Object.entries(g).map(([e,t])=>[e,t.currencies])),ie=Object.fromEntries(Object.entries(g).filter(([,e])=>e.countries).map(([e,t])=>[e,t.countries]));function qe(e){if(!e)return"this method";let t=g[e];return t?t.displayName:e.split("_").filter(Boolean).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function We(e){if(!e)return!0;let t=g[e];return t?t.needsExplicitConfirm!==!1:!0}function Ze(e,t){if(!e)return null;let r=g[e];return r?.theme?(typeof t=="string"&&t.endsWith("-dark")?r.theme.dark:r.theme.light)??r.theme.light??null:null}function je(e,t){if(!e?.length)return[];if(!t)return[...e];let r=t.trim().toLowerCase();return r?e.filter(o=>{let n=ae[o];return n?n.includes("*")||n.includes(r):!0}):[...e]}function Xe(e,t){if(!e?.length)return[];if(!t)return[...e];let r=t.trim().toUpperCase();return r?e.filter(o=>{let n=ie[o];return n?n.includes("*")||n.includes(r):!0}):[...e]}var se=Object.fromEntries(Object.entries(g).filter(([,e])=>e.amounts).map(([e,t])=>[e,t.amounts]));function $e(e,t,r){if(!e?.length)return[];if(!t||typeof r!="number"||!Number.isFinite(r))return[...e];let o=t.trim().toLowerCase();return o?e.filter(n=>{let c=se[n];if(!c)return!0;let d=c[o];return d?!(typeof d.min=="number"&&r<d.min||typeof d.max=="number"&&r>d.max):!0}):[...e]}function Je(e,t){if(!e?.length)return{expressMethods:[],paymentElementMethods:[]};let r=[],o=[],n=new Set,c=new Set;for(let d of e){if(typeof d!="string")continue;let l=d.trim();if(!(!l||l==="card")&&!(t?.excludePaypal&&l==="paypal"))if(gr.has(l)){if(n.has(l))continue;n.add(l),r.push(l)}else{if(c.has(l))continue;c.add(l),o.push(l)}}return{expressMethods:r,paymentElementMethods:o}}var Qe=["payment","address"],et=["visa","mastercard","mastercard_debit","amex","discover"],k={AT:{currency:"EUR",symbol:"\u20AC",country:"Austria",countryCode:"AT",tax:1},BE:{currency:"EUR",symbol:"\u20AC",country:"Belgium",countryCode:"BE",tax:1},CY:{currency:"EUR",symbol:"\u20AC",country:"Cyprus",countryCode:"CY",tax:1},DE:{currency:"EUR",symbol:"\u20AC",country:"Germany",countryCode:"DE",tax:1},EE:{currency:"EUR",symbol:"\u20AC",country:"Estonia",countryCode:"EE",tax:1},ES:{currency:"EUR",symbol:"\u20AC",country:"Spain",countryCode:"ES",tax:1},FI:{currency:"EUR",symbol:"\u20AC",country:"Finland",countryCode:"FI",tax:1},FR:{currency:"EUR",symbol:"\u20AC",country:"France",countryCode:"FR",tax:1},GR:{currency:"EUR",symbol:"\u20AC",country:"Greece",countryCode:"GR",tax:1},HR:{currency:"EUR",symbol:"\u20AC",country:"Croatia",countryCode:"HR",tax:1},IE:{currency:"EUR",symbol:"\u20AC",country:"Ireland",countryCode:"IE",tax:1},IT:{currency:"EUR",symbol:"\u20AC",country:"Italy",countryCode:"IT",tax:1},LT:{currency:"EUR",symbol:"\u20AC",country:"Lithuania",countryCode:"LT",tax:1},LU:{currency:"EUR",symbol:"\u20AC",country:"Luxembourg",countryCode:"LU",tax:1},LV:{currency:"EUR",symbol:"\u20AC",country:"Latvia",countryCode:"LV",tax:1},MT:{currency:"EUR",symbol:"\u20AC",country:"Malta",countryCode:"MT",tax:1},NL:{currency:"EUR",symbol:"\u20AC",country:"Netherlands",countryCode:"NL",tax:1},PT:{currency:"EUR",symbol:"\u20AC",country:"Portugal",countryCode:"PT",tax:1},SI:{currency:"EUR",symbol:"\u20AC",country:"Slovenia",countryCode:"SI",tax:1},SK:{currency:"EUR",symbol:"\u20AC",country:"Slovakia",countryCode:"SK",tax:1},BG:{currency:"EUR",symbol:"\u20AC",country:"Bulgaria",countryCode:"BG",tax:1},RO:{currency:"EUR",symbol:"\u20AC",country:"Romania",countryCode:"RO",tax:1},CZ:{currency:"EUR",symbol:"\u20AC",country:"Czech Republic",countryCode:"CZ",tax:1},SE:{currency:"EUR",symbol:"\u20AC",country:"Sweden",countryCode:"SE",tax:1},DK:{currency:"EUR",symbol:"\u20AC",country:"Denmark",countryCode:"DK",tax:1},PL:{currency:"EUR",symbol:"\u20AC",country:"Poland",countryCode:"PL",tax:1},HU:{currency:"EUR",symbol:"\u20AC",country:"Hungary",countryCode:"HU",tax:1},GB:{currency:"GBP",symbol:"\xA3",country:"United Kingdom",countryCode:"GB",tax:1},US:{currency:"USD",symbol:"$",country:"United States",countryCode:"US",tax:0},CA:{currency:"CAD",symbol:"CA$",country:"Canada",countryCode:"CA",tax:0},NZ:{currency:"NZD",symbol:"NZ$",country:"New Zealand",countryCode:"NZ",tax:0},AU:{currency:"AUD",symbol:"AU$",country:"Australia",countryCode:"AU",tax:0}},B={currency:"USD",symbol:"$",country:"United States",countryCode:"US",tax:0};function tt(e){switch(e.toUpperCase()){case"US":return"ZIP Code";case"GB":return"Postcode";case"CA":return"Postal Code";case"AU":case"NZ":return"Postcode";case"IE":return"Eircode";default:return"Postal Code"}}var yr=new Intl.DisplayNames(["en"],{type:"region"});function Cr(e){return[...e.toUpperCase()].map(t=>String.fromCodePoint(127397+t.charCodeAt(0))).join("")}var rt=["US","GB","CA","AU","NZ","IE","DE","FR"],Er=["AD","AE","AF","AG","AL","AM","AO","AR","AT","AU","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BN","BO","BR","BS","BT","BW","BY","BZ","CA","CD","CF","CG","CH","CI","CL","CM","CN","CO","CR","CU","CV","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","ER","ES","ET","FI","FJ","FM","FR","GA","GB","GD","GE","GH","GM","GN","GQ","GR","GT","GW","GY","HN","HR","HT","HU","ID","IE","IL","IN","IQ","IR","IS","IT","JM","JO","JP","KE","KG","KH","KI","KM","KN","KR","KW","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MG","MH","MK","ML","MM","MN","MR","MT","MU","MV","MW","MX","MY","MZ","NA","NE","NG","NI","NL","NO","NP","NR","NZ","OM","PA","PE","PG","PH","PK","PL","PT","PW","PY","QA","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SI","SK","SL","SM","SN","SO","SR","SS","ST","SV","SY","SZ","TD","TG","TH","TJ","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","US","UY","UZ","VA","VC","VE","VN","VU","WS","XK","YE","ZA","ZM","ZW"];function Ne(e){return{code:e,name:yr.of(e)??e,flag:Cr(e)}}var Fr=new Set(rt),br=Er.filter(e=>!Fr.has(e)),de=[...rt.map(Ne),...br.map(Ne)];function ot(e){return de.find(t=>t.code===e)}var xr={country:!0,postal_code:!0};function ce(e){return e?e===!0?xr:e:null}function nt(e,t){if(e===void 0||e===!1)return!1;if(e===!0)return!0;let r=t.trim().toUpperCase();return e.some(o=>o.trim().toUpperCase()===r)}function at(e){let t=ce(e);return t?Object.values(t).some(r=>r===!0||Array.isArray(r)&&r.length>0):!1}var ue=[{code:"AL",name:"Alabama"},{code:"AK",name:"Alaska"},{code:"AZ",name:"Arizona"},{code:"AR",name:"Arkansas"},{code:"CA",name:"California"},{code:"CO",name:"Colorado"},{code:"CT",name:"Connecticut"},{code:"DE",name:"Delaware"},{code:"DC",name:"District of Columbia"},{code:"FL",name:"Florida"},{code:"GA",name:"Georgia"},{code:"HI",name:"Hawaii"},{code:"ID",name:"Idaho"},{code:"IL",name:"Illinois"},{code:"IN",name:"Indiana"},{code:"IA",name:"Iowa"},{code:"KS",name:"Kansas"},{code:"KY",name:"Kentucky"},{code:"LA",name:"Louisiana"},{code:"ME",name:"Maine"},{code:"MD",name:"Maryland"},{code:"MA",name:"Massachusetts"},{code:"MI",name:"Michigan"},{code:"MN",name:"Minnesota"},{code:"MS",name:"Mississippi"},{code:"MO",name:"Missouri"},{code:"MT",name:"Montana"},{code:"NE",name:"Nebraska"},{code:"NV",name:"Nevada"},{code:"NH",name:"New Hampshire"},{code:"NJ",name:"New Jersey"},{code:"NM",name:"New Mexico"},{code:"NY",name:"New York"},{code:"NC",name:"North Carolina"},{code:"ND",name:"North Dakota"},{code:"OH",name:"Ohio"},{code:"OK",name:"Oklahoma"},{code:"OR",name:"Oregon"},{code:"PA",name:"Pennsylvania"},{code:"RI",name:"Rhode Island"},{code:"SC",name:"South Carolina"},{code:"SD",name:"South Dakota"},{code:"TN",name:"Tennessee"},{code:"TX",name:"Texas"},{code:"UT",name:"Utah"},{code:"VT",name:"Vermont"},{code:"VA",name:"Virginia"},{code:"WA",name:"Washington"},{code:"WV",name:"West Virginia"},{code:"WI",name:"Wisconsin"},{code:"WY",name:"Wyoming"}],le=[{code:"AB",name:"Alberta"},{code:"BC",name:"British Columbia"},{code:"MB",name:"Manitoba"},{code:"NB",name:"New Brunswick"},{code:"NL",name:"Newfoundland and Labrador"},{code:"NS",name:"Nova Scotia"},{code:"NT",name:"Northwest Territories"},{code:"NU",name:"Nunavut"},{code:"ON",name:"Ontario"},{code:"PE",name:"Prince Edward Island"},{code:"QC",name:"Quebec"},{code:"SK",name:"Saskatchewan"},{code:"YT",name:"Yukon"}];function it(e){switch(e.toUpperCase()){case"US":return ue;case"CA":return le;default:return null}}function st(e){switch(e.toUpperCase()){case"US":return"State";case"CA":return"Province";case"GB":return"County";case"AU":return"State / Territory";default:return"State / Province / Region"}}var fr=[[5,5,"NY"],[10,27,"MA"],[28,29,"RI"],[30,38,"NH"],[39,49,"ME"],[50,59,"VT"],[60,69,"CT"],[70,89,"NJ"],[100,149,"NY"],[150,196,"PA"],[197,199,"DE"],[200,205,"DC"],[206,219,"MD"],[220,246,"VA"],[247,268,"WV"],[270,289,"NC"],[290,299,"SC"],[300,319,"GA"],[320,349,"FL"],[350,369,"AL"],[370,385,"TN"],[386,397,"MS"],[398,399,"GA"],[400,427,"KY"],[430,459,"OH"],[460,479,"IN"],[480,499,"MI"],[500,528,"IA"],[530,549,"WI"],[550,567,"MN"],[570,577,"SD"],[580,588,"ND"],[590,599,"MT"],[600,629,"IL"],[630,658,"MO"],[660,679,"KS"],[680,693,"NE"],[700,714,"LA"],[716,729,"AR"],[730,749,"OK"],[750,799,"TX"],[800,816,"CO"],[820,831,"WY"],[832,838,"ID"],[840,847,"UT"],[850,865,"AZ"],[870,884,"NM"],[889,898,"NV"],[900,961,"CA"],[967,968,"HI"],[970,979,"OR"],[980,994,"WA"],[995,999,"AK"]],Tr={A:"NL",B:"NS",C:"PE",E:"NB",G:"QC",H:"QC",J:"QC",K:"ON",L:"ON",M:"ON",N:"ON",P:"ON",R:"MB",S:"SK",T:"AB",V:"BC",X:"NT",Y:"YT"};function Sr(e){let t=e.replace(/\D/g,"");if(t.length<5)return null;let r=Number.parseInt(t.slice(0,3),10);if(!Number.isFinite(r))return null;for(let[o,n,c]of fr)if(r>=o&&r<=n)return c;return null}function Ar(e){let t=e.replace(/\s+/g,"").toUpperCase();if(!/^[A-Z]\d[A-Z]\d[A-Z]\d$/.test(t))return null;let r=t[0]??"";return Tr[r]??null}function dt(e,t){if(!e||!t)return null;let r=e.trim().toUpperCase(),o=t.trim();if(!o)return null;switch(r){case"US":return Sr(o);case"CA":return Ar(o);default:return null}}var hr=Gt(require("validator/lib/isPostalCode.js"),1),N=hr,ct=typeof N.default=="function"?N.default:N.default?.default;if(typeof ct!="function")throw new Error("validator/lib/isPostalCode.js interop failed: unexpected module shape. This likely means the bundler's CJS/ESM interop changed.");var ut=new Set(N.locales.map(e=>e.toUpperCase())),Ir={AUSTRALIA:"AU",BRAZIL:"BR",CANADA:"CA",CH:"CH",DENMARK:"DK",DE:"DE",DEUTSCHLAND:"DE",FRANCE:"FR",GB:"GB",GERMANY:"DE",GREATBRITAIN:"GB",GREAT_BRITAIN:"GB",INDIA:"IN",IRELAND:"IE",ITALY:"IT",JAPAN:"JP",MEXICO:"MX",NETHERLANDS:"NL",NEWZEALAND:"NZ",NORWAY:"NO",POLAND:"PL",PORTUGAL:"PT",SINGAPORE:"SG",SOUTHAFRICA:"ZA",SPAIN:"ES",SWEDEN:"SE",SWITZERLAND:"CH",UK:"GB",UNITEDKINGDOM:"GB",UNITEDSTATES:"US",US:"US",USA:"US","UNITED STATES":"US","UNITED KINGDOM":"GB","GREAT BRITAIN":"GB",ENGLAND:"GB"};function pe(e){let t=(e??"").trim().toUpperCase();return t?t.length===2?t:Ir[t]??null:null}var Pr={AU:"2000",BR:"01000-000",CA:"A1A 1A1",CH:"8001",DE:"10115",DK:"1050",ES:"28001",FR:"75008",GB:"SW1A 1AA",IE:"D02 X285",IN:"110001",IT:"00118",JP:"100-0001",MX:"06500",NL:"1012 JS",NO:"0150",NZ:"6011",PL:"00-001",PT:"1100-148",SE:"111 22",SG:"018989",US:"12345 or 12345-6789",ZA:"8001"};function lt(e){let t=pe(e);return t!==null&&ut.has(t)}function pt(e,t){let r=(t??"").trim();if(!r)return!0;let o=pe(e);if(o===null||!ut.has(o))return!0;try{return ct(r,o)}catch{return!0}}function mt(e){let t=pe(e);return t?Pr[t]:void 0}function a(e){if(typeof e!="string")return;let t=e.trim();return t.length>0?t:void 0}function v(e,t,r,o){let n=a(e);if(n)return n;for(let c of t??[]){let d=a(c.currency);if(d)return d}for(let c of r??[]){let d=a(c.currency);if(d)return d}for(let c of o??[]){let d=a(c.currency);if(d)return d}return null}function gt(e,t){let r=[];for(let o of t??[])r.push({type:"subscription",code:a(o.code)??a(o.providerPlanId),providerPlanId:o.providerPlanId,name:a(o.subscriptionName)??a(o.providerPlanName)??null,subscriptionName:o.subscriptionName??null,providerPlanName:o.providerPlanName??null,quantity:o.quantity,totalAmount:o.totalAmount,overrideAmount:o.overrideAmount,currency:o.currency,metadata:o.metadata});for(let o of e??[])r.push({type:"item",code:a(o.code)??a(o.providerItemId),providerItemId:o.providerItemId,name:a(o.itemName)??a(o.providerItemName)??null,itemName:o.itemName??null,providerItemName:o.providerItemName??null,quantity:o.quantity,totalAmount:o.totalAmount,overrideAmount:o.overrideAmount,currency:o.currency,metadata:o.metadata});return r}function yt(e,t){let r=a(e.code)??a(e.providerItemId)??a(e.providerPlanId);if(!r)throw new Error("CheckoutProduct requires `code` (or the deprecated `providerItemId` / `providerPlanId`).");let o=a(e.name)??a(e.itemName)??a(e.providerItemName)??a(e.subscriptionName)??a(e.providerPlanName)??null,n={type:e.type,code:r,name:o,quantity:e.quantity??1,totalAmount:e.totalAmount,overrideAmount:e.overrideAmount??null,currency:a(e.currency)??t};return e.metadata&&(n.metadata=e.metadata),n}function Ct(e,t){let r=a(e.code)??a(e.providerItemId);if(!r)throw new Error("CheckoutItem requires either `code` or the deprecated `providerItemId`.");let o=a(e.itemName)??a(e.providerItemName)??null,n={code:r,providerItemId:a(e.providerItemId)??r,itemName:o,providerItemName:a(e.providerItemName)??o,quantity:e.quantity??1,totalAmount:e.totalAmount,overrideAmount:e.overrideAmount??null,currency:a(e.currency)??t};return e.metadata&&(n.metadata=e.metadata),n}function Et(e,t){let r=a(e.code)??a(e.providerPlanId);if(!r)throw new Error("CheckoutSubscription requires either `code` or the deprecated `providerPlanId`.");let o=a(e.subscriptionName)??a(e.providerPlanName)??null,n={code:r,providerPlanId:a(e.providerPlanId)??r,subscriptionName:o,providerPlanName:a(e.providerPlanName)??o,quantity:e.quantity??1,totalAmount:e.totalAmount,overrideAmount:e.overrideAmount??null,currency:a(e.currency)??t};return e.metadata&&(n.metadata=e.metadata),n}function Ft(e,t={}){let r=[],o=e.products??[],n=o.filter(s=>s.type==="subscription"),c=o.filter(s=>s.type!=="subscription"),l=(v(e.currency,void 0,void 0,o)??"USD").toUpperCase();for(let s of n){let m=s.totalAmount??0,F=s.overrideAmount??m,M=s.name||s.code||"Subscription";M==="4-WEEK PLAN"&&F<=1&&(M="7-DAY TRIAL: FULL ACCESS"),r.push({name:M,quantity:s.quantity,price:F,originalPrice:m})}if(!(t.hideBundledItems===!0&&n.length>0&&c.length>0))for(let s of c){let m=s.totalAmount??0,F=s.overrideAmount??m;r.push({name:s.name||s.code||"Item",quantity:s.quantity,price:F,originalPrice:m})}r.length===0&&r.push({name:"Purchase",quantity:1,price:e.amount/100,originalPrice:e.amount/100});let Rt=r.reduce((s,m)=>s+m.originalPrice*m.quantity,0),_t=r.reduce((s,m)=>s+m.price*m.quantity,0),kt=typeof e.totalAmount=="number"&&Number.isFinite(e.totalAmount),Bt=typeof e.subtotalAmount=="number"&&Number.isFinite(e.subtotalAmount),Nt=typeof e.discountAmount=="number"&&Number.isFinite(e.discountAmount),ge=kt?e.totalAmount:_t,E=Bt?e.subtotalAmount:Rt,ye=Math.max(0,E-ge),vt=E>0?Math.round(ye/E*100):0;return{items:r,currency:l,total:ge,originalTotal:E,totalSave:ye,discountPercent:vt,...Nt?{couponDiscount:e.discountAmount}:{}}}function bt(e){return k[e.toUpperCase()]??B}function xt(e){return/^pk_(test|live)_[A-Za-z0-9]+$/.test(e)}function ft(e){return/^sk_(test|live)_[A-Za-z0-9]+$/.test(e)}function Tt(e){return typeof e=="string"&&e.startsWith("seti_")}var St="Idempotency-Key",D=255,At="IdempotencyKeyInProgress";function Rr(){let e=globalThis.crypto;if(e&&(typeof e.randomUUID=="function"||typeof e.getRandomValues=="function"))return e}function me(){let e=Rr();if(!e)return;if(typeof e.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,r=>r.toString(16).padStart(2,"0")).join("")}function ht(e){if(e===void 0)return me();if(typeof e!="string"||e.trim()==="")throw new p("idempotencyKey must be a non-empty string identifying exactly one checkout creation.","validation_error",{code:"InvalidIdempotencyKey",param:"idempotencyKey"});if(e.length>D)throw new p(`idempotencyKey must be at most ${D} characters.`,"validation_error",{code:"InvalidIdempotencyKey",param:"idempotencyKey"});return e}var L=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function It(e){return typeof e=="string"&&L.test(e)}function Pt(){try{let r=globalThis.crypto.randomUUID();if(L.test(r))return r}catch{}let e=new Uint8Array(16);try{globalThis.crypto.getRandomValues(e)}catch{for(let r=0;r<e.length;r+=1)e[r]=Math.floor(Math.random()*256)}e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=[...e].map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}0&&(module.exports={BILLING_API_URL,BILLING_API_URL_PRODUCTION,BILLING_API_URL_STAGING,BOLD_DARK_APPEARANCE,BOLD_LIGHT_APPEARANCE,BUTTONS_LAYOUT_BOLD_DARK,BUTTONS_LAYOUT_BOLD_LIGHT,BUTTONS_LAYOUT_DARK,BUTTONS_LAYOUT_DEFAULT,BUTTONS_LAYOUT_GLASS_DARK,BUTTONS_LAYOUT_GLASS_LIGHT,BUTTONS_LAYOUT_MINIMAL,BUTTONS_LAYOUT_MODERN_DARK,BUTTONS_LAYOUT_MODERN_LIGHT,BUTTONS_LAYOUT_ROUNDED,CA_PROVINCES,COUNTRY_OPTIONS,CURRENCY_MAP,DEFAULT_API_BASE_URL,DEFAULT_API_VERSION,DEFAULT_APPEARANCE,DEFAULT_CURRENCY,ELEMENT_TYPES,FLAT_APPEARANCE,FLO_SDK_VERSION_HEADER,FloPayError,GLASS_DARK_APPEARANCE,GLASS_LIGHT_APPEARANCE,IDEMPOTENCY_IN_PROGRESS_CODE,IDEMPOTENCY_KEY_HEADER,MAX_IDEMPOTENCY_KEY_LENGTH,MODERN_DARK_APPEARANCE,MODERN_LIGHT_APPEARANCE,NIGHT_APPEARANCE,SDK_VERSION,STRIPE_EXPRESS_METHODS,STRIPE_METHOD_AMOUNT_LIMITS,STRIPE_METHOD_COUNTRIES,STRIPE_METHOD_CURRENCIES,STRIPE_METHOD_MATRIX,SUPPORTED_CARD_BRANDS,TELEMETRY_ERROR_CODES,TELEMETRY_LOG_NAMES,TELEMETRY_MAX_BATCH_BYTES,TELEMETRY_MAX_BATCH_EVENTS,TELEMETRY_SCHEMA_VERSION,TELEMETRY_SDK_PACKAGES,THEMES,US_STATES,UUID_V4,apiError,authenticationError,buildCheckoutDisplayData,buildItemPayload,buildProductPayload,buildSubscriptionPayload,buildTelemetryErrorEvent,buildTelemetryLogEvent,buildTelemetryPerformanceEvent,buildTelemetryTerminalEvent,configureFlopay,filterStripeMethodsByAmount,filterStripeMethodsByCountry,filterStripeMethodsByCurrency,foldIntoProducts,generateIdempotencyKey,getConfiguredBillingApiUrl,getCountryByCode,getCurrencyByCountry,getFloPayEnvironment,getPostalCodeExample,getPostalCodeLabel,getStateFromPostalCode,getStateLabel,getStateOptions,getStripeMethodDisplayName,hasVendoredStripeMethodLogo,isAVSEnabled,isAVSFieldVisible,isPostalCodeSupported,isSetupIntentClientSecret,isUuidV4,isValidPostalCode,isValidPublishableKey,isValidSecretKey,needsStripeMethodExplicitConfirm,networkError,normalizeGatewayEnvironment,partitionStripeMethods,randomUuidV4,rateLimitError,resolveAVSConfig,resolveBillingApiUrl,resolveButtonsLayoutTheme,resolveIdempotencyKey,resolveSessionCurrency,resolveStripeMethodBrandVariant,resolveTheme,serializeTelemetryBatch,stripeExpressMethodToOptionKey,validationError});
|