@schematichq/schematic-vue 1.6.0 → 1.7.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 +35 -0
- package/dist/schematic-vue.cjs.js +633 -6
- package/dist/schematic-vue.d.ts +473 -5
- package/dist/schematic-vue.esm.js +633 -6
- package/package.json +11 -11
package/dist/schematic-vue.d.ts
CHANGED
|
@@ -37,6 +37,12 @@ declare namespace billingApi {
|
|
|
37
37
|
ApiErrorToJSON,
|
|
38
38
|
ApiErrorToJSONTyped,
|
|
39
39
|
ApiError,
|
|
40
|
+
instanceOfBillingProviderType,
|
|
41
|
+
BillingProviderTypeFromJSON,
|
|
42
|
+
BillingProviderTypeFromJSONTyped,
|
|
43
|
+
BillingProviderTypeToJSON,
|
|
44
|
+
BillingProviderTypeToJSONTyped,
|
|
45
|
+
BillingProviderType,
|
|
40
46
|
instanceOfCompanyDiscountResponseData,
|
|
41
47
|
CompanyDiscountResponseDataFromJSON,
|
|
42
48
|
CompanyDiscountResponseDataFromJSONTyped,
|
|
@@ -55,12 +61,42 @@ declare namespace billingApi {
|
|
|
55
61
|
CompanyInvoicesResponseDataToJSON,
|
|
56
62
|
CompanyInvoicesResponseDataToJSONTyped,
|
|
57
63
|
CompanyInvoicesResponseData,
|
|
64
|
+
instanceOfCompanyPaymentMethodResponseData,
|
|
65
|
+
CompanyPaymentMethodResponseDataFromJSON,
|
|
66
|
+
CompanyPaymentMethodResponseDataFromJSONTyped,
|
|
67
|
+
CompanyPaymentMethodResponseDataToJSON,
|
|
68
|
+
CompanyPaymentMethodResponseDataToJSONTyped,
|
|
69
|
+
CompanyPaymentMethodResponseData,
|
|
70
|
+
instanceOfCompanyPaymentMethodsResponseData,
|
|
71
|
+
CompanyPaymentMethodsResponseDataFromJSON,
|
|
72
|
+
CompanyPaymentMethodsResponseDataFromJSONTyped,
|
|
73
|
+
CompanyPaymentMethodsResponseDataToJSON,
|
|
74
|
+
CompanyPaymentMethodsResponseDataToJSONTyped,
|
|
75
|
+
CompanyPaymentMethodsResponseData,
|
|
58
76
|
instanceOfCompanyUpcomingInvoiceResponseData,
|
|
59
77
|
CompanyUpcomingInvoiceResponseDataFromJSON,
|
|
60
78
|
CompanyUpcomingInvoiceResponseDataFromJSONTyped,
|
|
61
79
|
CompanyUpcomingInvoiceResponseDataToJSON,
|
|
62
80
|
CompanyUpcomingInvoiceResponseDataToJSONTyped,
|
|
63
81
|
CompanyUpcomingInvoiceResponseData,
|
|
82
|
+
instanceOfCreateSetupIntentResponse,
|
|
83
|
+
CreateSetupIntentResponseFromJSON,
|
|
84
|
+
CreateSetupIntentResponseFromJSONTyped,
|
|
85
|
+
CreateSetupIntentResponseToJSON,
|
|
86
|
+
CreateSetupIntentResponseToJSONTyped,
|
|
87
|
+
CreateSetupIntentResponse,
|
|
88
|
+
instanceOfDeletePaymentMethodResponse,
|
|
89
|
+
DeletePaymentMethodResponseFromJSON,
|
|
90
|
+
DeletePaymentMethodResponseFromJSONTyped,
|
|
91
|
+
DeletePaymentMethodResponseToJSON,
|
|
92
|
+
DeletePaymentMethodResponseToJSONTyped,
|
|
93
|
+
DeletePaymentMethodResponse,
|
|
94
|
+
instanceOfDeleteResponse,
|
|
95
|
+
DeleteResponseFromJSON,
|
|
96
|
+
DeleteResponseFromJSONTyped,
|
|
97
|
+
DeleteResponseToJSON,
|
|
98
|
+
DeleteResponseToJSONTyped,
|
|
99
|
+
DeleteResponse,
|
|
64
100
|
instanceOfGetCompanyInvoicesParams,
|
|
65
101
|
GetCompanyInvoicesParamsFromJSON,
|
|
66
102
|
GetCompanyInvoicesParamsFromJSONTyped,
|
|
@@ -73,6 +109,12 @@ declare namespace billingApi {
|
|
|
73
109
|
GetCompanyInvoicesResponseToJSON,
|
|
74
110
|
GetCompanyInvoicesResponseToJSONTyped,
|
|
75
111
|
GetCompanyInvoicesResponse,
|
|
112
|
+
instanceOfGetCompanyPaymentMethodsResponse,
|
|
113
|
+
GetCompanyPaymentMethodsResponseFromJSON,
|
|
114
|
+
GetCompanyPaymentMethodsResponseFromJSONTyped,
|
|
115
|
+
GetCompanyPaymentMethodsResponseToJSON,
|
|
116
|
+
GetCompanyPaymentMethodsResponseToJSONTyped,
|
|
117
|
+
GetCompanyPaymentMethodsResponse,
|
|
76
118
|
instanceOfGetCompanyUpcomingInvoiceResponse,
|
|
77
119
|
GetCompanyUpcomingInvoiceResponseFromJSON,
|
|
78
120
|
GetCompanyUpcomingInvoiceResponseFromJSONTyped,
|
|
@@ -84,19 +126,52 @@ declare namespace billingApi {
|
|
|
84
126
|
InvoiceStatusFromJSONTyped,
|
|
85
127
|
InvoiceStatusToJSON,
|
|
86
128
|
InvoiceStatusToJSONTyped,
|
|
87
|
-
InvoiceStatus
|
|
129
|
+
InvoiceStatus,
|
|
130
|
+
instanceOfPaymentMethodResponseData,
|
|
131
|
+
PaymentMethodResponseDataFromJSON,
|
|
132
|
+
PaymentMethodResponseDataFromJSONTyped,
|
|
133
|
+
PaymentMethodResponseDataToJSON,
|
|
134
|
+
PaymentMethodResponseDataToJSONTyped,
|
|
135
|
+
PaymentMethodResponseData,
|
|
136
|
+
instanceOfSetupIntentResponseData,
|
|
137
|
+
SetupIntentResponseDataFromJSON,
|
|
138
|
+
SetupIntentResponseDataFromJSONTyped,
|
|
139
|
+
SetupIntentResponseDataToJSON,
|
|
140
|
+
SetupIntentResponseDataToJSONTyped,
|
|
141
|
+
SetupIntentResponseData,
|
|
142
|
+
instanceOfUpdatePaymentMethodRequestBody,
|
|
143
|
+
UpdatePaymentMethodRequestBodyFromJSON,
|
|
144
|
+
UpdatePaymentMethodRequestBodyFromJSONTyped,
|
|
145
|
+
UpdatePaymentMethodRequestBodyToJSON,
|
|
146
|
+
UpdatePaymentMethodRequestBodyToJSONTyped,
|
|
147
|
+
UpdatePaymentMethodRequestBody,
|
|
148
|
+
instanceOfUpdatePaymentMethodResponse,
|
|
149
|
+
UpdatePaymentMethodResponseFromJSON,
|
|
150
|
+
UpdatePaymentMethodResponseFromJSONTyped,
|
|
151
|
+
UpdatePaymentMethodResponseToJSON,
|
|
152
|
+
UpdatePaymentMethodResponseToJSONTyped,
|
|
153
|
+
UpdatePaymentMethodResponse
|
|
88
154
|
}
|
|
89
155
|
}
|
|
90
156
|
|
|
91
157
|
/**
|
|
92
|
-
* What a reader of billing data can ask for
|
|
93
|
-
* rest of what `hydrate` serves — and the
|
|
94
|
-
* join this interface as their endpoints
|
|
158
|
+
* What a reader of billing data can ask for, and the few writes beside it.
|
|
159
|
+
* Subscription and usage — the rest of what `hydrate` serves — and the
|
|
160
|
+
* checkout calls that change them join this interface as their endpoints
|
|
161
|
+
* ship.
|
|
95
162
|
*/
|
|
96
163
|
declare interface BillingClient {
|
|
97
164
|
fetchInvoices(params: InvoicesRequest): Promise<InvoicesResult>;
|
|
98
165
|
/** `null` when the company has no next bill. */
|
|
99
166
|
fetchUpcomingInvoice(): Promise<UpcomingInvoice | null>;
|
|
167
|
+
/** Empty when the company has no method on file. */
|
|
168
|
+
fetchPaymentMethods(): Promise<PaymentMethod[]>;
|
|
169
|
+
/** What a provider's card form is mounted with to add a method. */
|
|
170
|
+
createSetupIntent(): Promise<SetupIntent>;
|
|
171
|
+
/** Makes the method the default, by the provider's id (`externalId`). */
|
|
172
|
+
updatePaymentMethod(externalId: string): Promise<void>;
|
|
173
|
+
/** Removes the method, by Schematic's id (`id`). */
|
|
174
|
+
deletePaymentMethod(id: string): Promise<void>;
|
|
100
175
|
readonly sessionStatus: SessionStatus;
|
|
101
176
|
readonly sessionKey: string | undefined;
|
|
102
177
|
setSession(session: SessionInput): void;
|
|
@@ -140,6 +215,7 @@ declare type BillingResourceName = keyof BillingResources;
|
|
|
140
215
|
declare interface BillingResourceParams {
|
|
141
216
|
invoices: InvoiceQuery;
|
|
142
217
|
upcomingInvoice: Record<string, never>;
|
|
218
|
+
paymentMethods: Record<string, never>;
|
|
143
219
|
}
|
|
144
220
|
|
|
145
221
|
/**
|
|
@@ -158,6 +234,11 @@ declare interface BillingResources {
|
|
|
158
234
|
* `undefined` means the resource has not loaded.
|
|
159
235
|
*/
|
|
160
236
|
upcomingInvoice: UpcomingInvoice | null;
|
|
237
|
+
/**
|
|
238
|
+
* `GET /company/payment-methods`. Empty is a loaded value — the company
|
|
239
|
+
* has no method on file — so only `undefined` means not loaded.
|
|
240
|
+
*/
|
|
241
|
+
paymentMethods: PaymentMethod[];
|
|
161
242
|
}
|
|
162
243
|
|
|
163
244
|
declare type BooleanListenerFn = (value: boolean) => void;
|
|
@@ -370,6 +451,12 @@ declare interface CheckFlagsResponseData {
|
|
|
370
451
|
creditBalances?: {
|
|
371
452
|
[key: string]: CompanyCreditBalance;
|
|
372
453
|
};
|
|
454
|
+
/**
|
|
455
|
+
* Credit spend policies binding the evaluated company and user; empty when none bind. Each response carries the whole set, so replace any previously received set with it. Advisory: the flag values do not reflect them, since a check names no draw amount
|
|
456
|
+
* @type {Array<CreditSpendPolicy>}
|
|
457
|
+
* @memberof CheckFlagsResponseData
|
|
458
|
+
*/
|
|
459
|
+
creditSpendPolicies: Array<CreditSpendPolicy_2>;
|
|
373
460
|
/**
|
|
374
461
|
*
|
|
375
462
|
* @type {Array<CheckFlagResponseData>}
|
|
@@ -551,6 +638,109 @@ declare interface CompanyInvoiceResponseData {
|
|
|
551
638
|
url?: string | null;
|
|
552
639
|
}
|
|
553
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Schematic API
|
|
643
|
+
* Schematic API
|
|
644
|
+
*
|
|
645
|
+
* The version of the OpenAPI document: 0.1
|
|
646
|
+
*
|
|
647
|
+
*
|
|
648
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
649
|
+
* https://openapi-generator.tech
|
|
650
|
+
* Do not edit the class manually.
|
|
651
|
+
*/
|
|
652
|
+
/**
|
|
653
|
+
*
|
|
654
|
+
* @export
|
|
655
|
+
* @interface CompanyPaymentMethodResponseData
|
|
656
|
+
*/
|
|
657
|
+
declare interface CompanyPaymentMethodResponseData {
|
|
658
|
+
/**
|
|
659
|
+
*
|
|
660
|
+
* @type {string}
|
|
661
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
662
|
+
*/
|
|
663
|
+
accountLast4?: string | null;
|
|
664
|
+
/**
|
|
665
|
+
*
|
|
666
|
+
* @type {string}
|
|
667
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
668
|
+
*/
|
|
669
|
+
accountName?: string | null;
|
|
670
|
+
/**
|
|
671
|
+
*
|
|
672
|
+
* @type {string}
|
|
673
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
674
|
+
*/
|
|
675
|
+
bankName?: string | null;
|
|
676
|
+
/**
|
|
677
|
+
*
|
|
678
|
+
* @type {string}
|
|
679
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
680
|
+
*/
|
|
681
|
+
billingEmail?: string | null;
|
|
682
|
+
/**
|
|
683
|
+
*
|
|
684
|
+
* @type {string}
|
|
685
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
686
|
+
*/
|
|
687
|
+
billingName?: string | null;
|
|
688
|
+
/**
|
|
689
|
+
* Whether DELETE /checkout/paymentmethod/:id would succeed. False only for the sole method while an active paid subscription needs it; the default can be removed like any other.
|
|
690
|
+
* @type {boolean}
|
|
691
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
692
|
+
*/
|
|
693
|
+
canRemove: boolean;
|
|
694
|
+
/**
|
|
695
|
+
*
|
|
696
|
+
* @type {string}
|
|
697
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
698
|
+
*/
|
|
699
|
+
cardBrand?: string | null;
|
|
700
|
+
/**
|
|
701
|
+
*
|
|
702
|
+
* @type {number}
|
|
703
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
704
|
+
*/
|
|
705
|
+
cardExpMonth?: number | null;
|
|
706
|
+
/**
|
|
707
|
+
*
|
|
708
|
+
* @type {number}
|
|
709
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
710
|
+
*/
|
|
711
|
+
cardExpYear?: number | null;
|
|
712
|
+
/**
|
|
713
|
+
*
|
|
714
|
+
* @type {string}
|
|
715
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
716
|
+
*/
|
|
717
|
+
cardLast4?: string | null;
|
|
718
|
+
/**
|
|
719
|
+
*
|
|
720
|
+
* @type {string}
|
|
721
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
722
|
+
*/
|
|
723
|
+
externalId: string;
|
|
724
|
+
/**
|
|
725
|
+
*
|
|
726
|
+
* @type {string}
|
|
727
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
728
|
+
*/
|
|
729
|
+
id: string;
|
|
730
|
+
/**
|
|
731
|
+
* Whether this is the method the company is billed with: the subscription's own when it has one, else the customer default. At most one method is the default.
|
|
732
|
+
* @type {boolean}
|
|
733
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
734
|
+
*/
|
|
735
|
+
isDefault: boolean;
|
|
736
|
+
/**
|
|
737
|
+
* The Stripe payment method type, such as card or us_bank_account.
|
|
738
|
+
* @type {string}
|
|
739
|
+
* @memberof CompanyPaymentMethodResponseData
|
|
740
|
+
*/
|
|
741
|
+
type: string;
|
|
742
|
+
}
|
|
743
|
+
|
|
554
744
|
/**
|
|
555
745
|
*
|
|
556
746
|
* @export
|
|
@@ -582,7 +772,7 @@ declare interface CompanyUpcomingInvoiceResponseData {
|
|
|
582
772
|
*/
|
|
583
773
|
customerBalanceRemaining: number;
|
|
584
774
|
/**
|
|
585
|
-
*
|
|
775
|
+
* The subscription's active discounts, to show beside the bill. Informational: the amounts come from the provider's preview and already reflect whatever it applied, so subtotal less these need not equal amount_due.
|
|
586
776
|
* @type {Array<CompanyDiscountResponseData>}
|
|
587
777
|
* @memberof CompanyUpcomingInvoiceResponseData
|
|
588
778
|
*/
|
|
@@ -620,6 +810,153 @@ declare const CreditBalancesFromJSON: (json: any) => CreditBalances;
|
|
|
620
810
|
|
|
621
811
|
declare type CreditBalancesListenerFn = (value: CreditBalances) => void;
|
|
622
812
|
|
|
813
|
+
/** Every spend policy binding the current context, company-scope first */
|
|
814
|
+
export declare type CreditSpendPolicies = CreditSpendPolicy[];
|
|
815
|
+
|
|
816
|
+
/** Compare two policy sets by value, so an unchanged restream skips the notify. */
|
|
817
|
+
declare const creditSpendPoliciesEqual: (a: CreditSpendPolicies, b: CreditSpendPolicies) => boolean;
|
|
818
|
+
|
|
819
|
+
declare const CreditSpendPoliciesFromJSON: (json: any) => CreditSpendPolicies;
|
|
820
|
+
|
|
821
|
+
declare type CreditSpendPoliciesListenerFn = (value: CreditSpendPolicies) => void;
|
|
822
|
+
|
|
823
|
+
/** One limit on spending a credit */
|
|
824
|
+
export declare type CreditSpendPolicy = {
|
|
825
|
+
id: string;
|
|
826
|
+
creditId: string;
|
|
827
|
+
kind: CreditSpendPolicyKind;
|
|
828
|
+
scope: CreditSpendPolicyScope;
|
|
829
|
+
label?: string;
|
|
830
|
+
/** The ceiling, in credits */
|
|
831
|
+
limit: number;
|
|
832
|
+
/** How much of the limit is already spent in the current period; 0 for per_draw */
|
|
833
|
+
consumed: number;
|
|
834
|
+
/** For windowed kinds, when the current period ends and consumed no longer applies */
|
|
835
|
+
resetsAt?: Date;
|
|
836
|
+
/** Set for windowed kinds only */
|
|
837
|
+
window?: CreditSpendWindow;
|
|
838
|
+
};
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
*
|
|
842
|
+
* @export
|
|
843
|
+
* @interface CreditSpendPolicy
|
|
844
|
+
*/
|
|
845
|
+
declare interface CreditSpendPolicy_2 {
|
|
846
|
+
/**
|
|
847
|
+
* How much of the limit is already spent in the current period
|
|
848
|
+
* @type {number}
|
|
849
|
+
* @memberof CreditSpendPolicy
|
|
850
|
+
*/
|
|
851
|
+
consumed?: number;
|
|
852
|
+
/**
|
|
853
|
+
* The credit the policy limits
|
|
854
|
+
* @type {string}
|
|
855
|
+
* @memberof CreditSpendPolicy
|
|
856
|
+
*/
|
|
857
|
+
creditId: string;
|
|
858
|
+
/**
|
|
859
|
+
* The ID of the policy
|
|
860
|
+
* @type {string}
|
|
861
|
+
* @memberof CreditSpendPolicy
|
|
862
|
+
*/
|
|
863
|
+
id: string;
|
|
864
|
+
/**
|
|
865
|
+
* How the limit is applied
|
|
866
|
+
* @type {string}
|
|
867
|
+
* @memberof CreditSpendPolicy
|
|
868
|
+
*/
|
|
869
|
+
kind: string;
|
|
870
|
+
/**
|
|
871
|
+
* The name the account gave the policy
|
|
872
|
+
* @type {string}
|
|
873
|
+
* @memberof CreditSpendPolicy
|
|
874
|
+
*/
|
|
875
|
+
label?: string | null;
|
|
876
|
+
/**
|
|
877
|
+
* The ceiling, in credits
|
|
878
|
+
* @type {number}
|
|
879
|
+
* @memberof CreditSpendPolicy
|
|
880
|
+
*/
|
|
881
|
+
limit: number;
|
|
882
|
+
/**
|
|
883
|
+
* For a windowed limit, when the current period ends and consumed no longer applies
|
|
884
|
+
* @type {Date}
|
|
885
|
+
* @memberof CreditSpendPolicy
|
|
886
|
+
*/
|
|
887
|
+
resetsAt?: Date | null;
|
|
888
|
+
/**
|
|
889
|
+
* Whether the policy limits the company or one user
|
|
890
|
+
* @type {CreditSpendPolicyScope}
|
|
891
|
+
* @memberof CreditSpendPolicy
|
|
892
|
+
*/
|
|
893
|
+
scope: CreditSpendPolicyScope_2;
|
|
894
|
+
/**
|
|
895
|
+
* For a windowed limit, the period it accumulates over
|
|
896
|
+
* @type {CreditSpendWindow}
|
|
897
|
+
* @memberof CreditSpendPolicy
|
|
898
|
+
*/
|
|
899
|
+
window?: CreditSpendWindow_2;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/** How a spend policy applies its limit. Unknown kinds are carried, not dropped:
|
|
903
|
+
* the server may ship a kind this SDK version predates. */
|
|
904
|
+
export declare type CreditSpendPolicyKind = "per_draw" | "window" | (string & {});
|
|
905
|
+
|
|
906
|
+
declare type CreditSpendPolicyListenerFn = CreditSpendPoliciesListenerFn | EmptyListenerFn;
|
|
907
|
+
|
|
908
|
+
/** Whether a spend policy limits the company or one user */
|
|
909
|
+
export declare type CreditSpendPolicyScope = "company" | "user" | (string & {});
|
|
910
|
+
|
|
911
|
+
/**
|
|
912
|
+
*
|
|
913
|
+
* @export
|
|
914
|
+
*/
|
|
915
|
+
declare const CreditSpendPolicyScope_2: {
|
|
916
|
+
readonly Company: "company";
|
|
917
|
+
readonly User: "user";
|
|
918
|
+
readonly Group: "group";
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
declare type CreditSpendPolicyScope_2 = (typeof CreditSpendPolicyScope_2)[keyof typeof CreditSpendPolicyScope_2];
|
|
922
|
+
|
|
923
|
+
/** The period a windowed spend policy accumulates over */
|
|
924
|
+
export declare type CreditSpendWindow = {
|
|
925
|
+
unit: string;
|
|
926
|
+
count: number;
|
|
927
|
+
};
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Schematic API
|
|
931
|
+
* Schematic API
|
|
932
|
+
*
|
|
933
|
+
* The version of the OpenAPI document: 0.1
|
|
934
|
+
*
|
|
935
|
+
*
|
|
936
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
937
|
+
* https://openapi-generator.tech
|
|
938
|
+
* Do not edit the class manually.
|
|
939
|
+
*/
|
|
940
|
+
/**
|
|
941
|
+
*
|
|
942
|
+
* @export
|
|
943
|
+
* @interface CreditSpendWindow
|
|
944
|
+
*/
|
|
945
|
+
declare interface CreditSpendWindow_2 {
|
|
946
|
+
/**
|
|
947
|
+
* How many units make up one period
|
|
948
|
+
* @type {number}
|
|
949
|
+
* @memberof CreditSpendWindow
|
|
950
|
+
*/
|
|
951
|
+
count: number;
|
|
952
|
+
/**
|
|
953
|
+
* The period the limit accumulates over
|
|
954
|
+
* @type {string}
|
|
955
|
+
* @memberof CreditSpendWindow
|
|
956
|
+
*/
|
|
957
|
+
unit: string;
|
|
958
|
+
}
|
|
959
|
+
|
|
623
960
|
/**
|
|
624
961
|
*
|
|
625
962
|
* @export
|
|
@@ -1010,6 +1347,20 @@ declare type MetricPeriodMonthReset = (typeof MetricPeriodMonthReset)[keyof type
|
|
|
1010
1347
|
*/
|
|
1011
1348
|
declare function normalizeInvoiceQuery(query: InvoiceQuery): InvoiceQuery;
|
|
1012
1349
|
|
|
1350
|
+
/**
|
|
1351
|
+
* One way the company pays. Two flags the server has already decided, so a
|
|
1352
|
+
* consumer never re-derives a provider's rules:
|
|
1353
|
+
*
|
|
1354
|
+
* * `isDefault` — the subscription's default method, or, when the
|
|
1355
|
+
* subscription names none, the customer's.
|
|
1356
|
+
* * `canRemove` — whether a delete would be accepted; the server's rule,
|
|
1357
|
+
* not `!isDefault`.
|
|
1358
|
+
*
|
|
1359
|
+
* `id` is Schematic's, and is what a delete takes; `externalId` is the
|
|
1360
|
+
* provider's, and is what making it the default takes.
|
|
1361
|
+
*/
|
|
1362
|
+
declare type PaymentMethod = CompanyPaymentMethodResponseData;
|
|
1363
|
+
|
|
1013
1364
|
declare type PendingListenerFn = BooleanListenerFn | EmptyListenerFn;
|
|
1014
1365
|
|
|
1015
1366
|
declare type PlanListenerFn = CheckPlanReturnListenerFn | EmptyListenerFn;
|
|
@@ -1086,6 +1437,7 @@ export declare class Schematic {
|
|
|
1086
1437
|
private isPendingListeners;
|
|
1087
1438
|
private planListeners;
|
|
1088
1439
|
private creditBalanceListeners;
|
|
1440
|
+
private creditSpendPolicyListeners;
|
|
1089
1441
|
private storage;
|
|
1090
1442
|
private persistFlagState;
|
|
1091
1443
|
private flagStateCacheKey;
|
|
@@ -1096,6 +1448,7 @@ export declare class Schematic {
|
|
|
1096
1448
|
private featureUsageEventMap;
|
|
1097
1449
|
private planChecks;
|
|
1098
1450
|
private creditBalances;
|
|
1451
|
+
private creditSpendPolicies;
|
|
1099
1452
|
private webSocketUrl;
|
|
1100
1453
|
private webSocketConnectionTimeout;
|
|
1101
1454
|
private webSocketReconnect;
|
|
@@ -1314,6 +1667,10 @@ export declare class Schematic {
|
|
|
1314
1667
|
getCreditBalances: () => CreditBalances;
|
|
1315
1668
|
/** Get the company's lease-aware balance for a single credit type in the current context */
|
|
1316
1669
|
getCreditBalance: (creditId: string) => CreditBalance | undefined;
|
|
1670
|
+
/** Get every credit spend policy binding the current context, company-scope first */
|
|
1671
|
+
getCreditSpendPolicies: () => CreditSpendPolicies;
|
|
1672
|
+
/** Get the spend policies binding a single credit type in the current context */
|
|
1673
|
+
getCreditSpendPoliciesForCredit: (creditId: string) => CreditSpendPolicies;
|
|
1317
1674
|
getFlagCheck: (flagKey: string) => CheckFlagReturn | undefined;
|
|
1318
1675
|
getFlagValue: (flagKey: string) => boolean | undefined;
|
|
1319
1676
|
/** Register an event listener that will be notified with the boolean value for a given flag when this value changes */
|
|
@@ -1323,11 +1680,14 @@ export declare class Schematic {
|
|
|
1323
1680
|
addPlanListener: (listener: PlanListenerFn) => () => void;
|
|
1324
1681
|
/** Register an event listener that will be notified with the company's credit balances (keyed by credit ID) whenever they change */
|
|
1325
1682
|
addCreditBalanceListener: (listener: CreditBalanceListenerFn) => () => void;
|
|
1683
|
+
/** Register an event listener that will be notified with the context's credit spend policies whenever the set changes */
|
|
1684
|
+
addCreditSpendPolicyListener: (listener: CreditSpendPolicyListenerFn) => () => void;
|
|
1326
1685
|
private notifyFlagCheckListeners;
|
|
1327
1686
|
/** Add or update a CheckFlagReturn in the featureUsageEventMap */
|
|
1328
1687
|
private updateFeatureUsageEventMap;
|
|
1329
1688
|
private notifyFlagValueListeners;
|
|
1330
1689
|
private notifyPlanListeners;
|
|
1690
|
+
private notifyCreditSpendPolicyListeners;
|
|
1331
1691
|
private notifyCreditBalanceListeners;
|
|
1332
1692
|
}
|
|
1333
1693
|
|
|
@@ -1351,6 +1711,10 @@ declare class SchematicBillingClient implements BillingClient {
|
|
|
1351
1711
|
onSessionChange(listener: (event: SessionEvent) => void): () => void;
|
|
1352
1712
|
fetchInvoices(params: InvoicesRequest): Promise<InvoicesResult>;
|
|
1353
1713
|
fetchUpcomingInvoice(): Promise<UpcomingInvoice | null>;
|
|
1714
|
+
fetchPaymentMethods(): Promise<PaymentMethod[]>;
|
|
1715
|
+
createSetupIntent(): Promise<SetupIntent>;
|
|
1716
|
+
updatePaymentMethod(externalId: string): Promise<void>;
|
|
1717
|
+
deletePaymentMethod(id: string): Promise<void>;
|
|
1354
1718
|
}
|
|
1355
1719
|
|
|
1356
1720
|
export declare interface SchematicComposableOpts {
|
|
@@ -1399,12 +1763,22 @@ declare namespace SchematicJS {
|
|
|
1399
1763
|
CompanyCreditBalance,
|
|
1400
1764
|
CompanyDiscountResponseData,
|
|
1401
1765
|
CompanyInvoiceResponseData,
|
|
1766
|
+
CompanyPaymentMethodResponseData,
|
|
1402
1767
|
CompanyUpcomingInvoiceResponseData,
|
|
1403
1768
|
CreditBalance,
|
|
1404
1769
|
CreditBalanceListenerFn,
|
|
1405
1770
|
CreditBalances,
|
|
1406
1771
|
CreditBalancesFromJSON,
|
|
1407
1772
|
CreditBalancesListenerFn,
|
|
1773
|
+
CreditSpendPolicies,
|
|
1774
|
+
creditSpendPoliciesEqual,
|
|
1775
|
+
CreditSpendPoliciesFromJSON,
|
|
1776
|
+
CreditSpendPoliciesListenerFn,
|
|
1777
|
+
CreditSpendPolicy,
|
|
1778
|
+
CreditSpendPolicyKind,
|
|
1779
|
+
CreditSpendPolicyListenerFn,
|
|
1780
|
+
CreditSpendPolicyScope,
|
|
1781
|
+
CreditSpendWindow,
|
|
1408
1782
|
DEFAULT_INVOICE_QUERY,
|
|
1409
1783
|
Discount,
|
|
1410
1784
|
EmptyListenerFn,
|
|
@@ -1425,6 +1799,7 @@ declare namespace SchematicJS {
|
|
|
1425
1799
|
InvoicesResult,
|
|
1426
1800
|
InvoiceStatus,
|
|
1427
1801
|
Keys,
|
|
1802
|
+
PaymentMethod,
|
|
1428
1803
|
PendingListenerFn,
|
|
1429
1804
|
PlanListenerFn,
|
|
1430
1805
|
RequestOptions,
|
|
@@ -1441,6 +1816,8 @@ declare namespace SchematicJS {
|
|
|
1441
1816
|
SessionInput,
|
|
1442
1817
|
SessionOptions,
|
|
1443
1818
|
SessionStatus,
|
|
1819
|
+
SetupIntent,
|
|
1820
|
+
SetupIntentResponseData,
|
|
1444
1821
|
SINGLETON,
|
|
1445
1822
|
StoragePersister,
|
|
1446
1823
|
TOKEN_CACHE_SIZE,
|
|
@@ -1636,6 +2013,52 @@ declare interface SessionOptions {
|
|
|
1636
2013
|
|
|
1637
2014
|
declare type SessionStatus = "pending" | "active" | "ended";
|
|
1638
2015
|
|
|
2016
|
+
/** What a provider's card form is mounted with to add a method. */
|
|
2017
|
+
declare type SetupIntent = SetupIntentResponseData;
|
|
2018
|
+
|
|
2019
|
+
/**
|
|
2020
|
+
* Schematic API
|
|
2021
|
+
* Schematic API
|
|
2022
|
+
*
|
|
2023
|
+
* The version of the OpenAPI document: 0.1
|
|
2024
|
+
*
|
|
2025
|
+
*
|
|
2026
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
2027
|
+
* https://openapi-generator.tech
|
|
2028
|
+
* Do not edit the class manually.
|
|
2029
|
+
*/
|
|
2030
|
+
/**
|
|
2031
|
+
*
|
|
2032
|
+
* @export
|
|
2033
|
+
* @interface SetupIntentResponseData
|
|
2034
|
+
*/
|
|
2035
|
+
declare interface SetupIntentResponseData {
|
|
2036
|
+
/**
|
|
2037
|
+
*
|
|
2038
|
+
* @type {string}
|
|
2039
|
+
* @memberof SetupIntentResponseData
|
|
2040
|
+
*/
|
|
2041
|
+
accountId?: string | null;
|
|
2042
|
+
/**
|
|
2043
|
+
*
|
|
2044
|
+
* @type {string}
|
|
2045
|
+
* @memberof SetupIntentResponseData
|
|
2046
|
+
*/
|
|
2047
|
+
publishableKey?: string | null;
|
|
2048
|
+
/**
|
|
2049
|
+
*
|
|
2050
|
+
* @type {string}
|
|
2051
|
+
* @memberof SetupIntentResponseData
|
|
2052
|
+
*/
|
|
2053
|
+
schematicPublishableKey: string;
|
|
2054
|
+
/**
|
|
2055
|
+
*
|
|
2056
|
+
* @type {string}
|
|
2057
|
+
* @memberof SetupIntentResponseData
|
|
2058
|
+
*/
|
|
2059
|
+
setupIntentClientSecret?: string | null;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
1639
2062
|
/** The params of every singleton resource. */
|
|
1640
2063
|
declare const SINGLETON: Record<string, never>;
|
|
1641
2064
|
|
|
@@ -1751,6 +2174,51 @@ export declare const useSchematicCreditBalance: (creditId: MaybeRefOrGetter<stri
|
|
|
1751
2174
|
isLoading: ComputedRef<boolean>;
|
|
1752
2175
|
};
|
|
1753
2176
|
|
|
2177
|
+
/**
|
|
2178
|
+
* Get every credit spend policy binding the current context.
|
|
2179
|
+
* Returns reactive computed refs for the policies and a loading flag.
|
|
2180
|
+
*
|
|
2181
|
+
* Company-scope policies come first, then the user's own. The list updates
|
|
2182
|
+
* as partials arrive over the DataStream, so a policy edited or deleted in the
|
|
2183
|
+
* dashboard reaches the component without a refetch. A window policy also
|
|
2184
|
+
* carries `consumed` and `resetsAt`, which update as credits are spent.
|
|
2185
|
+
*
|
|
2186
|
+
* @param opts - Optional configuration including a client override
|
|
2187
|
+
* @returns Object with `policies` and `isLoading` computed refs
|
|
2188
|
+
*
|
|
2189
|
+
* @example
|
|
2190
|
+
* ```typescript
|
|
2191
|
+
* const { policies, isLoading } = useSchematicCreditSpendPolicies()
|
|
2192
|
+
*
|
|
2193
|
+
* // In template
|
|
2194
|
+
* <div v-if="isLoading">Loading…</div>
|
|
2195
|
+
* <ul v-else>
|
|
2196
|
+
* <li v-for="policy in policies" :key="policy.id">
|
|
2197
|
+
* {{ policy.scope }} limit: {{ policy.limit }} credits
|
|
2198
|
+
* </li>
|
|
2199
|
+
* </ul>
|
|
2200
|
+
* ```
|
|
2201
|
+
*/
|
|
2202
|
+
export declare const useSchematicCreditSpendPolicies: (opts?: SchematicComposableOpts) => {
|
|
2203
|
+
/** Company-scope policies first, then the user's own; empty when none bind */
|
|
2204
|
+
policies: ComputedRef< {
|
|
2205
|
+
id: string;
|
|
2206
|
+
creditId: string;
|
|
2207
|
+
kind: SchematicJS.CreditSpendPolicyKind;
|
|
2208
|
+
scope: SchematicJS.CreditSpendPolicyScope;
|
|
2209
|
+
label?: string | undefined;
|
|
2210
|
+
limit: number;
|
|
2211
|
+
consumed: number;
|
|
2212
|
+
resetsAt?: Date | undefined;
|
|
2213
|
+
window?: {
|
|
2214
|
+
unit: string;
|
|
2215
|
+
count: number;
|
|
2216
|
+
} | undefined;
|
|
2217
|
+
}[]>;
|
|
2218
|
+
/** True while the policies are still loading and nothing has arrived yet */
|
|
2219
|
+
isLoading: ComputedRef<boolean>;
|
|
2220
|
+
};
|
|
2221
|
+
|
|
1754
2222
|
/**
|
|
1755
2223
|
* Check feature entitlement with usage details
|
|
1756
2224
|
* Returns reactive refs for flag value, usage, allocation, and exceeded status
|