@flopay/shared 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/index.cjs +31 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +115 -69
- package/dist/index.d.ts +115 -69
- package/dist/index.mjs +28 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1629,10 +1629,6 @@ function partitionStripeMethods(enabledPaymentMethods, options) {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
var ELEMENT_TYPES = [
|
|
1631
1631
|
"payment",
|
|
1632
|
-
"card",
|
|
1633
|
-
"cardNumber",
|
|
1634
|
-
"cardExpiry",
|
|
1635
|
-
"cardCvc",
|
|
1636
1632
|
"address"
|
|
1637
1633
|
];
|
|
1638
1634
|
var SUPPORTED_CARD_BRANDS = [
|
|
@@ -2486,6 +2482,31 @@ function resolveIdempotencyKey(supplied) {
|
|
|
2486
2482
|
}
|
|
2487
2483
|
return supplied;
|
|
2488
2484
|
}
|
|
2485
|
+
|
|
2486
|
+
// src/uuid.ts
|
|
2487
|
+
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;
|
|
2488
|
+
function isUuidV4(value) {
|
|
2489
|
+
return typeof value === "string" && UUID_V42.test(value);
|
|
2490
|
+
}
|
|
2491
|
+
function randomUuidV4() {
|
|
2492
|
+
try {
|
|
2493
|
+
const id = globalThis.crypto.randomUUID();
|
|
2494
|
+
if (UUID_V42.test(id)) return id;
|
|
2495
|
+
} catch {
|
|
2496
|
+
}
|
|
2497
|
+
const bytes = new Uint8Array(16);
|
|
2498
|
+
try {
|
|
2499
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
2500
|
+
} catch {
|
|
2501
|
+
for (let index = 0; index < bytes.length; index += 1) {
|
|
2502
|
+
bytes[index] = Math.floor(Math.random() * 256);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
2506
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
2507
|
+
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
2508
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
2509
|
+
}
|
|
2489
2510
|
export {
|
|
2490
2511
|
BILLING_API_URL,
|
|
2491
2512
|
BILLING_API_URL_PRODUCTION,
|
|
@@ -2536,6 +2557,7 @@ export {
|
|
|
2536
2557
|
TELEMETRY_SDK_PACKAGES,
|
|
2537
2558
|
THEMES,
|
|
2538
2559
|
US_STATES,
|
|
2560
|
+
UUID_V42 as UUID_V4,
|
|
2539
2561
|
apiError,
|
|
2540
2562
|
authenticationError,
|
|
2541
2563
|
buildCheckoutDisplayData,
|
|
@@ -2567,6 +2589,7 @@ export {
|
|
|
2567
2589
|
isAVSFieldVisible,
|
|
2568
2590
|
isPostalCodeSupported,
|
|
2569
2591
|
isSetupIntentClientSecret,
|
|
2592
|
+
isUuidV4,
|
|
2570
2593
|
isValidPostalCode,
|
|
2571
2594
|
isValidPublishableKey,
|
|
2572
2595
|
isValidSecretKey,
|
|
@@ -2574,6 +2597,7 @@ export {
|
|
|
2574
2597
|
networkError,
|
|
2575
2598
|
normalizeGatewayEnvironment,
|
|
2576
2599
|
partitionStripeMethods,
|
|
2600
|
+
randomUuidV4,
|
|
2577
2601
|
rateLimitError,
|
|
2578
2602
|
resolveAVSConfig,
|
|
2579
2603
|
resolveBillingApiUrl,
|