@schematichq/schematic-components 2.38.0 → 2.39.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/schematic-components-elements.cjs.js +1198 -459
- package/dist/schematic-components-elements.d.ts +169 -0
- package/dist/schematic-components-elements.esm.js +1152 -412
- package/dist/schematic-components.browser.cjs.js +576 -125
- package/dist/schematic-components.browser.esm.js +576 -125
- package/dist/schematic-components.cjs.js +576 -125
- package/dist/schematic-components.d.ts +100 -1
- package/dist/schematic-components.esm.js +576 -125
- package/package.json +12 -12
|
@@ -27,6 +27,10 @@ import { CreditAutoTopup } from '@schematichq/schematic-react';
|
|
|
27
27
|
import { CreditBalanceEntry } from '@schematichq/schematic-react';
|
|
28
28
|
import { CreditComposition } from '@schematichq/schematic-react';
|
|
29
29
|
import { CreditGrant } from '@schematichq/schematic-react';
|
|
30
|
+
import { CreditLedgerEntry } from '@schematichq/schematic-react';
|
|
31
|
+
import { CreditLedgerHandle } from '@schematichq/schematic-react';
|
|
32
|
+
import { CreditLedgerPage } from '@schematichq/schematic-react';
|
|
33
|
+
import { CreditLedgerQuery } from '@schematichq/schematic-react';
|
|
30
34
|
import { CreditUserUsage } from '@schematichq/schematic-react';
|
|
31
35
|
import { CreditUserUsageRow } from '@schematichq/schematic-react';
|
|
32
36
|
import { CustomPlanBilling } from '@schematichq/schematic-react';
|
|
@@ -65,6 +69,7 @@ import { useCheckout } from '@schematichq/schematic-react';
|
|
|
65
69
|
import { UseCheckoutOptions } from '@schematichq/schematic-react';
|
|
66
70
|
import { useCompany } from '@schematichq/schematic-react';
|
|
67
71
|
import { useCreditBalances } from '@schematichq/schematic-react';
|
|
72
|
+
import { useCreditLedger } from '@schematichq/schematic-react';
|
|
68
73
|
import { useCreditUserUsage } from '@schematichq/schematic-react';
|
|
69
74
|
import { useFeatureUsage } from '@schematichq/schematic-react';
|
|
70
75
|
import { useFeatureUserUsage } from '@schematichq/schematic-react';
|
|
@@ -622,6 +627,14 @@ export declare interface CreditGroupRow {
|
|
|
622
627
|
used: string | null;
|
|
623
628
|
}
|
|
624
629
|
|
|
630
|
+
export { CreditLedgerEntry }
|
|
631
|
+
|
|
632
|
+
export { CreditLedgerHandle }
|
|
633
|
+
|
|
634
|
+
export { CreditLedgerPage }
|
|
635
|
+
|
|
636
|
+
export { CreditLedgerQuery }
|
|
637
|
+
|
|
625
638
|
export declare interface CreditLedgerRow {
|
|
626
639
|
id: string;
|
|
627
640
|
kind: CreditGrantKind;
|
|
@@ -639,6 +652,107 @@ export declare interface CreditLedgerRow {
|
|
|
639
652
|
source: CreditGrant;
|
|
640
653
|
}
|
|
641
654
|
|
|
655
|
+
/**
|
|
656
|
+
* The company's recent credit activity, newest first: what drew credits and
|
|
657
|
+
* who, plus grants, top-ups and expiries. `limit` rows show at first; "See
|
|
658
|
+
* full log" opens a table that pages back through the rest, or "See all" hands
|
|
659
|
+
* off to the host through `onSeeAll` or `seeAllUrl`.
|
|
660
|
+
*
|
|
661
|
+
* Amounts are bare numbers. A log in one credit names it once, beside the
|
|
662
|
+
* heading; a log across several names each row's credit beside its time
|
|
663
|
+
* and in a Credit column.
|
|
664
|
+
*/
|
|
665
|
+
export declare function CreditLog({ className, credits, headingLevel, limit, locale: localeProp, onSeeAll, seeAllTarget, seeAllUrl, showGrants, showHeader, showUser, strings, }: CreditLogProps): JSX.Element;
|
|
666
|
+
|
|
667
|
+
export declare namespace CreditLog {
|
|
668
|
+
var resources: readonly ["creditLedger"];
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
/** What happened, keyed for copy; `subject` names the feature or bundle. */
|
|
672
|
+
export declare type CreditLogAction = "usage" | "refund" | "usageAdjustment" | "autoTopup" | "purchase" | "planGrant" | "freeGrant" | "adjustmentGrant" | "rollover" | "expired" | "reset" | "planChange" | "licenseRetired" | "removed";
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* `deriveCreditLog`: a page of the company's credit ledger as the log shows
|
|
676
|
+
* it, with amounts, units and times formatted here. The wording is the
|
|
677
|
+
* element's, keyed by `action` and `who`.
|
|
678
|
+
*/
|
|
679
|
+
/** What a row is, in the log's words. */
|
|
680
|
+
export declare type CreditLogKind = "draw" | "reversal" | "grant" | "topup" | "expiry";
|
|
681
|
+
|
|
682
|
+
export declare interface CreditLogProps extends ElementProps {
|
|
683
|
+
/** Credit ids to show; every credit when absent. */
|
|
684
|
+
credits?: string[];
|
|
685
|
+
/** Rows shown before "See full log". Default 3. */
|
|
686
|
+
limit?: number;
|
|
687
|
+
/** Who each draw is attributed to. Default true. */
|
|
688
|
+
showUser?: boolean;
|
|
689
|
+
/** Grants, top-ups and expiries beside the draws. Default true. */
|
|
690
|
+
showGrants?: boolean;
|
|
691
|
+
/** The "Credit activity" heading. Default true. */
|
|
692
|
+
showHeader?: boolean;
|
|
693
|
+
/** Heading level, so the card fits the host's outline. Default 2. */
|
|
694
|
+
headingLevel?: HeadingLevel;
|
|
695
|
+
/**
|
|
696
|
+
* "See all" calls this instead of "See full log" opening the log in place, for
|
|
697
|
+
* a host with a page of its own for it.
|
|
698
|
+
*/
|
|
699
|
+
onSeeAll?: () => void;
|
|
700
|
+
/** "See all" links here when there is no `onSeeAll`. */
|
|
701
|
+
seeAllUrl?: string;
|
|
702
|
+
/** `target` for `seeAllUrl`. */
|
|
703
|
+
seeAllTarget?: string;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export declare interface CreditLogRow {
|
|
707
|
+
id: string;
|
|
708
|
+
kind: CreditLogKind;
|
|
709
|
+
action: CreditLogAction;
|
|
710
|
+
/** The feature a draw was for, or the bundle a top-up came from. */
|
|
711
|
+
subject: string | null;
|
|
712
|
+
/** `null` for a draw sent without a user. */
|
|
713
|
+
who: CreditLogWho | null;
|
|
714
|
+
/** Signed: negative takes from the balance. */
|
|
715
|
+
amount: number;
|
|
716
|
+
/** Absolute, to ten fraction digits; `positive` carries the sign. */
|
|
717
|
+
amountText: string;
|
|
718
|
+
positive: boolean;
|
|
719
|
+
/** The credit's name for `amount`: "AI credit" or "AI credits". */
|
|
720
|
+
unit: string;
|
|
721
|
+
creditId: string;
|
|
722
|
+
/** The credit's plural name, to label the row: "AI credits". */
|
|
723
|
+
creditName: string;
|
|
724
|
+
/** `null` for an Invalid Date. */
|
|
725
|
+
at: Date | null;
|
|
726
|
+
/** Today or yesterday in the viewer's time zone, else `null`. */
|
|
727
|
+
day: "today" | "yesterday" | null;
|
|
728
|
+
/** "Oct 26, 3:40 PM", or the time alone when `day` is set. */
|
|
729
|
+
whenText: string;
|
|
730
|
+
/** "3:40 PM": the time alone, so the date cell can break before it. */
|
|
731
|
+
timeText: string;
|
|
732
|
+
source: CreditLedgerEntry;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
export declare interface CreditLogView {
|
|
736
|
+
rows: CreditLogRow[];
|
|
737
|
+
/**
|
|
738
|
+
* The one credit every row is in, with its plural name: "AI credits".
|
|
739
|
+
* `null` for an empty log, or one that spans several credits.
|
|
740
|
+
*/
|
|
741
|
+
credit: {
|
|
742
|
+
id: string;
|
|
743
|
+
name: string;
|
|
744
|
+
} | null;
|
|
745
|
+
hasMore: boolean;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
/** Who a row is attributed to: a user, or where the credits came from. */
|
|
749
|
+
export declare type CreditLogWho = {
|
|
750
|
+
kind: "user";
|
|
751
|
+
name: string;
|
|
752
|
+
} | {
|
|
753
|
+
kind: "autoTopup" | "purchase" | "plan" | "manual";
|
|
754
|
+
};
|
|
755
|
+
|
|
642
756
|
/**
|
|
643
757
|
* The company's credit balances, a card each: what is left, the grants
|
|
644
758
|
* behind it, how the plan's grants add up, and who on the team spent it.
|
|
@@ -753,6 +867,14 @@ export declare interface DeriveCheckoutInput {
|
|
|
753
867
|
locale: string;
|
|
754
868
|
}
|
|
755
869
|
|
|
870
|
+
export declare function deriveCreditLog(page: CreditLedgerPage, options: DeriveCreditLogOptions): CreditLogView;
|
|
871
|
+
|
|
872
|
+
export declare interface DeriveCreditLogOptions {
|
|
873
|
+
locale: string;
|
|
874
|
+
/** What "today" is judged against. Default the current time. */
|
|
875
|
+
now?: Date;
|
|
876
|
+
}
|
|
877
|
+
|
|
756
878
|
export declare function deriveCreditUsage(balances: CreditBalanceEntry[], options: DeriveCreditUsageOptions): CreditUsageRow[];
|
|
757
879
|
|
|
758
880
|
export declare interface DeriveCreditUsageOptions {
|
|
@@ -1026,6 +1148,43 @@ export declare type ElementStrings = {
|
|
|
1026
1148
|
creditUsagePerLicense: string;
|
|
1027
1149
|
creditUsageCompanyGrant: string;
|
|
1028
1150
|
creditUsageRenewsOn: string;
|
|
1151
|
+
creditLogLoading: string;
|
|
1152
|
+
creditLogHeader: string;
|
|
1153
|
+
creditLogError: string;
|
|
1154
|
+
creditLogUnavailable: string;
|
|
1155
|
+
creditLogEmpty: string;
|
|
1156
|
+
creditLogSeeMore: string;
|
|
1157
|
+
creditLogSeeLess: string;
|
|
1158
|
+
creditLogSeeAll: string;
|
|
1159
|
+
creditLogLoadMore: string;
|
|
1160
|
+
creditLogToday: string;
|
|
1161
|
+
creditLogYesterday: string;
|
|
1162
|
+
creditLogColumnDate: string;
|
|
1163
|
+
creditLogColumnActivity: string;
|
|
1164
|
+
creditLogColumnCredit: string;
|
|
1165
|
+
creditLogColumnBy: string;
|
|
1166
|
+
creditLogColumnAmount: string;
|
|
1167
|
+
creditLogActionUsage: string;
|
|
1168
|
+
creditLogActionRefund: string;
|
|
1169
|
+
creditLogActionRefundUnnamed: string;
|
|
1170
|
+
creditLogActionUsageAdjustment: string;
|
|
1171
|
+
creditLogActionAutoTopup: string;
|
|
1172
|
+
creditLogActionAutoTopupUnnamed: string;
|
|
1173
|
+
creditLogActionPurchase: string;
|
|
1174
|
+
creditLogActionPurchaseUnnamed: string;
|
|
1175
|
+
creditLogActionPlanGrant: string;
|
|
1176
|
+
creditLogActionFreeGrant: string;
|
|
1177
|
+
creditLogActionAdjustmentGrant: string;
|
|
1178
|
+
creditLogActionRollover: string;
|
|
1179
|
+
creditLogActionExpired: string;
|
|
1180
|
+
creditLogActionReset: string;
|
|
1181
|
+
creditLogActionPlanChange: string;
|
|
1182
|
+
creditLogActionLicenseRetired: string;
|
|
1183
|
+
creditLogActionRemoved: string;
|
|
1184
|
+
creditLogWhoAutoTopup: string;
|
|
1185
|
+
creditLogWhoPurchase: string;
|
|
1186
|
+
creditLogWhoPlan: string;
|
|
1187
|
+
creditLogWhoManual: string;
|
|
1029
1188
|
planManagerLoading: string;
|
|
1030
1189
|
planManagerError: string;
|
|
1031
1190
|
planManagerUnavailable: string;
|
|
@@ -1359,6 +1518,14 @@ export declare interface FormatCurrencyOptions {
|
|
|
1359
1518
|
/** "August 21, 2026", in the viewer's time zone. Empty for an Invalid Date. */
|
|
1360
1519
|
export declare function formatDate(date: Date, locale: string, options?: Intl.DateTimeFormatOptions): string;
|
|
1361
1520
|
|
|
1521
|
+
/**
|
|
1522
|
+
* "Oct 26, 3:40 PM", or "3:40 PM" with `timeOnly`, in the viewer's time
|
|
1523
|
+
* zone. Empty for an Invalid Date.
|
|
1524
|
+
*/
|
|
1525
|
+
export declare function formatDateTime(date: Date, locale: string, options?: {
|
|
1526
|
+
timeOnly?: boolean;
|
|
1527
|
+
}): string;
|
|
1528
|
+
|
|
1362
1529
|
/**
|
|
1363
1530
|
* "08/2027": a card's expiry as the locale writes a month and year. Empty
|
|
1364
1531
|
* for a month outside 1–12 or a year that is not a whole number, which is
|
|
@@ -2934,6 +3101,8 @@ export { useCompany }
|
|
|
2934
3101
|
|
|
2935
3102
|
export { useCreditBalances }
|
|
2936
3103
|
|
|
3104
|
+
export { useCreditLedger }
|
|
3105
|
+
|
|
2937
3106
|
export { useCreditUserUsage }
|
|
2938
3107
|
|
|
2939
3108
|
export { useFeatureUsage }
|