@schematichq/schematic-components 0.3.4 → 0.3.6

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.
@@ -7643,7 +7643,8 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7643
7643
  paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
7644
7644
  subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
7645
7645
  subtotal: json["subtotal"],
7646
- updatedAt: new Date(json["updated_at"])
7646
+ updatedAt: new Date(json["updated_at"]),
7647
+ url: json["url"] == null ? void 0 : json["url"]
7647
7648
  };
7648
7649
  }
7649
7650
 
@@ -7656,6 +7657,11 @@ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7656
7657
  return json;
7657
7658
  }
7658
7659
  return {
7660
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
7661
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
7662
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
7663
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
7664
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
7659
7665
  cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
7660
7666
  cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
7661
7667
  cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
@@ -8709,7 +8715,7 @@ var EmbedProvider = ({
8709
8715
  (0, import_react2.useEffect)(() => {
8710
8716
  if (accessToken) {
8711
8717
  const { headers = {} } = apiConfig ?? {};
8712
- headers["X-Schematic-Components-Version"] = "0.3.4";
8718
+ headers["X-Schematic-Components-Version"] = "0.3.6";
8713
8719
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
8714
8720
  const config = new Configuration({
8715
8721
  ...apiConfig,
@@ -11605,126 +11611,113 @@ var MeteredFeatures = (0, import_react18.forwardRef)(({ className, ...rest }, re
11605
11611
  const theme = nt();
11606
11612
  const { data } = useEmbed();
11607
11613
  const isLightBackground = useIsLightBackground();
11608
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { ref, className, $flexDirection: "column", children: props.visibleFeatures.length > 0 ? (data.featureUsage?.features || []).reduce(
11609
- (acc, { allocation, feature, usage }, index) => {
11610
- if (feature?.id && !props.visibleFeatures?.includes(feature.id) || feature?.featureType !== "event" && feature?.featureType !== "trait") {
11611
- return acc;
11612
- }
11613
- return [
11614
- ...acc,
11615
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
11616
- props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11617
- IconRound,
11618
- {
11619
- name: feature.icon,
11620
- size: "sm",
11621
- colors: [
11622
- theme.primary,
11623
- isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
11624
- ]
11625
- }
11626
- ),
11627
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
11628
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11629
- Flex,
11630
- {
11631
- ref: (el) => el && elements.current.push(el),
11632
- $flexWrap: "wrap",
11633
- $gap: "1rem",
11634
- children: [
11635
- feature?.name && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
11636
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11614
+ const features = (data.featureUsage?.features || []).filter(({ feature }) => {
11615
+ return (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.id && props.visibleFeatures?.includes(feature.id);
11616
+ });
11617
+ if (features.length === 0) {
11618
+ return null;
11619
+ }
11620
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { ref, className, $flexDirection: "column", children: features.map(({ allocation, feature, usage }, index) => {
11621
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
11622
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11623
+ IconRound,
11624
+ {
11625
+ name: feature.icon,
11626
+ size: "sm",
11627
+ colors: [
11628
+ theme.primary,
11629
+ isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
11630
+ ]
11631
+ }
11632
+ ),
11633
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
11634
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11635
+ Flex,
11636
+ {
11637
+ ref: (el) => el && elements.current.push(el),
11638
+ $flexWrap: "wrap",
11639
+ $gap: "1rem",
11640
+ children: [
11641
+ feature?.name && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
11642
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11643
+ Text,
11644
+ {
11645
+ as: Box,
11646
+ $font: theme.typography[props.header.fontStyle].fontFamily,
11647
+ $size: theme.typography[props.header.fontStyle].fontSize,
11648
+ $weight: theme.typography[props.header.fontStyle].fontWeight,
11649
+ $color: theme.typography[props.header.fontStyle].color,
11650
+ children: feature.name
11651
+ }
11652
+ ),
11653
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11654
+ Text,
11655
+ {
11656
+ as: Box,
11657
+ $font: theme.typography[props.description.fontStyle].fontFamily,
11658
+ $size: theme.typography[props.description.fontStyle].fontSize,
11659
+ $weight: theme.typography[props.description.fontStyle].fontWeight,
11660
+ $color: theme.typography[props.description.fontStyle].color,
11661
+ children: feature.description
11662
+ }
11663
+ )
11664
+ ] }),
11665
+ (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11666
+ Box,
11667
+ {
11668
+ $flexBasis: "min-content",
11669
+ $flexGrow: "1",
11670
+ $textAlign: shouldWrapChildren ? "left" : "right",
11671
+ children: [
11672
+ props.usage.isVisible && typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11637
11673
  Text,
11638
11674
  {
11639
11675
  as: Box,
11640
- $font: theme.typography[props.header.fontStyle].fontFamily,
11641
- $size: theme.typography[props.header.fontStyle].fontSize,
11642
- $weight: theme.typography[props.header.fontStyle].fontWeight,
11643
- $color: theme.typography[props.header.fontStyle].color,
11644
- children: feature.name
11676
+ $font: theme.typography[props.usage.fontStyle].fontFamily,
11677
+ $size: theme.typography[props.usage.fontStyle].fontSize,
11678
+ $weight: theme.typography[props.usage.fontStyle].fontWeight,
11679
+ $lineHeight: 1.25,
11680
+ $color: theme.typography[props.usage.fontStyle].color,
11681
+ children: [
11682
+ formatNumber(usage),
11683
+ " ",
11684
+ (0, import_pluralize3.default)(feature.name, usage)
11685
+ ]
11645
11686
  }
11646
11687
  ),
11647
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11688
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11648
11689
  Text,
11649
11690
  {
11650
- as: Box,
11651
- $font: theme.typography[props.description.fontStyle].fontFamily,
11652
- $size: theme.typography[props.description.fontStyle].fontSize,
11653
- $weight: theme.typography[props.description.fontStyle].fontWeight,
11654
- $color: theme.typography[props.description.fontStyle].color,
11655
- children: feature.description
11691
+ $font: theme.typography[props.allocation.fontStyle].fontFamily,
11692
+ $size: theme.typography[props.allocation.fontStyle].fontSize,
11693
+ $weight: theme.typography[props.allocation.fontStyle].fontWeight,
11694
+ $color: theme.typography[props.allocation.fontStyle].color,
11695
+ children: typeof allocation === "number" ? `Limit of ${formatNumber(allocation)}` : "No limit"
11656
11696
  }
11657
- )
11658
- ] }),
11659
- (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11660
- Box,
11661
- {
11662
- $flexBasis: "min-content",
11663
- $flexGrow: "1",
11664
- $textAlign: shouldWrapChildren ? "left" : "right",
11665
- children: [
11666
- props.usage.isVisible && typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11667
- Text,
11668
- {
11669
- as: Box,
11670
- $font: theme.typography[props.usage.fontStyle].fontFamily,
11671
- $size: theme.typography[props.usage.fontStyle].fontSize,
11672
- $weight: theme.typography[props.usage.fontStyle].fontWeight,
11673
- $lineHeight: 1.25,
11674
- $color: theme.typography[props.usage.fontStyle].color,
11675
- children: [
11676
- formatNumber(usage),
11677
- " ",
11678
- (0, import_pluralize3.default)(feature.name, usage)
11679
- ]
11680
- }
11681
- ),
11682
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11683
- Text,
11684
- {
11685
- $font: theme.typography[props.allocation.fontStyle].fontFamily,
11686
- $size: theme.typography[props.allocation.fontStyle].fontSize,
11687
- $weight: theme.typography[props.allocation.fontStyle].fontWeight,
11688
- $color: theme.typography[props.allocation.fontStyle].color,
11689
- children: typeof allocation === "number" ? `Limit of ${formatNumber(allocation)}` : "No limit"
11690
- }
11691
- ) })
11692
- ]
11693
- }
11694
- )
11695
- ]
11696
- }
11697
- ),
11698
- props.isVisible && typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11699
- ProgressBar,
11700
- {
11701
- progress: usage / allocation * 100,
11702
- value: usage,
11703
- total: allocation,
11704
- color: [
11705
- "blue",
11706
- "blue",
11707
- "yellow",
11708
- "red"
11709
- ][Math.floor(usage / allocation * 4)]
11710
- }
11711
- ) })
11712
- ] })
11713
- ] }, index)
11714
- ];
11715
- },
11716
- []
11717
- ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Element, { as: Flex, $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11718
- Text,
11719
- {
11720
- $font: theme.typography.heading1.fontFamily,
11721
- $size: theme.typography.heading1.fontSize,
11722
- $weight: theme.typography.heading1.fontWeight,
11723
- $color: theme.typography.heading1.color,
11724
- $align: "center",
11725
- children: "No features selected"
11726
- }
11727
- ) }) });
11697
+ ) })
11698
+ ]
11699
+ }
11700
+ )
11701
+ ]
11702
+ }
11703
+ ),
11704
+ props.isVisible && typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11705
+ ProgressBar,
11706
+ {
11707
+ progress: usage / allocation * 100,
11708
+ value: usage,
11709
+ total: allocation,
11710
+ color: [
11711
+ "blue",
11712
+ "blue",
11713
+ "yellow",
11714
+ "red"
11715
+ ][Math.floor(usage / allocation * 4)]
11716
+ }
11717
+ ) })
11718
+ ] })
11719
+ ] }, index);
11720
+ }) });
11728
11721
  });
