@reevit/react 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +96 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -7
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +152 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1388,6 +1388,87 @@ function loadStripeScript() {
|
|
|
1388
1388
|
});
|
|
1389
1389
|
return stripeScriptPromise;
|
|
1390
1390
|
}
|
|
1391
|
+
var getReevitStripeAppearance = () => {
|
|
1392
|
+
const isDarkMode = typeof window !== "undefined" && window.matchMedia?.("(prefers-color-scheme: dark)").matches;
|
|
1393
|
+
return {
|
|
1394
|
+
theme: isDarkMode ? "night" : "stripe",
|
|
1395
|
+
variables: {
|
|
1396
|
+
colorPrimary: isDarkMode ? "#fafafa" : "#171717",
|
|
1397
|
+
colorBackground: isDarkMode ? "#171717" : "#ffffff",
|
|
1398
|
+
colorText: isDarkMode ? "#fafafa" : "#171717",
|
|
1399
|
+
colorTextSecondary: isDarkMode ? "#a3a3a3" : "#737373",
|
|
1400
|
+
colorTextPlaceholder: isDarkMode ? "#737373" : "#a3a3a3",
|
|
1401
|
+
colorDanger: "#dc2626",
|
|
1402
|
+
fontFamily: '"Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
|
|
1403
|
+
fontSizeBase: "14px",
|
|
1404
|
+
fontSizeSm: "12px",
|
|
1405
|
+
fontSizeLg: "16px",
|
|
1406
|
+
fontWeightNormal: "400",
|
|
1407
|
+
fontWeightMedium: "500",
|
|
1408
|
+
fontWeightBold: "600",
|
|
1409
|
+
borderRadius: "10px",
|
|
1410
|
+
spacingUnit: "4px",
|
|
1411
|
+
spacingGridRow: "16px",
|
|
1412
|
+
spacingGridColumn: "16px"
|
|
1413
|
+
},
|
|
1414
|
+
rules: {
|
|
1415
|
+
".Input": {
|
|
1416
|
+
border: isDarkMode ? "1px solid rgba(255, 255, 255, 0.1)" : "1px solid #e5e5e5",
|
|
1417
|
+
boxShadow: "none",
|
|
1418
|
+
padding: "12px 14px",
|
|
1419
|
+
fontSize: "14px",
|
|
1420
|
+
backgroundColor: isDarkMode ? "#262626" : "#ffffff"
|
|
1421
|
+
},
|
|
1422
|
+
".Input:focus": {
|
|
1423
|
+
border: isDarkMode ? "1px solid #a3a3a3" : "1px solid #737373",
|
|
1424
|
+
boxShadow: "none",
|
|
1425
|
+
backgroundColor: isDarkMode ? "#262626" : "#fafafa"
|
|
1426
|
+
},
|
|
1427
|
+
".Input--invalid": {
|
|
1428
|
+
border: "1px solid #dc2626",
|
|
1429
|
+
boxShadow: "none"
|
|
1430
|
+
},
|
|
1431
|
+
".Label": {
|
|
1432
|
+
fontSize: "12px",
|
|
1433
|
+
fontWeight: "500",
|
|
1434
|
+
marginBottom: "6px",
|
|
1435
|
+
color: isDarkMode ? "#a3a3a3" : "#737373",
|
|
1436
|
+
textTransform: "none",
|
|
1437
|
+
letterSpacing: "0.02em"
|
|
1438
|
+
},
|
|
1439
|
+
".Tab": {
|
|
1440
|
+
border: isDarkMode ? "1px solid rgba(255, 255, 255, 0.1)" : "1px solid #e5e5e5",
|
|
1441
|
+
backgroundColor: "transparent",
|
|
1442
|
+
borderRadius: "10px",
|
|
1443
|
+
padding: "12px 14px"
|
|
1444
|
+
},
|
|
1445
|
+
".Tab:hover": {
|
|
1446
|
+
border: isDarkMode ? "1px solid #a3a3a3" : "1px solid #737373",
|
|
1447
|
+
backgroundColor: isDarkMode ? "#262626" : "#fafafa"
|
|
1448
|
+
},
|
|
1449
|
+
".Tab--selected": {
|
|
1450
|
+
border: isDarkMode ? "1px solid #fafafa" : "1px solid #171717",
|
|
1451
|
+
backgroundColor: isDarkMode ? "#262626" : "#fafafa"
|
|
1452
|
+
},
|
|
1453
|
+
".TabIcon": {
|
|
1454
|
+
marginRight: "8px"
|
|
1455
|
+
},
|
|
1456
|
+
".Block": {
|
|
1457
|
+
border: isDarkMode ? "1px solid rgba(255, 255, 255, 0.1)" : "1px solid #e5e5e5",
|
|
1458
|
+
borderRadius: "10px",
|
|
1459
|
+
backgroundColor: isDarkMode ? "#262626" : "#ffffff",
|
|
1460
|
+
padding: "12px 14px"
|
|
1461
|
+
},
|
|
1462
|
+
".CheckboxInput": {
|
|
1463
|
+
border: isDarkMode ? "1px solid rgba(255, 255, 255, 0.1)" : "1px solid #e5e5e5"
|
|
1464
|
+
},
|
|
1465
|
+
".CheckboxInput--checked": {
|
|
1466
|
+
backgroundColor: isDarkMode ? "#fafafa" : "#171717",
|
|
1467
|
+
borderColor: isDarkMode ? "#fafafa" : "#171717"
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
};
|
|
1391
1472
|
function StripeBridge({
|
|
1392
1473
|
publishableKey,
|
|
1393
1474
|
clientSecret,
|
|
@@ -1415,9 +1496,10 @@ function StripeBridge({
|
|
|
1415
1496
|
throw new Error("Stripe not available");
|
|
1416
1497
|
}
|
|
1417
1498
|
stripeRef.current = window.Stripe(publishableKey);
|
|
1499
|
+
const stripeAppearance = appearance || getReevitStripeAppearance();
|
|
1418
1500
|
elementsRef.current = stripeRef.current.elements({
|
|
1419
1501
|
clientSecret,
|
|
1420
|
-
appearance:
|
|
1502
|
+
appearance: stripeAppearance
|
|
1421
1503
|
});
|
|
1422
1504
|
paymentElementRef.current = elementsRef.current.create("payment");
|
|
1423
1505
|
if (containerRef.current) {
|
|
@@ -1487,6 +1569,12 @@ function StripeBridge({
|
|
|
1487
1569
|
setIsSubmitting(false);
|
|
1488
1570
|
}
|
|
1489
1571
|
}, [onSuccess, onError]);
|
|
1572
|
+
const formattedAmount = new Intl.NumberFormat("en-US", {
|
|
1573
|
+
style: "currency",
|
|
1574
|
+
currency: currency.toUpperCase(),
|
|
1575
|
+
minimumFractionDigits: 2,
|
|
1576
|
+
maximumFractionDigits: 2
|
|
1577
|
+
}).format(amount / 100);
|
|
1490
1578
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-stripe-bridge", children: [
|
|
1491
1579
|
isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-stripe-loading", children: [
|
|
1492
1580
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-spinner" }),
|
|
@@ -1500,8 +1588,8 @@ function StripeBridge({
|
|
|
1500
1588
|
style: { display: isLoading ? "none" : "block", minHeight: "200px" }
|
|
1501
1589
|
}
|
|
1502
1590
|
),
|
|
1503
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-stripe-error", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: error }) }),
|
|
1504
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-stripe-actions", children: [
|
|
1591
|
+
error && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-stripe-error", children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: error }) }),
|
|
1592
|
+
!isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-stripe-actions", children: [
|
|
1505
1593
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1506
1594
|
"button",
|
|
1507
1595
|
{
|
|
@@ -1509,11 +1597,12 @@ function StripeBridge({
|
|
|
1509
1597
|
className: "reevit-submit-btn",
|
|
1510
1598
|
onClick: handleSubmit,
|
|
1511
1599
|
disabled: isLoading || isSubmitting,
|
|
1512
|
-
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.
|
|
1600
|
+
children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1601
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-spinner", style: { width: "16px", height: "16px" } }),
|
|
1602
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Processing..." })
|
|
1603
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1513
1604
|
"Pay ",
|
|
1514
|
-
|
|
1515
|
-
" ",
|
|
1516
|
-
(amount / 100).toFixed(2)
|
|
1605
|
+
formattedAmount
|
|
1517
1606
|
] })
|
|
1518
1607
|
}
|
|
1519
1608
|
),
|