@sesionario/blocks 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,6 +29,19 @@ Peer dependencies (install in the consuming app as needed):
29
29
  - `react-phone-number-input` (PhoneInput — also import its CSS in your app layout)
30
30
  - `hls.js` (optional — VideoPlayer)
31
31
 
32
+ ### Payment icons (`PaymentIcon`)
33
+
34
+ `PaymentIcon` wraps [`react-svg-credit-card-payment-icons`](https://www.npmjs.com/package/react-svg-credit-card-payment-icons) (pulled in as a dependency of this package). Pass a Stripe `card.brand` code:
35
+
36
+ ```tsx
37
+ import { PaymentIcon, formatPaymentCardBrand } from "@sesionario/blocks";
38
+
39
+ <PaymentIcon brand="amex" />
40
+ <span>{formatPaymentCardBrand("amex")}</span> {/* American Express */}
41
+ ```
42
+
43
+ Unknown or null brands render the Generic mark. Icon artwork is Apache-2.0 (Aaron Fagan / upstream package).
44
+
32
45
  ### Chat UI (`MessageScroller`, `ChatMessageList`, …)
33
46
 
34
47
  Apps that render chat scrollers should define this utility in global CSS (used by `MessageScrollerViewport`):
package/dist/index.cjs CHANGED
@@ -22,6 +22,7 @@ var cmdk = require('cmdk');
22
22
  var RPNInput = require('react-phone-number-input');
23
23
  var flags = require('react-phone-number-input/flags');
24
24
  var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
25
+ var reactSvgCreditCardPaymentIcons = require('react-svg-credit-card-payment-icons');
25
26
  var messageScroller = require('@shadcn/react/message-scroller');
26
27
 
27
28
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -6510,6 +6511,63 @@ function MexicoMap({ selected, onToggle, className }) {
6510
6511
  }
6511
6512
  );
6512
6513
  }
6514
+
6515
+ // src/lib/paymentCardBrand.ts
6516
+ var CARD_BRAND_LABELS = {
6517
+ visa: "Visa",
6518
+ mastercard: "Mastercard",
6519
+ amex: "American Express",
6520
+ discover: "Discover",
6521
+ diners: "Diners Club",
6522
+ jcb: "JCB",
6523
+ unionpay: "UnionPay"
6524
+ };
6525
+ var STRIPE_TO_PAYMENT_TYPE = {
6526
+ visa: "Visa",
6527
+ mastercard: "Mastercard",
6528
+ amex: "AmericanExpress",
6529
+ discover: "Discover",
6530
+ diners: "DinersClub",
6531
+ jcb: "JCB",
6532
+ unionpay: "UnionPay"
6533
+ };
6534
+ function normalizePaymentCardBrand(brand) {
6535
+ if (!brand?.trim()) return null;
6536
+ return brand.trim().toLowerCase();
6537
+ }
6538
+ function formatPaymentCardBrand(brand) {
6539
+ if (!brand?.trim()) return "Card";
6540
+ const key = brand.trim().toLowerCase();
6541
+ const known = CARD_BRAND_LABELS[key];
6542
+ if (known) return known;
6543
+ return key.charAt(0).toUpperCase() + key.slice(1);
6544
+ }
6545
+ function paymentTypeFromStripeBrand(brand) {
6546
+ const key = normalizePaymentCardBrand(brand);
6547
+ if (!key) return "Generic";
6548
+ return STRIPE_TO_PAYMENT_TYPE[key] ?? "Generic";
6549
+ }
6550
+ var DEFAULT_FORMAT = "flatRounded";
6551
+ var DEFAULT_WIDTH = 36;
6552
+ function PaymentIcon({
6553
+ brand,
6554
+ format = DEFAULT_FORMAT,
6555
+ width = DEFAULT_WIDTH,
6556
+ height,
6557
+ className
6558
+ }) {
6559
+ return /* @__PURE__ */ jsxRuntime.jsx(
6560
+ reactSvgCreditCardPaymentIcons.PaymentIcon,
6561
+ {
6562
+ type: paymentTypeFromStripeBrand(brand),
6563
+ format,
6564
+ width,
6565
+ height,
6566
+ className: cn("inline-block shrink-0", className),
6567
+ "aria-hidden": true
6568
+ }
6569
+ );
6570
+ }
6513
6571
  function MessageGroup({ className, ...props }) {
6514
6572
  return /* @__PURE__ */ jsxRuntime.jsx(
6515
6573
  "div",
@@ -7901,6 +7959,7 @@ exports.MessageScrollerViewport = MessageScrollerViewport;
7901
7959
  exports.MexicoMap = MexicoMap;
7902
7960
  exports.OrgSwitcher = OrgSwitcher;
7903
7961
  exports.PLATFORM_ACCOUNT_ORG_COLLAPSE_AT = PLATFORM_ACCOUNT_ORG_COLLAPSE_AT;
7962
+ exports.PaymentIcon = PaymentIcon;
7904
7963
  exports.PhoneInput = PhoneInput;
7905
7964
  exports.PlatformAccountMenu = PlatformAccountMenu;
7906
7965
  exports.PlatformNavbar = PlatformNavbar;
@@ -7919,6 +7978,7 @@ exports.createVodHlsConfig = createVodHlsConfig;
7919
7978
  exports.defaultLanguages = defaultLanguages;
7920
7979
  exports.describeAvResync = describeAvResync;
7921
7980
  exports.describePlaybackError = describePlaybackError;
7981
+ exports.formatPaymentCardBrand = formatPaymentCardBrand;
7922
7982
  exports.fuzzyMatch = fuzzyMatch;
7923
7983
  exports.getAvatarColors = getAvatarColors;
7924
7984
  exports.getInitials = getInitials;
@@ -7926,6 +7986,8 @@ exports.insertAtCaret = insertAtCaret;
7926
7986
  exports.markerVariants = markerVariants;
7927
7987
  exports.mergePlatformAccountOrgs = mergePlatformAccountOrgs;
7928
7988
  exports.normalizeEmojiQuery = normalizeEmojiQuery;
7989
+ exports.normalizePaymentCardBrand = normalizePaymentCardBrand;
7990
+ exports.paymentTypeFromStripeBrand = paymentTypeFromStripeBrand;
7929
7991
  exports.shouldRetryLiveEdge404 = shouldRetryLiveEdge404;
7930
7992
  exports.useDebouncedValue = useDebouncedValue;
7931
7993
  exports.useDebouncedValueStrict = useDebouncedValueStrict;