11729
11722
  MeteredFeatures.displayName = "MeteredFeatures";
11730
11723
 
@@ -11849,11 +11842,29 @@ function resolveDesignProps6(props) {
11849
11842
  };
11850
11843
  }
11851
11844
  function formatInvoices(invoices) {
11852
- return (invoices || []).map(({ amountDue, dueDate }) => ({
11845
+ return (invoices || []).map(({ amountDue, dueDate, url }) => ({
11853
11846
  ...dueDate && { date: toPrettyDate(dueDate) },
11854
- amount: formatCurrency(amountDue)
11847
+ amount: formatCurrency(amountDue),
11848
+ url
11855
11849
  }));
11856
11850
  }
11851
+ var InvoiceDate = ({ date, fontStyle, url }) => {
11852
+ const theme = nt();
11853
+ const dateText = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11854
+ Text,
11855
+ {
11856
+ $font: theme.typography[fontStyle].fontFamily,
11857
+ $size: theme.typography[fontStyle].fontSize,
11858
+ $weight: theme.typography[fontStyle].fontWeight,
11859
+ $color: theme.typography[fontStyle].color,
11860
+ children: date
11861
+ }
11862
+ );
11863
+ if (url) {
11864
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: url, target: "_blank", children: dateText });
11865
+ }
11866
+ return dateText;
11867
+ };
11857
11868
  var Invoices = (0, import_react20.forwardRef)(({ className, ...rest }, ref) => {
11858
11869
  const props = resolveDesignProps6(rest);
11859
11870
  const theme = nt();
@@ -11878,16 +11889,14 @@ var Invoices = (0, import_react20.forwardRef)(({ className, ...rest }, ref) => {
11878
11889
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
11879
11890
  0,
11880
11891
  props.limit.isVisible && props.limit.number || invoices.length
11881
- ).map(({ date, amount }, index) => {
11892
+ ).map(({ date, amount, url }, index) => {
11882
11893
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Flex, { $justifyContent: "space-between", children: [
11883
- props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11884
- Text,
11894
+ props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11895
+ InvoiceDate,
11885
11896
  {
11886
- $font: theme.typography[props.date.fontStyle].fontFamily,
11887
- $size: theme.typography[props.date.fontStyle].fontSize,
11888
- $weight: theme.typography[props.date.fontStyle].fontWeight,
11889
- $color: theme.typography[props.date.fontStyle].color,
11890
- children: date
11897
+ date,
11898
+ fontStyle: props.date.fontStyle,
11899
+ url
11891
11900
  }
11892
11901
  ),
11893
11902
  props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -2158,6 +2158,12 @@ declare interface InvoiceResponseData {
2158
2158
  * @memberof InvoiceResponseData
2159
2159
  */
2160
2160
  updatedAt: Date;
2161
+ /**
2162
+ *
2163
+ * @type {string}
2164
+ * @memberof InvoiceResponseData
2165
+ */
2166
+ url?: string | null;
2161
2167
  }
2162
2168
 
2163
2169
  export declare const Invoices: ForwardRefExoticComponent<ElementProps & DesignProps_6 & {
@@ -2300,6 +2306,36 @@ export declare type PaymentMethodProps = DesignProps_5;
2300
2306
  * @interface PaymentMethodResponseData
2301
2307
  */
2302
2308
  declare interface PaymentMethodResponseData {
2309
+ /**
2310
+ *
2311
+ * @type {string}
2312
+ * @memberof PaymentMethodResponseData
2313
+ */
2314
+ accountLast4?: string | null;
2315
+ /**
2316
+ *
2317
+ * @type {string}
2318
+ * @memberof PaymentMethodResponseData
2319
+ */
2320
+ accountName?: string | null;
2321
+ /**
2322
+ *
2323
+ * @type {string}
2324
+ * @memberof PaymentMethodResponseData
2325
+ */
2326
+ bankName?: string | null;
2327
+ /**
2328
+ *
2329
+ * @type {string}
2330
+ * @memberof PaymentMethodResponseData
2331
+ */
2332
+ billingEmail?: string | null;
2333
+ /**
2334
+ *
2335
+ * @type {string}
2336
+ * @memberof PaymentMethodResponseData
2337
+ */
2338
+ billingName?: string | null;
2303
2339
  /**
2304
2340
  *
2305
2341
  * @type {string}
@@ -7607,7 +7607,8 @@ function InvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7607
7607
  paymentMethodExternalId: json["payment_method_external_id"] == null ? void 0 : json["payment_method_external_id"],
7608
7608
  subscriptionExternalId: json["subscription_external_id"] == null ? void 0 : json["subscription_external_id"],
7609
7609
  subtotal: json["subtotal"],
7610
- updatedAt: new Date(json["updated_at"])
7610
+ updatedAt: new Date(json["updated_at"]),
7611
+ url: json["url"] == null ? void 0 : json["url"]
7611
7612
  };
7612
7613
  }
7613
7614
 
@@ -7620,6 +7621,11 @@ function PaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7620
7621
  return json;
7621
7622
  }
7622
7623
  return {
7624
+ accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
7625
+ accountName: json["account_name"] == null ? void 0 : json["account_name"],
7626
+ bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
7627
+ billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
7628
+ billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
7623
7629
  cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
7624
7630
  cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
7625
7631
  cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
@@ -8673,7 +8679,7 @@ var EmbedProvider = ({
8673
8679
  useEffect(() => {
8674
8680
  if (accessToken) {
8675
8681
  const { headers = {} } = apiConfig ?? {};
8676
- headers["X-Schematic-Components-Version"] = "0.3.4";
8682
+ headers["X-Schematic-Components-Version"] = "0.3.6";
8677
8683
  headers["X-Schematic-Session-ID"] = sessionIdRef.current;
8678
8684
  const config = new Configuration({
8679
8685
  ...apiConfig,
@@ -11569,126 +11575,113 @@ var MeteredFeatures = forwardRef8(({ className, ...rest }, ref) => {
11569
11575
  const theme = nt();
11570
11576
  const { data } = useEmbed();
11571
11577
  const isLightBackground = useIsLightBackground();
11572
- return /* @__PURE__ */ jsx19(Flex, { ref, className, $flexDirection: "column", children: props.visibleFeatures.length > 0 ? (data.featureUsage?.features || []).reduce(
11573
- (acc, { allocation, feature, usage }, index) => {
11574
- if (feature?.id && !props.visibleFeatures?.includes(feature.id) || feature?.featureType !== "event" && feature?.featureType !== "trait") {
11575
- return acc;
11576
- }
11577
- return [
11578
- ...acc,
11579
- /* @__PURE__ */ jsxs12(Element, { as: Flex, $gap: "1.5rem", children: [
11580
- props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx19(
11581
- IconRound,
11582
- {
11583
- name: feature.icon,
11584
- size: "sm",
11585
- colors: [
11586
- theme.primary,
11587
- isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
11588
- ]
11589
- }
11590
- ),
11591
- /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
11592
- /* @__PURE__ */ jsxs12(
11593
- Flex,
11594
- {
11595
- ref: (el) => el && elements.current.push(el),
11596
- $flexWrap: "wrap",
11597
- $gap: "1rem",
11598
- children: [
11599
- feature?.name && /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
11600
- /* @__PURE__ */ jsx19(
11578
+ const features = (data.featureUsage?.features || []).filter(({ feature }) => {
11579
+ return (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.id && props.visibleFeatures?.includes(feature.id);
11580
+ });
11581
+ if (features.length === 0) {
11582
+ return null;
11583
+ }
11584
+ return /* @__PURE__ */ jsx19(Flex, { ref, className, $flexDirection: "column", children: features.map(({ allocation, feature, usage }, index) => {
11585
+ return /* @__PURE__ */ jsxs12(Element, { as: Flex, $gap: "1.5rem", children: [
11586
+ props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx19(
11587
+ IconRound,
11588
+ {
11589
+ name: feature.icon,
11590
+ size: "sm",
11591
+ colors: [
11592
+ theme.primary,
11593
+ isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)"
11594
+ ]
11595
+ }
11596
+ ),
11597
+ /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
11598
+ /* @__PURE__ */ jsxs12(
11599
+ Flex,
11600
+ {
11601
+ ref: (el) => el && elements.current.push(el),
11602
+ $flexWrap: "wrap",
11603
+ $gap: "1rem",
11604
+ children: [
11605
+ feature?.name && /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
11606
+ /* @__PURE__ */ jsx19(
11607
+ Text,
11608
+ {
11609
+ as: Box,
11610
+ $font: theme.typography[props.header.fontStyle].fontFamily,
11611
+ $size: theme.typography[props.header.fontStyle].fontSize,
11612
+ $weight: theme.typography[props.header.fontStyle].fontWeight,
11613
+ $color: theme.typography[props.header.fontStyle].color,
11614
+ children: feature.name
11615
+ }
11616
+ ),
11617
+ props.description.isVisible && /* @__PURE__ */ jsx19(
11618
+ Text,
11619
+ {
11620
+ as: Box,
11621
+ $font: theme.typography[props.description.fontStyle].fontFamily,
11622
+ $size: theme.typography[props.description.fontStyle].fontSize,
11623
+ $weight: theme.typography[props.description.fontStyle].fontWeight,
11624
+ $color: theme.typography[props.description.fontStyle].color,
11625
+ children: feature.description
11626
+ }
11627
+ )
11628
+ ] }),
11629
+ (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs12(
11630
+ Box,
11631
+ {
11632
+ $flexBasis: "min-content",
11633
+ $flexGrow: "1",
11634
+ $textAlign: shouldWrapChildren ? "left" : "right",
11635
+ children: [
11636
+ props.usage.isVisible && typeof usage === "number" && /* @__PURE__ */ jsxs12(
11601
11637
  Text,
11602
11638
  {
11603
11639
  as: Box,
11604
- $font: theme.typography[props.header.fontStyle].fontFamily,
11605
- $size: theme.typography[props.header.fontStyle].fontSize,
11606
- $weight: theme.typography[props.header.fontStyle].fontWeight,
11607
- $color: theme.typography[props.header.fontStyle].color,
11608
- children: feature.name
11640
+ $font: theme.typography[props.usage.fontStyle].fontFamily,
11641
+ $size: theme.typography[props.usage.fontStyle].fontSize,
11642
+ $weight: theme.typography[props.usage.fontStyle].fontWeight,
11643
+ $lineHeight: 1.25,
11644
+ $color: theme.typography[props.usage.fontStyle].color,
11645
+ children: [
11646
+ formatNumber(usage),
11647
+ " ",
11648
+ (0, import_pluralize3.default)(feature.name, usage)
11649
+ ]
11609
11650
  }
11610
11651
  ),
11611
- props.description.isVisible && /* @__PURE__ */ jsx19(
11652
+ props.allocation.isVisible && /* @__PURE__ */ jsx19(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx19(
11612
11653
  Text,
11613
11654
  {
11614
- as: Box,
11615
- $font: theme.typography[props.description.fontStyle].fontFamily,
11616
- $size: theme.typography[props.description.fontStyle].fontSize,
11617
- $weight: theme.typography[props.description.fontStyle].fontWeight,
11618
- $color: theme.typography[props.description.fontStyle].color,
11619
- children: feature.description
11655
+ $font: theme.typography[props.allocation.fontStyle].fontFamily,
11656
+ $size: theme.typography[props.allocation.fontStyle].fontSize,
11657
+ $weight: theme.typography[props.allocation.fontStyle].fontWeight,
11658
+ $color: theme.typography[props.allocation.fontStyle].color,
11659
+ children: typeof allocation === "number" ? `Limit of ${formatNumber(allocation)}` : "No limit"
11620
11660
  }
11621
- )
11622
- ] }),
11623
- (feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs12(
11624
- Box,
11625
- {
11626
- $flexBasis: "min-content",
11627
- $flexGrow: "1",
11628
- $textAlign: shouldWrapChildren ? "left" : "right",
11629
- children: [
11630
- props.usage.isVisible && typeof usage === "number" && /* @__PURE__ */ jsxs12(
11631
- Text,
11632
- {
11633
- as: Box,
11634
- $font: theme.typography[props.usage.fontStyle].fontFamily,
11635
- $size: theme.typography[props.usage.fontStyle].fontSize,
11636
- $weight: theme.typography[props.usage.fontStyle].fontWeight,
11637
- $lineHeight: 1.25,
11638
- $color: theme.typography[props.usage.fontStyle].color,
11639
- children: [
11640
- formatNumber(usage),
11641
- " ",
11642
- (0, import_pluralize3.default)(feature.name, usage)
11643
- ]
11644
- }
11645
- ),
11646
- props.allocation.isVisible && /* @__PURE__ */ jsx19(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx19(
11647
- Text,
11648
- {
11649
- $font: theme.typography[props.allocation.fontStyle].fontFamily,
11650
- $size: theme.typography[props.allocation.fontStyle].fontSize,
11651
- $weight: theme.typography[props.allocation.fontStyle].fontWeight,
11652
- $color: theme.typography[props.allocation.fontStyle].color,
11653
- children: typeof allocation === "number" ? `Limit of ${formatNumber(allocation)}` : "No limit"
11654
- }
11655
- ) })
11656
- ]
11657
- }
11658
- )
11659
- ]
11660
- }
11661
- ),
11662
- props.isVisible && typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ jsx19(Box, { children: /* @__PURE__ */ jsx19(
11663
- ProgressBar,
11664
- {
11665
- progress: usage / allocation * 100,
11666
- value: usage,
11667
- total: allocation,
11668
- color: [
11669
- "blue",
11670
- "blue",
11671
- "yellow",
11672
- "red"
11673
- ][Math.floor(usage / allocation * 4)]
11674
- }
11675
- ) })
11676
- ] })
11677
- ] }, index)
11678
- ];
11679
- },
11680
- []
11681
- ) : /* @__PURE__ */ jsx19(Element, { as: Flex, $justifyContent: "center", children: /* @__PURE__ */ jsx19(
11682
- Text,
11683
- {
11684
- $font: theme.typography.heading1.fontFamily,
11685
- $size: theme.typography.heading1.fontSize,
11686
- $weight: theme.typography.heading1.fontWeight,
11687
- $color: theme.typography.heading1.color,
11688
- $align: "center",
11689
- children: "No features selected"
11690
- }
11691
- ) }) });
11661
+ ) })
11662
+ ]
11663
+ }
11664
+ )
11665
+ ]
11666
+ }
11667
+ ),
11668
+ props.isVisible && typeof usage === "number" && typeof allocation === "number" && /* @__PURE__ */ jsx19(Box, { children: /* @__PURE__ */ jsx19(
11669
+ ProgressBar,
11670
+ {
11671
+ progress: usage / allocation * 100,
11672
+ value: usage,
11673
+ total: allocation,
11674
+ color: [
11675
+ "blue",
11676
+ "blue",
11677
+ "yellow",
11678
+ "red"
11679
+ ][Math.floor(usage / allocation * 4)]
11680
+ }
11681
+ ) })
11682
+ ] })
11683
+ ] }, index);
11684
+ }) });
11692
11685
  });
