@monetizekit/react 0.2.0 → 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 CHANGED
@@ -357,13 +357,14 @@ var INTERVAL_SUFFIX = {
357
357
  annually: "/yr",
358
358
  one_time: ""
359
359
  };
360
- function describePlanPrice(plan, locale) {
360
+ function describePlanPrice(plan, locale, billingCycle = "monthly") {
361
361
  const pricing = plan.pricing ?? [];
362
362
  const contactSales = (plan.tags ?? []).includes("contact_sales") || pricing.length === 0;
363
363
  if (contactSales) {
364
364
  return { headline: null, contactSales: true };
365
365
  }
366
- const base = pricing.find((t) => t.type === "flat");
366
+ const flats = pricing.filter((t) => t.type === "flat");
367
+ const base = flats.find((t) => t.interval === billingCycle) ?? flats.find((t) => t.interval === "monthly") ?? flats[0];
367
368
  const hasUsage = pricing.some((t) => t.type === "usage");
368
369
  const currency = base?.currency ?? pricing[0]?.currency ?? "USD";
369
370
  const interval = base?.interval ?? pricing[0]?.interval ?? "monthly";
@@ -375,6 +376,14 @@ function describePlanPrice(plan, locale) {
375
376
  contactSales: false
376
377
  };
377
378
  }
379
+ function annualSavingsPercent(plan) {
380
+ const flats = (plan.pricing ?? []).filter((t) => t.type === "flat");
381
+ const monthly = flats.find((t) => t.interval === "monthly");
382
+ const annual = flats.find((t) => t.interval === "annually");
383
+ if (!monthly || !annual || monthly.amount <= 0) return null;
384
+ const pct = Math.round((1 - annual.amount / (monthly.amount * 12)) * 100);
385
+ return pct > 0 ? pct : null;
386
+ }
378
387
  function describeUsageTerm(term, locale) {
379
388
  const parts = [];
380
389
  if (term.includedUnits && term.includedUnits > 0) {
@@ -407,7 +416,7 @@ var SAMPLE_PLANS = [
407
416
  id: "sample_pro",
408
417
  name: "Growth",
409
418
  description: "Product-led monetization at scale",
410
- pricing: [{ type: "flat", amount: 49900, currency: "USD", interval: "monthly" }],
419
+ pricing: [{ type: "flat", amount: 499, currency: "USD", interval: "monthly" }],
411
420
  entitlements: [
412
421
  { featureKey: "max_customers", featureDisplayName: "Tracked customers", type: "limit", value: 1e4 },
413
422
  { featureKey: "stripe", featureDisplayName: "Stripe integration", type: "boolean", value: true },
@@ -420,7 +429,7 @@ var SAMPLE_PLANS = [
420
429
  name: "Scale",
421
430
  description: "Volume-based capacity pricing",
422
431
  pricing: [
423
- { type: "flat", amount: 99900, currency: "USD", interval: "monthly" },
432
+ { type: "flat", amount: 999, currency: "USD", interval: "monthly" },
424
433
  {
425
434
  type: "usage",
426
435
  amount: 0,
@@ -458,7 +467,21 @@ var SAMPLE_USAGE = {
458
467
  seats: { meterId: "seats", current: 8, limit: 10 },
459
468
  storage_gb: { meterId: "storage_gb", current: 3, limit: 10 }
460
469
  };
461
- var SAMPLE_CREDITS = { balance: 12e4, currency: "USD" };
470
+ var SAMPLE_CREDITS = { balance: 1200, currency: "USD" };
471
+ var SAMPLE_TEAM = {
472
+ members: [
473
+ { name: "Jordan Lee", email: "jordan@acme.test", role: "owner" },
474
+ { name: "Sam Rivera", email: "sam@acme.test", role: "admin" },
475
+ { name: "Taylor Kim", email: "taylor@acme.test", role: "member" }
476
+ ],
477
+ seats: 3,
478
+ maxSeats: 10
479
+ };
480
+ var SAMPLE_INVOICES = [
481
+ { id: "in_1003", date: "2026-03-01T00:00:00Z", amount: 499, currency: "USD", status: "paid" },
482
+ { id: "in_1002", date: "2026-02-01T00:00:00Z", amount: 499, currency: "USD", status: "paid" },
483
+ { id: "in_1001", date: "2026-01-01T00:00:00Z", amount: 499, currency: "USD", status: "paid" }
484
+ ];
462
485
  var SAMPLE_PORTAL = {
463
486
  planName: "Growth",
464
487
  meterIds: ["api_calls", "seats"]
@@ -482,6 +505,78 @@ function SampleNotice({ children }) {
482
505
  /* @__PURE__ */ jsx("span", { children: children ?? SAMPLE_NOTICE_TEXT })
483
506
  ] });
484
507
  }
508
+ var trackStyle = {
509
+ display: "inline-flex",
510
+ alignSelf: "center",
511
+ gap: "0.125rem",
512
+ padding: "0.25rem",
513
+ borderRadius: "var(--mk-radius)",
514
+ background: "color-mix(in srgb, var(--mk-fg) 6%, transparent)",
515
+ fontFamily: "var(--mk-font)"
516
+ };
517
+ function optionStyle(active) {
518
+ return {
519
+ border: "none",
520
+ cursor: "pointer",
521
+ borderRadius: "var(--mk-radius)",
522
+ padding: "0.375rem 0.875rem",
523
+ fontSize: "0.8125rem",
524
+ fontWeight: 600,
525
+ display: "inline-flex",
526
+ alignItems: "center",
527
+ gap: "0.375rem",
528
+ background: active ? "var(--mk-card)" : "transparent",
529
+ color: active ? "var(--mk-card-fg)" : "var(--mk-muted)",
530
+ boxShadow: active ? "var(--mk-shadow)" : "none"
531
+ };
532
+ }
533
+ function BillingCycleToggle({
534
+ value,
535
+ onChange,
536
+ savingsPercent = 0,
537
+ monthlyLabel = "Monthly",
538
+ annuallyLabel = "Yearly"
539
+ }) {
540
+ return /* @__PURE__ */ jsxs("div", { style: trackStyle, role: "group", "aria-label": "Billing cycle", "data-mk-component": "billing-toggle", children: [
541
+ /* @__PURE__ */ jsx(
542
+ "button",
543
+ {
544
+ type: "button",
545
+ style: optionStyle(value === "monthly"),
546
+ "aria-pressed": value === "monthly",
547
+ onClick: () => onChange("monthly"),
548
+ children: monthlyLabel
549
+ }
550
+ ),
551
+ /* @__PURE__ */ jsxs(
552
+ "button",
553
+ {
554
+ type: "button",
555
+ style: optionStyle(value === "annually"),
556
+ "aria-pressed": value === "annually",
557
+ onClick: () => onChange("annually"),
558
+ children: [
559
+ annuallyLabel,
560
+ savingsPercent > 0 ? /* @__PURE__ */ jsxs(
561
+ "span",
562
+ {
563
+ style: {
564
+ fontSize: "0.6875rem",
565
+ fontWeight: 700,
566
+ color: "var(--mk-success)"
567
+ },
568
+ children: [
569
+ "Save ",
570
+ savingsPercent,
571
+ "%"
572
+ ]
573
+ }
574
+ ) : null
575
+ ]
576
+ }
577
+ )
578
+ ] });
579
+ }
485
580
  var wrapperStyle = {
486
581
  display: "grid",
487
582
  gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))",
@@ -501,6 +596,8 @@ var cardBase = {
501
596
  function PricingTable({
502
597
  plans: plansProp,
503
598
  highlightPlan,
599
+ billingCycle,
600
+ showBillingToggle = false,
504
601
  locale,
505
602
  onSelectPlan,
506
603
  onContactSales,
@@ -510,6 +607,10 @@ function PricingTable({
510
607
  const { client, tokens } = useMonetizeKit();
511
608
  const [plans, setPlans] = useState(plansProp ?? null);
512
609
  const [error, setError] = useState(null);
610
+ const [cycle, setCycle] = useState(billingCycle ?? "monthly");
611
+ useEffect(() => {
612
+ if (billingCycle) setCycle(billingCycle);
613
+ }, [billingCycle]);
513
614
  useEffect(() => {
514
615
  if (plansProp) {
515
616
  setPlans(plansProp);
@@ -544,8 +645,19 @@ function PricingTable({
544
645
  "data-mk-sample": isSample ? "true" : void 0,
545
646
  children: [
546
647
  isSample ? /* @__PURE__ */ jsx(SampleNotice, { children: disclaimer }) : null,
648
+ showBillingToggle ? /* @__PURE__ */ jsx(
649
+ BillingCycleToggle,
650
+ {
651
+ value: cycle,
652
+ onChange: setCycle,
653
+ savingsPercent: Math.max(
654
+ 0,
655
+ ...effectivePlans.map((p) => annualSavingsPercent(p) ?? 0)
656
+ )
657
+ }
658
+ ) : null,
547
659
  /* @__PURE__ */ jsx("div", { style: wrapperStyle, children: effectivePlans.map((plan) => {
548
- const price = describePlanPrice(plan, locale);
660
+ const price = describePlanPrice(plan, locale, cycle);
549
661
  const highlighted = highlightPlan != null && plan.name.toLowerCase() === highlightPlan.toLowerCase();
550
662
  return /* @__PURE__ */ jsxs(
551
663
  "div",
@@ -610,6 +722,169 @@ function PricingTable({
610
722
  }
611
723
  );
612
724
  }
725
+ var UNLIMITED_THRESHOLD = 9999;
726
+ function entitlementCell(ent, locale) {
727
+ if (!ent) return /* @__PURE__ */ jsx("span", { style: { color: "var(--mk-muted)" }, children: "\u2014" });
728
+ switch (ent.type) {
729
+ case "boolean":
730
+ return ent.value ? /* @__PURE__ */ jsx("span", { "aria-label": "Included", style: { color: "var(--mk-success)", fontWeight: 700 }, children: "\u2713" }) : /* @__PURE__ */ jsx("span", { "aria-label": "Not included", style: { color: "var(--mk-muted)" }, children: "\u2014" });
731
+ case "limit": {
732
+ const n = Number(ent.value);
733
+ return /* @__PURE__ */ jsx("span", { children: n >= UNLIMITED_THRESHOLD ? "Unlimited" : formatUnits(n, locale) });
734
+ }
735
+ default:
736
+ return /* @__PURE__ */ jsx("span", { children: String(ent.value) });
737
+ }
738
+ }
739
+ function deriveGroups(plans) {
740
+ const seen = /* @__PURE__ */ new Map();
741
+ for (const plan of plans) {
742
+ for (const ent of plan.entitlements ?? []) {
743
+ if (!seen.has(ent.featureKey)) seen.set(ent.featureKey, ent.featureDisplayName);
744
+ }
745
+ }
746
+ return [
747
+ {
748
+ title: "Features",
749
+ features: Array.from(seen, ([key, label]) => ({ key, label }))
750
+ }
751
+ ];
752
+ }
753
+ var cellStyle = {
754
+ padding: "0.75rem 1rem",
755
+ textAlign: "center",
756
+ fontSize: "0.875rem",
757
+ borderTop: "1px solid var(--mk-border)"
758
+ };
759
+ function PricingComparison({
760
+ plans: plansProp,
761
+ groups,
762
+ highlightPlan,
763
+ billingCycle = "monthly",
764
+ locale,
765
+ sampleWhenEmpty = true,
766
+ disclaimer
767
+ }) {
768
+ const { client, tokens } = useMonetizeKit();
769
+ const [plans, setPlans] = useState(plansProp ?? null);
770
+ const [error, setError] = useState(null);
771
+ useEffect(() => {
772
+ if (plansProp) {
773
+ setPlans(plansProp);
774
+ return;
775
+ }
776
+ let active = true;
777
+ client.listPlans().then((res) => {
778
+ if (active) setPlans(res.data ?? []);
779
+ }).catch((e) => {
780
+ if (active) setError(e instanceof Error ? e : new Error(String(e)));
781
+ });
782
+ return () => {
783
+ active = false;
784
+ };
785
+ }, [client, plansProp]);
786
+ if (error) {
787
+ return /* @__PURE__ */ jsx("div", { role: "alert", style: { color: "var(--mk-muted)" }, children: "Unable to load plan comparison." });
788
+ }
789
+ if (!plans) {
790
+ return /* @__PURE__ */ jsx("div", { "aria-busy": "true", style: { color: "var(--mk-muted)" }, children: "Loading comparison\u2026" });
791
+ }
792
+ const isSample = plans.length === 0 && sampleWhenEmpty;
793
+ const effectivePlans = isSample ? SAMPLE_PLANS : plans;
794
+ if (effectivePlans.length === 0) {
795
+ return /* @__PURE__ */ jsx("div", { style: { color: "var(--mk-muted)" }, children: "No plans to compare." });
796
+ }
797
+ const effectiveGroups = groups ?? deriveGroups(effectivePlans);
798
+ const entByPlan = effectivePlans.map(
799
+ (plan) => new Map((plan.entitlements ?? []).map((e) => [e.featureKey, e]))
800
+ );
801
+ return /* @__PURE__ */ jsxs(
802
+ "div",
803
+ {
804
+ style: { ...tokensToStyle(tokens), display: "flex", flexDirection: "column", gap: "1rem" },
805
+ "data-mk-component": "pricing-comparison",
806
+ "data-mk-sample": isSample ? "true" : void 0,
807
+ children: [
808
+ isSample ? /* @__PURE__ */ jsx(SampleNotice, { children: disclaimer }) : null,
809
+ /* @__PURE__ */ jsx("div", { style: { overflowX: "auto" }, children: /* @__PURE__ */ jsxs(
810
+ "table",
811
+ {
812
+ style: {
813
+ width: "100%",
814
+ borderCollapse: "collapse",
815
+ background: "var(--mk-bg)",
816
+ color: "var(--mk-fg)",
817
+ fontFamily: "var(--mk-font)"
818
+ },
819
+ children: [
820
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
821
+ /* @__PURE__ */ jsx("th", { style: { ...cellStyle, textAlign: "left", borderTop: "none" }, children: "Features" }),
822
+ effectivePlans.map((plan) => {
823
+ const highlighted = highlightPlan != null && plan.name.toLowerCase() === highlightPlan.toLowerCase();
824
+ const price = describePlanPrice(plan, locale, billingCycle);
825
+ return /* @__PURE__ */ jsxs(
826
+ "th",
827
+ {
828
+ style: {
829
+ ...cellStyle,
830
+ borderTop: "none",
831
+ color: highlighted ? "var(--mk-primary)" : "var(--mk-fg)"
832
+ },
833
+ "data-mk-plan": plan.name,
834
+ "data-mk-highlighted": highlighted ? "true" : void 0,
835
+ children: [
836
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 700 }, children: plan.name }),
837
+ /* @__PURE__ */ jsx("div", { style: { fontSize: "0.75rem", color: "var(--mk-muted)", fontWeight: 400 }, children: price.contactSales ? "Custom" : price.headline })
838
+ ]
839
+ },
840
+ plan.id
841
+ );
842
+ })
843
+ ] }) }),
844
+ /* @__PURE__ */ jsx("tbody", { children: effectiveGroups.map((group) => /* @__PURE__ */ jsx(
845
+ FeatureGroupRows,
846
+ {
847
+ group,
848
+ planCount: effectivePlans.length,
849
+ entByPlan,
850
+ locale
851
+ },
852
+ group.title
853
+ )) })
854
+ ]
855
+ }
856
+ ) })
857
+ ]
858
+ }
859
+ );
860
+ }
861
+ function FeatureGroupRows({
862
+ group,
863
+ planCount,
864
+ entByPlan,
865
+ locale
866
+ }) {
867
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
868
+ /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
869
+ "td",
870
+ {
871
+ colSpan: planCount + 1,
872
+ style: {
873
+ padding: "0.625rem 1rem",
874
+ fontSize: "0.8125rem",
875
+ fontWeight: 700,
876
+ background: "color-mix(in srgb, var(--mk-fg) 5%, transparent)",
877
+ borderTop: "1px solid var(--mk-border)"
878
+ },
879
+ children: group.title
880
+ }
881
+ ) }),
882
+ group.features.map((feature) => /* @__PURE__ */ jsxs("tr", { children: [
883
+ /* @__PURE__ */ jsx("td", { style: { ...cellStyle, textAlign: "left", color: "var(--mk-fg)" }, children: feature.label }),
884
+ entByPlan.map((map, i) => /* @__PURE__ */ jsx("td", { style: cellStyle, children: entitlementCell(map.get(feature.key), locale) }, i))
885
+ ] }, feature.key))
886
+ ] });
887
+ }
613
888
  var overlayStyle = {
614
889
  border: "1px solid var(--mk-border)",
615
890
  borderRadius: "var(--mk-radius)",
@@ -629,14 +904,15 @@ function Paywall({
629
904
  title = "Upgrade to unlock this feature",
630
905
  description = "This feature isn't included in your current plan.",
631
906
  ctaLabel = "Upgrade",
632
- onUpgrade
907
+ onUpgrade,
908
+ sample = false
633
909
  }) {
634
910
  const { allowed, loading } = useEntitlement(feature);
635
911
  const { tokens } = useMonetizeKit();
636
- if (loading) {
912
+ if (!sample && loading) {
637
913
  return /* @__PURE__ */ jsx("div", { "aria-busy": "true", style: { color: "var(--mk-muted)" }, children: "Checking access\u2026" });
638
914
  }
639
- if (allowed) {
915
+ if (!sample && allowed) {
640
916
  return /* @__PURE__ */ jsx(Fragment, { children });
641
917
  }
642
918
  return /* @__PURE__ */ jsxs("div", { style: { ...tokensToStyle(tokens), ...overlayStyle }, "data-mk-component": "paywall", children: [
@@ -715,6 +991,94 @@ function UsageBanner({
715
991
  over ? /* @__PURE__ */ jsx("span", { style: { color: "var(--mk-danger)", fontSize: "0.75rem" }, children: "Over included allotment \u2014 overage billed per usage pricing." }) : null
716
992
  ] });
717
993
  }
994
+ var VARIANT_COLOR = {
995
+ info: "var(--mk-accent)",
996
+ warning: "var(--mk-warning)",
997
+ danger: "var(--mk-danger)",
998
+ neutral: "var(--mk-muted)"
999
+ };
1000
+ function actionStyle(variant, accent) {
1001
+ if (variant === "ghost") {
1002
+ return {
1003
+ background: "transparent",
1004
+ color: "var(--mk-muted)",
1005
+ border: "none",
1006
+ cursor: "pointer",
1007
+ fontSize: "0.8125rem",
1008
+ fontWeight: 600,
1009
+ padding: "0.375rem 0.5rem"
1010
+ };
1011
+ }
1012
+ return {
1013
+ background: accent,
1014
+ color: "var(--mk-card)",
1015
+ border: "none",
1016
+ borderRadius: "var(--mk-radius)",
1017
+ cursor: "pointer",
1018
+ fontSize: "0.8125rem",
1019
+ fontWeight: 600,
1020
+ padding: "0.375rem 0.75rem"
1021
+ };
1022
+ }
1023
+ function AlertBanner({
1024
+ variant = "info",
1025
+ title,
1026
+ description,
1027
+ progress,
1028
+ actions = [],
1029
+ icon
1030
+ }) {
1031
+ const { tokens } = useMonetizeKit();
1032
+ const accent = VARIANT_COLOR[variant];
1033
+ return /* @__PURE__ */ jsxs(
1034
+ "div",
1035
+ {
1036
+ role: "status",
1037
+ "data-mk-component": "alert-banner",
1038
+ "data-mk-variant": variant,
1039
+ style: {
1040
+ ...tokensToStyle(tokens),
1041
+ display: "flex",
1042
+ gap: "0.75rem",
1043
+ alignItems: "flex-start",
1044
+ border: `1px solid color-mix(in srgb, ${accent} 35%, var(--mk-border))`,
1045
+ background: `color-mix(in srgb, ${accent} 8%, var(--mk-card))`,
1046
+ color: "var(--mk-card-fg)",
1047
+ borderRadius: "var(--mk-radius)",
1048
+ padding: "0.875rem 1rem",
1049
+ fontFamily: "var(--mk-font)"
1050
+ },
1051
+ children: [
1052
+ icon ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { color: accent, fontSize: "1.1rem", lineHeight: 1 }, children: icon }) : null,
1053
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [
1054
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: title }),
1055
+ description ? /* @__PURE__ */ jsx("div", { style: { fontSize: "0.8125rem", color: "var(--mk-muted)" }, children: description }) : null,
1056
+ typeof progress === "number" ? /* @__PURE__ */ jsx(
1057
+ "div",
1058
+ {
1059
+ style: { height: 6, borderRadius: 999, background: "var(--mk-border)", overflow: "hidden" },
1060
+ role: "progressbar",
1061
+ "aria-valuenow": Math.round(Math.min(1, Math.max(0, progress)) * 100),
1062
+ "aria-valuemin": 0,
1063
+ "aria-valuemax": 100,
1064
+ children: /* @__PURE__ */ jsx("div", { style: { width: `${Math.min(1, Math.max(0, progress)) * 100}%`, height: "100%", background: accent } })
1065
+ }
1066
+ ) : null,
1067
+ actions.length > 0 ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: "0.5rem" }, children: actions.map((action) => /* @__PURE__ */ jsx(
1068
+ "button",
1069
+ {
1070
+ type: "button",
1071
+ onClick: action.onClick,
1072
+ style: actionStyle(action.variant, accent),
1073
+ children: action.label
1074
+ },
1075
+ action.label
1076
+ )) }) : null
1077
+ ] })
1078
+ ]
1079
+ }
1080
+ );
1081
+ }
718
1082
  var containerStyle = {
719
1083
  border: "1px solid var(--mk-border)",
720
1084
  borderRadius: "var(--mk-radius)",
@@ -756,10 +1120,38 @@ function SampleUsageRow({
756
1120
  hasLimit ? /* @__PURE__ */ jsx("div", { style: { height: 6, borderRadius: 999, background: "var(--mk-border)", overflow: "hidden" }, children: /* @__PURE__ */ jsx("div", { style: { width: `${fraction * 100}%`, height: "100%", background: barColor } }) }) : null
757
1121
  ] });
758
1122
  }
1123
+ var ROW_DIVIDER = { borderTop: "1px solid var(--mk-border)" };
1124
+ var INVOICE_STATUS_COLOR = {
1125
+ paid: "var(--mk-success)",
1126
+ pending: "var(--mk-warning)",
1127
+ overdue: "var(--mk-danger)"
1128
+ };
1129
+ function StatusBadge({ label, color }) {
1130
+ return /* @__PURE__ */ jsx(
1131
+ "span",
1132
+ {
1133
+ style: {
1134
+ fontSize: "0.6875rem",
1135
+ fontWeight: 600,
1136
+ textTransform: "capitalize",
1137
+ color,
1138
+ border: `1px solid ${color}`,
1139
+ borderRadius: 999,
1140
+ padding: "0.0625rem 0.5rem"
1141
+ },
1142
+ children: label
1143
+ }
1144
+ );
1145
+ }
759
1146
  function CustomerPortal({
760
1147
  planName,
761
1148
  meterIds,
762
1149
  showCredits = true,
1150
+ showTeam,
1151
+ teamMembers,
1152
+ seats,
1153
+ showInvoices,
1154
+ invoices,
763
1155
  sample = false,
764
1156
  disclaimer,
765
1157
  showBranding = false,
@@ -774,6 +1166,11 @@ function CustomerPortal({
774
1166
  const creditBalance = sample ? SAMPLE_CREDITS.balance : credits.balance;
775
1167
  const creditCurrency = sample ? SAMPLE_CREDITS.currency : credits.currency;
776
1168
  const creditLoading = sample ? false : credits.loading;
1169
+ const teamEnabled = showTeam ?? sample;
1170
+ const resolvedTeam = teamMembers ?? (sample ? SAMPLE_TEAM.members : []);
1171
+ const resolvedSeats = seats ?? (sample ? { used: SAMPLE_TEAM.seats, max: SAMPLE_TEAM.maxSeats } : void 0);
1172
+ const invoicesEnabled = showInvoices ?? sample;
1173
+ const resolvedInvoices = invoices ?? (sample ? SAMPLE_INVOICES : []);
777
1174
  return /* @__PURE__ */ jsxs(
778
1175
  "div",
779
1176
  {
@@ -840,6 +1237,64 @@ function CustomerPortal({
840
1237
  /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: "Credits" }),
841
1238
  /* @__PURE__ */ jsx("span", { style: { color: "var(--mk-muted)" }, children: creditLoading ? "\u2026" : formatMoney(creditBalance, creditCurrency ?? currency, locale) })
842
1239
  ] }) : null,
1240
+ teamEnabled ? /* @__PURE__ */ jsxs("div", { style: cardStyle, children: [
1241
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [
1242
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: "Team" }),
1243
+ resolvedSeats ? /* @__PURE__ */ jsxs("span", { style: { color: "var(--mk-muted)", fontSize: "0.75rem" }, children: [
1244
+ resolvedSeats.used,
1245
+ "/",
1246
+ resolvedSeats.max >= 9999 ? "Unlimited" : resolvedSeats.max,
1247
+ " seats"
1248
+ ] }) : null
1249
+ ] }),
1250
+ resolvedTeam.length === 0 ? /* @__PURE__ */ jsx("span", { style: { color: "var(--mk-muted)", fontSize: "0.8125rem" }, children: "No team members." }) : resolvedTeam.map((member, i) => /* @__PURE__ */ jsxs(
1251
+ "div",
1252
+ {
1253
+ style: {
1254
+ display: "flex",
1255
+ justifyContent: "space-between",
1256
+ alignItems: "center",
1257
+ gap: "0.75rem",
1258
+ fontSize: "0.8125rem",
1259
+ paddingTop: i === 0 ? 0 : "0.5rem",
1260
+ ...i === 0 ? {} : ROW_DIVIDER
1261
+ },
1262
+ children: [
1263
+ /* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
1264
+ /* @__PURE__ */ jsx("div", { style: { fontWeight: 600 }, children: member.name }),
1265
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--mk-muted)", fontSize: "0.75rem" }, children: member.email })
1266
+ ] }),
1267
+ /* @__PURE__ */ jsx(StatusBadge, { label: member.role, color: "var(--mk-muted)" })
1268
+ ]
1269
+ },
1270
+ member.email
1271
+ ))
1272
+ ] }) : null,
1273
+ invoicesEnabled ? /* @__PURE__ */ jsxs("div", { style: cardStyle, children: [
1274
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "0.875rem" }, children: "Invoices" }),
1275
+ resolvedInvoices.length === 0 ? /* @__PURE__ */ jsx("span", { style: { color: "var(--mk-muted)", fontSize: "0.8125rem" }, children: "No invoices yet." }) : resolvedInvoices.map((invoice, i) => /* @__PURE__ */ jsxs(
1276
+ "div",
1277
+ {
1278
+ style: {
1279
+ display: "flex",
1280
+ justifyContent: "space-between",
1281
+ alignItems: "center",
1282
+ gap: "0.75rem",
1283
+ fontSize: "0.8125rem",
1284
+ paddingTop: i === 0 ? 0 : "0.5rem",
1285
+ ...i === 0 ? {} : ROW_DIVIDER
1286
+ },
1287
+ children: [
1288
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 500 }, children: new Date(invoice.date).toLocaleDateString(locale) }),
1289
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
1290
+ /* @__PURE__ */ jsx("span", { style: { fontWeight: 600 }, children: formatMoney(invoice.amount, invoice.currency, locale) }),
1291
+ /* @__PURE__ */ jsx(StatusBadge, { label: invoice.status, color: INVOICE_STATUS_COLOR[invoice.status] })
1292
+ ] })
1293
+ ]
1294
+ },
1295
+ invoice.id
1296
+ ))
1297
+ ] }) : null,
843
1298
  showBranding ? /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontSize: "0.625rem", color: "var(--mk-muted)" }, children: "Powered by MonetizeKit" }) : null