11693
11686
  MeteredFeatures.displayName = "MeteredFeatures";
11694
11687
 
@@ -11813,11 +11806,29 @@ function resolveDesignProps6(props) {
11813
11806
  };
11814
11807
  }
11815
11808
  function formatInvoices(invoices) {
11816
- return (invoices || []).map(({ amountDue, dueDate }) => ({
11809
+ return (invoices || []).map(({ amountDue, dueDate, url }) => ({
11817
11810
  ...dueDate && { date: toPrettyDate(dueDate) },
11818
- amount: formatCurrency(amountDue)
11811
+ amount: formatCurrency(amountDue),
11812
+ url
11819
11813
  }));
11820
11814
  }
11815
+ var InvoiceDate = ({ date, fontStyle, url }) => {
11816
+ const theme = nt();
11817
+ const dateText = /* @__PURE__ */ jsx21(
11818
+ Text,
11819
+ {
11820
+ $font: theme.typography[fontStyle].fontFamily,
11821
+ $size: theme.typography[fontStyle].fontSize,
11822
+ $weight: theme.typography[fontStyle].fontWeight,
11823
+ $color: theme.typography[fontStyle].color,
11824
+ children: date
11825
+ }
11826
+ );
11827
+ if (url) {
11828
+ /* @__PURE__ */ jsx21("a", { href: url, target: "_blank", children: dateText });
11829
+ }
11830
+ return dateText;
11831
+ };
11821
11832
  var Invoices = forwardRef10(({ className, ...rest }, ref) => {
11822
11833
  const props = resolveDesignProps6(rest);
11823
11834
  const theme = nt();
@@ -11842,16 +11853,14 @@ var Invoices = forwardRef10(({ className, ...rest }, ref) => {
11842
11853
  /* @__PURE__ */ jsx21(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(
11843
11854
  0,
11844
11855
  props.limit.isVisible && props.limit.number || invoices.length
11845
- ).map(({ date, amount }, index) => {
11856
+ ).map(({ date, amount, url }, index) => {
11846
11857
  return /* @__PURE__ */ jsxs14(Flex, { $justifyContent: "space-between", children: [
11847
- props.date.isVisible && /* @__PURE__ */ jsx21(
11848
- Text,
11858
+ props.date.isVisible && date && /* @__PURE__ */ jsx21(
11859
+ InvoiceDate,
11849
11860
  {
11850
- $font: theme.typography[props.date.fontStyle].fontFamily,
11851
- $size: theme.typography[props.date.fontStyle].fontSize,
11852
- $weight: theme.typography[props.date.fontStyle].fontWeight,
11853
- $color: theme.typography[props.date.fontStyle].color,
11854
- children: date
11861
+ date,
11862
+ fontStyle: props.date.fontStyle,
11863
+ url
11855
11864
  }
11856
11865
  ),
11857
11866
  props.amount.isVisible && /* @__PURE__ */ jsx21(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-components",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "main": "dist/schematic-components.cjs.js",
5
5
  "module": "dist/schematic-components.esm.js",
6
6
  "types": "dist/schematic-components.d.ts",