844
1299
  ]
845
1300
  }
@@ -856,6 +1311,6 @@ function EntitlementGate({
856
1311
  return /* @__PURE__ */ jsx(Fragment, { children: allowed ? children : fallback });
857
1312
  }
858
1313
 
859
- export { CustomerPortal, EntitlementGate, MonetizeKitClient, MonetizeKitProvider, Paywall, PricingTable, SAMPLE_CREDITS, SAMPLE_NOTICE_TEXT, SAMPLE_PLANS, SAMPLE_PORTAL, SAMPLE_USAGE, SampleNotice, THEME_PRESETS, THEME_PRESET_NAMES, UsageBanner, describePlanPrice, describeUsageTerm, formatMoney, formatUnits, resolveTokens, tokensToStyle, useCredits, useEntitlement, useMonetizeKit, useUsage };
1314
+ export { AlertBanner, BillingCycleToggle, CustomerPortal, EntitlementGate, MonetizeKitClient, MonetizeKitProvider, Paywall, PricingComparison, PricingTable, SAMPLE_CREDITS, SAMPLE_INVOICES, SAMPLE_NOTICE_TEXT, SAMPLE_PLANS, SAMPLE_PORTAL, SAMPLE_TEAM, SAMPLE_USAGE, SampleNotice, THEME_PRESETS, THEME_PRESET_NAMES, UsageBanner, describePlanPrice, describeUsageTerm, formatMoney, formatUnits, resolveTokens, tokensToStyle, useCredits, useEntitlement, useMonetizeKit, useUsage };
860
1315
  //# sourceMappingURL=index.js.map
861
1316
  //# sourceMappingURL=index.js.map