autumn-js 0.0.95 → 0.0.96
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/compose/index.d.mts +201 -0
- package/dist/compose/index.d.ts +201 -0
- package/dist/compose/index.js +147 -0
- package/dist/compose/index.mjs +113 -0
- package/dist/libraries/backend/better-auth.d.mts +3 -2
- package/dist/libraries/backend/better-auth.d.ts +3 -2
- package/dist/libraries/backend/better-auth.js +26 -21
- package/dist/libraries/backend/better-auth.mjs +27 -22
- package/dist/libraries/backend/next.js +94 -94
- package/dist/libraries/backend/next.mjs +94 -94
- package/dist/libraries/react/AutumnContext.d.mts +4 -4
- package/dist/libraries/react/AutumnContext.d.ts +4 -4
- package/dist/libraries/react/BaseAutumnProvider.d.mts +4 -4
- package/dist/libraries/react/BaseAutumnProvider.d.ts +4 -4
- package/dist/libraries/react/{ReactAutumnClient-BuSRDMJN.d.mts → ReactAutumnClient-CXaaDdjS.d.mts} +10 -10
- package/dist/libraries/react/{ReactAutumnClient-k0qbHX8f.d.ts → ReactAutumnClient-iUQGnJyH.d.ts} +10 -10
- package/dist/libraries/react/ReactAutumnProvider.d.mts +1 -1
- package/dist/libraries/react/ReactAutumnProvider.d.ts +1 -1
- package/dist/libraries/react/{chunk-27OTS3Q5.mjs → chunk-6MNYJ3YQ.mjs} +2 -2
- package/dist/libraries/react/{chunk-P2O4LZFD.mjs → chunk-AL3VJLFU.mjs} +1 -1
- package/dist/libraries/react/{chunk-5FZ7IV6P.mjs → chunk-BSF3KB4R.mjs} +46 -46
- package/dist/libraries/react/{chunk-CHXNYNH3.mjs → chunk-IN62REVO.mjs} +279 -279
- package/dist/libraries/react/{chunk-FPI3PLEL.mjs → chunk-OAPUYXBO.mjs} +6 -6
- package/dist/libraries/react/{chunk-CMO5LYYU.mjs → chunk-OAWFFAKA.mjs} +6 -6
- package/dist/libraries/react/{chunk-FEFGYFXQ.mjs → chunk-ZVQKDPUP.mjs} +3 -3
- package/dist/libraries/react/client/ReactAutumnClient.d.mts +4 -4
- package/dist/libraries/react/client/ReactAutumnClient.d.ts +4 -4
- package/dist/libraries/react/client/clientCompMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientCompMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientCusMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientCusMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientEntityMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientEntityMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientGenMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientGenMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientProdMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientProdMethods.d.ts +4 -4
- package/dist/libraries/react/client/clientReferralMethods.d.mts +4 -4
- package/dist/libraries/react/client/clientReferralMethods.d.ts +4 -4
- package/dist/libraries/react/client/types/clientGenTypes.d.mts +12 -12
- package/dist/libraries/react/client/types/clientGenTypes.d.ts +12 -12
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.mts +1 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.d.ts +1 -1
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.js +55 -55
- package/dist/libraries/react/components/attach-dialog/attach-dialog-synced.mjs +9 -9
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.mts +1 -1
- package/dist/libraries/react/components/attach-dialog/lib/attach-content.d.ts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.d.ts +1 -1
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.js +50 -50
- package/dist/libraries/react/components/check-dialog/check-dialog-synced.mjs +5 -5
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.mts +1 -1
- package/dist/libraries/react/components/check-dialog/lib/check-content.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.mts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.d.ts +1 -1
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.js +55 -55
- package/dist/libraries/react/components/pricing-table/pricing-table-synced.mjs +9 -9
- package/dist/libraries/react/components/ui/button.js +3 -3
- package/dist/libraries/react/components/ui/button.mjs +2 -2
- package/dist/libraries/react/components/ui/dialog.js +49 -49
- package/dist/libraries/react/components/ui/dialog.mjs +3 -3
- package/dist/libraries/react/components/ui/switch.js +12 -12
- package/dist/libraries/react/components/ui/switch.mjs +3 -3
- package/dist/libraries/react/{cusTypes-Vw94kPR9.d.ts → cusTypes-WaPJKeAb.d.mts} +1 -1
- package/dist/libraries/react/{cusTypes-Vw94kPR9.d.mts → cusTypes-WaPJKeAb.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-B7nuhHD7.d.ts → entTypes-D01S8gFX.d.ts} +1 -1
- package/dist/libraries/react/{entTypes-Ho-VocKG.d.mts → entTypes-aIV0QUCW.d.mts} +1 -1
- package/dist/libraries/react/hooks/handleAllowed.d.mts +2 -2
- package/dist/libraries/react/hooks/handleAllowed.d.ts +2 -2
- package/dist/libraries/react/hooks/useAutumn.d.mts +2 -2
- package/dist/libraries/react/hooks/useAutumn.d.ts +2 -2
- package/dist/libraries/react/hooks/useAutumnBase.d.mts +4 -4
- package/dist/libraries/react/hooks/useAutumnBase.d.ts +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.mts +4 -4
- package/dist/libraries/react/hooks/useCustomer.d.ts +4 -4
- package/dist/libraries/react/hooks/useCustomerBase.d.mts +4 -4
- package/dist/libraries/react/hooks/useCustomerBase.d.ts +4 -4
- package/dist/libraries/react/hooks/useEntity.d.mts +3 -3
- package/dist/libraries/react/hooks/useEntity.d.ts +3 -3
- package/dist/libraries/react/hooks/useEntityBase.d.mts +4 -4
- package/dist/libraries/react/hooks/useEntityBase.d.ts +4 -4
- package/dist/libraries/react/hooks/usePricingTable.d.mts +1 -1
- package/dist/libraries/react/hooks/usePricingTable.d.ts +1 -1
- package/dist/libraries/react/hooks/usePricingTableBase.d.mts +4 -4
- package/dist/libraries/react/hooks/usePricingTableBase.d.ts +4 -4
- package/dist/libraries/react/index.js +55 -55
- package/dist/libraries/react/index.mjs +55 -55
- package/dist/libraries/react/{response-CQf3mDB8.d.ts → response-C0MTZEqT.d.ts} +7 -7
- package/dist/libraries/react/{response-CWluLfIs.d.mts → response-FC9NTmn2.d.mts} +7 -7
- package/dist/next/client/NextAutumnClient.d.mts +8 -8
- package/dist/next/client/NextAutumnClient.d.ts +8 -8
- package/dist/next/client/hooks/useAutumn.d.mts +1 -1
- package/dist/next/client/hooks/useAutumn.d.ts +1 -1
- package/dist/next/client/hooks/useCustomer.d.mts +1 -1
- package/dist/next/client/hooks/useCustomer.d.ts +1 -1
- package/dist/next/client/hooks/useEntity.d.mts +1 -1
- package/dist/next/client/hooks/useEntity.d.ts +1 -1
- package/package.json +19 -6
- package/tsup.config.ts +12 -3
- package/dist/next/client/{clientGenTypes-9ngy1q97.d.mts → clientGenTypes-BHk25QIO.d.mts} +16 -16
- package/dist/next/client/{clientGenTypes-CxB4go6q.d.ts → clientGenTypes-CpX8Cvjm.d.ts} +16 -16
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare enum ProductItemInterval {
|
|
4
|
+
Minute = "minute",
|
|
5
|
+
Hour = "hour",
|
|
6
|
+
Day = "day",
|
|
7
|
+
Week = "week",
|
|
8
|
+
Month = "month",
|
|
9
|
+
Quarter = "quarter",
|
|
10
|
+
SemiAnnual = "semi_annual",
|
|
11
|
+
Year = "year"
|
|
12
|
+
}
|
|
13
|
+
declare enum UsageModel {
|
|
14
|
+
Prepaid = "prepaid",
|
|
15
|
+
PayPerUse = "pay_per_use"
|
|
16
|
+
}
|
|
17
|
+
declare const ProductItemSchema: z.ZodObject<{
|
|
18
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
19
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
21
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
|
|
22
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
|
|
23
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
27
|
+
feature_id?: string | null | undefined;
|
|
28
|
+
included_usage?: number | "inf" | null | undefined;
|
|
29
|
+
interval?: ProductItemInterval | null | undefined;
|
|
30
|
+
usage_model?: UsageModel | null | undefined;
|
|
31
|
+
price?: number | null | undefined;
|
|
32
|
+
billing_units?: number | null | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
35
|
+
feature_id?: string | null | undefined;
|
|
36
|
+
included_usage?: number | "inf" | null | undefined;
|
|
37
|
+
interval?: ProductItemInterval | null | undefined;
|
|
38
|
+
usage_model?: UsageModel | null | undefined;
|
|
39
|
+
price?: number | null | undefined;
|
|
40
|
+
billing_units?: number | null | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
declare const ProductSchema: z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
46
|
+
is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
47
|
+
items: z.ZodArray<z.ZodObject<{
|
|
48
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
49
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
51
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
|
|
52
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
|
|
53
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
57
|
+
feature_id?: string | null | undefined;
|
|
58
|
+
included_usage?: number | "inf" | null | undefined;
|
|
59
|
+
interval?: ProductItemInterval | null | undefined;
|
|
60
|
+
usage_model?: UsageModel | null | undefined;
|
|
61
|
+
price?: number | null | undefined;
|
|
62
|
+
billing_units?: number | null | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
65
|
+
feature_id?: string | null | undefined;
|
|
66
|
+
included_usage?: number | "inf" | null | undefined;
|
|
67
|
+
interval?: ProductItemInterval | null | undefined;
|
|
68
|
+
usage_model?: UsageModel | null | undefined;
|
|
69
|
+
price?: number | null | undefined;
|
|
70
|
+
billing_units?: number | null | undefined;
|
|
71
|
+
}>, "many">;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
items: {
|
|
76
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
77
|
+
feature_id?: string | null | undefined;
|
|
78
|
+
included_usage?: number | "inf" | null | undefined;
|
|
79
|
+
interval?: ProductItemInterval | null | undefined;
|
|
80
|
+
usage_model?: UsageModel | null | undefined;
|
|
81
|
+
price?: number | null | undefined;
|
|
82
|
+
billing_units?: number | null | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
is_add_on?: boolean | undefined;
|
|
85
|
+
is_default?: boolean | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
items: {
|
|
90
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
91
|
+
feature_id?: string | null | undefined;
|
|
92
|
+
included_usage?: number | "inf" | null | undefined;
|
|
93
|
+
interval?: ProductItemInterval | null | undefined;
|
|
94
|
+
usage_model?: UsageModel | null | undefined;
|
|
95
|
+
price?: number | null | undefined;
|
|
96
|
+
billing_units?: number | null | undefined;
|
|
97
|
+
}[];
|
|
98
|
+
is_add_on?: boolean | undefined;
|
|
99
|
+
is_default?: boolean | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
declare const FeatureSchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
type: z.ZodEnum<["boolean", "continuous_use", "credit_system", "metered"]>;
|
|
105
|
+
display: z.ZodObject<{
|
|
106
|
+
singular: z.ZodString;
|
|
107
|
+
plural: z.ZodString;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
singular: string;
|
|
110
|
+
plural: string;
|
|
111
|
+
}, {
|
|
112
|
+
singular: string;
|
|
113
|
+
plural: string;
|
|
114
|
+
}>;
|
|
115
|
+
credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
116
|
+
metered_feature_id: z.ZodString;
|
|
117
|
+
credit_cost: z.ZodNumber;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
metered_feature_id: string;
|
|
120
|
+
credit_cost: number;
|
|
121
|
+
}, {
|
|
122
|
+
metered_feature_id: string;
|
|
123
|
+
credit_cost: number;
|
|
124
|
+
}>, "many">>>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
type: "boolean" | "continuous_use" | "credit_system" | "metered";
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
display: {
|
|
130
|
+
singular: string;
|
|
131
|
+
plural: string;
|
|
132
|
+
};
|
|
133
|
+
credit_schema?: {
|
|
134
|
+
metered_feature_id: string;
|
|
135
|
+
credit_cost: number;
|
|
136
|
+
}[] | null | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
type: "boolean" | "continuous_use" | "credit_system" | "metered";
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
display: {
|
|
142
|
+
singular: string;
|
|
143
|
+
plural: string;
|
|
144
|
+
};
|
|
145
|
+
credit_schema?: {
|
|
146
|
+
metered_feature_id: string;
|
|
147
|
+
credit_cost: number;
|
|
148
|
+
}[] | null | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
type ProductItem = z.infer<typeof ProductItemSchema>;
|
|
151
|
+
type Feature = z.infer<typeof FeatureSchema>;
|
|
152
|
+
type Product = z.infer<typeof ProductSchema>;
|
|
153
|
+
|
|
154
|
+
interface AutumnKeys {
|
|
155
|
+
prodKey: string;
|
|
156
|
+
sandboxKey: string;
|
|
157
|
+
}
|
|
158
|
+
interface AuthInfo {
|
|
159
|
+
keys: AutumnKeys;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare const product: (p: Product) => {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
items: {
|
|
166
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
167
|
+
feature_id?: string | null | undefined;
|
|
168
|
+
included_usage?: number | "inf" | null | undefined;
|
|
169
|
+
interval?: ProductItemInterval | null | undefined;
|
|
170
|
+
usage_model?: UsageModel | null | undefined;
|
|
171
|
+
price?: number | null | undefined;
|
|
172
|
+
billing_units?: number | null | undefined;
|
|
173
|
+
}[];
|
|
174
|
+
is_add_on?: boolean | undefined;
|
|
175
|
+
is_default?: boolean | undefined;
|
|
176
|
+
};
|
|
177
|
+
declare const auth: (info: AuthInfo) => AuthInfo;
|
|
178
|
+
declare function feature(f: Omit<Feature, "display"> & {
|
|
179
|
+
display?: Feature["display"];
|
|
180
|
+
}): Feature;
|
|
181
|
+
declare const priceItem: ({ price, interval, }: {
|
|
182
|
+
price: number;
|
|
183
|
+
interval: ProductItemInterval;
|
|
184
|
+
}) => ProductItem;
|
|
185
|
+
declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
|
|
186
|
+
feature_id: string;
|
|
187
|
+
price: number;
|
|
188
|
+
interval: ProductItemInterval;
|
|
189
|
+
billing_units?: number;
|
|
190
|
+
usage_model?: UsageModel;
|
|
191
|
+
included_usage?: number;
|
|
192
|
+
}) => ProductItem;
|
|
193
|
+
declare const featureItem: ({ feature_id, included_usage, interval, }: {
|
|
194
|
+
feature_id: string;
|
|
195
|
+
included_usage: number;
|
|
196
|
+
interval?: ProductItemInterval;
|
|
197
|
+
}) => ProductItem;
|
|
198
|
+
|
|
199
|
+
type Infinity = "infinity";
|
|
200
|
+
|
|
201
|
+
export { type Feature, type Infinity, type Product, type ProductItem, ProductItemInterval, UsageModel, auth, feature, featureItem, priceItem, pricedFeatureItem, product };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare enum ProductItemInterval {
|
|
4
|
+
Minute = "minute",
|
|
5
|
+
Hour = "hour",
|
|
6
|
+
Day = "day",
|
|
7
|
+
Week = "week",
|
|
8
|
+
Month = "month",
|
|
9
|
+
Quarter = "quarter",
|
|
10
|
+
SemiAnnual = "semi_annual",
|
|
11
|
+
Year = "year"
|
|
12
|
+
}
|
|
13
|
+
declare enum UsageModel {
|
|
14
|
+
Prepaid = "prepaid",
|
|
15
|
+
PayPerUse = "pay_per_use"
|
|
16
|
+
}
|
|
17
|
+
declare const ProductItemSchema: z.ZodObject<{
|
|
18
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
19
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
21
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
|
|
22
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
|
|
23
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
24
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
27
|
+
feature_id?: string | null | undefined;
|
|
28
|
+
included_usage?: number | "inf" | null | undefined;
|
|
29
|
+
interval?: ProductItemInterval | null | undefined;
|
|
30
|
+
usage_model?: UsageModel | null | undefined;
|
|
31
|
+
price?: number | null | undefined;
|
|
32
|
+
billing_units?: number | null | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
35
|
+
feature_id?: string | null | undefined;
|
|
36
|
+
included_usage?: number | "inf" | null | undefined;
|
|
37
|
+
interval?: ProductItemInterval | null | undefined;
|
|
38
|
+
usage_model?: UsageModel | null | undefined;
|
|
39
|
+
price?: number | null | undefined;
|
|
40
|
+
billing_units?: number | null | undefined;
|
|
41
|
+
}>;
|
|
42
|
+
declare const ProductSchema: z.ZodObject<{
|
|
43
|
+
id: z.ZodString;
|
|
44
|
+
name: z.ZodString;
|
|
45
|
+
is_add_on: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
46
|
+
is_default: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
|
|
47
|
+
items: z.ZodArray<z.ZodObject<{
|
|
48
|
+
type: z.ZodOptional<z.ZodNullable<z.ZodEnum<["feature", "priced_feature"]>>>;
|
|
49
|
+
feature_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
included_usage: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodNumber, z.ZodLiteral<"inf">]>>>;
|
|
51
|
+
interval: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof ProductItemInterval>>>;
|
|
52
|
+
usage_model: z.ZodOptional<z.ZodNullable<z.ZodNativeEnum<typeof UsageModel>>>;
|
|
53
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
|
+
billing_units: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
57
|
+
feature_id?: string | null | undefined;
|
|
58
|
+
included_usage?: number | "inf" | null | undefined;
|
|
59
|
+
interval?: ProductItemInterval | null | undefined;
|
|
60
|
+
usage_model?: UsageModel | null | undefined;
|
|
61
|
+
price?: number | null | undefined;
|
|
62
|
+
billing_units?: number | null | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
65
|
+
feature_id?: string | null | undefined;
|
|
66
|
+
included_usage?: number | "inf" | null | undefined;
|
|
67
|
+
interval?: ProductItemInterval | null | undefined;
|
|
68
|
+
usage_model?: UsageModel | null | undefined;
|
|
69
|
+
price?: number | null | undefined;
|
|
70
|
+
billing_units?: number | null | undefined;
|
|
71
|
+
}>, "many">;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
items: {
|
|
76
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
77
|
+
feature_id?: string | null | undefined;
|
|
78
|
+
included_usage?: number | "inf" | null | undefined;
|
|
79
|
+
interval?: ProductItemInterval | null | undefined;
|
|
80
|
+
usage_model?: UsageModel | null | undefined;
|
|
81
|
+
price?: number | null | undefined;
|
|
82
|
+
billing_units?: number | null | undefined;
|
|
83
|
+
}[];
|
|
84
|
+
is_add_on?: boolean | undefined;
|
|
85
|
+
is_default?: boolean | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
items: {
|
|
90
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
91
|
+
feature_id?: string | null | undefined;
|
|
92
|
+
included_usage?: number | "inf" | null | undefined;
|
|
93
|
+
interval?: ProductItemInterval | null | undefined;
|
|
94
|
+
usage_model?: UsageModel | null | undefined;
|
|
95
|
+
price?: number | null | undefined;
|
|
96
|
+
billing_units?: number | null | undefined;
|
|
97
|
+
}[];
|
|
98
|
+
is_add_on?: boolean | undefined;
|
|
99
|
+
is_default?: boolean | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
declare const FeatureSchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
name: z.ZodString;
|
|
104
|
+
type: z.ZodEnum<["boolean", "continuous_use", "credit_system", "metered"]>;
|
|
105
|
+
display: z.ZodObject<{
|
|
106
|
+
singular: z.ZodString;
|
|
107
|
+
plural: z.ZodString;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
singular: string;
|
|
110
|
+
plural: string;
|
|
111
|
+
}, {
|
|
112
|
+
singular: string;
|
|
113
|
+
plural: string;
|
|
114
|
+
}>;
|
|
115
|
+
credit_schema: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
116
|
+
metered_feature_id: z.ZodString;
|
|
117
|
+
credit_cost: z.ZodNumber;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
metered_feature_id: string;
|
|
120
|
+
credit_cost: number;
|
|
121
|
+
}, {
|
|
122
|
+
metered_feature_id: string;
|
|
123
|
+
credit_cost: number;
|
|
124
|
+
}>, "many">>>;
|
|
125
|
+
}, "strip", z.ZodTypeAny, {
|
|
126
|
+
type: "boolean" | "continuous_use" | "credit_system" | "metered";
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
display: {
|
|
130
|
+
singular: string;
|
|
131
|
+
plural: string;
|
|
132
|
+
};
|
|
133
|
+
credit_schema?: {
|
|
134
|
+
metered_feature_id: string;
|
|
135
|
+
credit_cost: number;
|
|
136
|
+
}[] | null | undefined;
|
|
137
|
+
}, {
|
|
138
|
+
type: "boolean" | "continuous_use" | "credit_system" | "metered";
|
|
139
|
+
id: string;
|
|
140
|
+
name: string;
|
|
141
|
+
display: {
|
|
142
|
+
singular: string;
|
|
143
|
+
plural: string;
|
|
144
|
+
};
|
|
145
|
+
credit_schema?: {
|
|
146
|
+
metered_feature_id: string;
|
|
147
|
+
credit_cost: number;
|
|
148
|
+
}[] | null | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
type ProductItem = z.infer<typeof ProductItemSchema>;
|
|
151
|
+
type Feature = z.infer<typeof FeatureSchema>;
|
|
152
|
+
type Product = z.infer<typeof ProductSchema>;
|
|
153
|
+
|
|
154
|
+
interface AutumnKeys {
|
|
155
|
+
prodKey: string;
|
|
156
|
+
sandboxKey: string;
|
|
157
|
+
}
|
|
158
|
+
interface AuthInfo {
|
|
159
|
+
keys: AutumnKeys;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
declare const product: (p: Product) => {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
items: {
|
|
166
|
+
type?: "feature" | "priced_feature" | null | undefined;
|
|
167
|
+
feature_id?: string | null | undefined;
|
|
168
|
+
included_usage?: number | "inf" | null | undefined;
|
|
169
|
+
interval?: ProductItemInterval | null | undefined;
|
|
170
|
+
usage_model?: UsageModel | null | undefined;
|
|
171
|
+
price?: number | null | undefined;
|
|
172
|
+
billing_units?: number | null | undefined;
|
|
173
|
+
}[];
|
|
174
|
+
is_add_on?: boolean | undefined;
|
|
175
|
+
is_default?: boolean | undefined;
|
|
176
|
+
};
|
|
177
|
+
declare const auth: (info: AuthInfo) => AuthInfo;
|
|
178
|
+
declare function feature(f: Omit<Feature, "display"> & {
|
|
179
|
+
display?: Feature["display"];
|
|
180
|
+
}): Feature;
|
|
181
|
+
declare const priceItem: ({ price, interval, }: {
|
|
182
|
+
price: number;
|
|
183
|
+
interval: ProductItemInterval;
|
|
184
|
+
}) => ProductItem;
|
|
185
|
+
declare const pricedFeatureItem: ({ feature_id, price, interval, included_usage, billing_units, usage_model, }: {
|
|
186
|
+
feature_id: string;
|
|
187
|
+
price: number;
|
|
188
|
+
interval: ProductItemInterval;
|
|
189
|
+
billing_units?: number;
|
|
190
|
+
usage_model?: UsageModel;
|
|
191
|
+
included_usage?: number;
|
|
192
|
+
}) => ProductItem;
|
|
193
|
+
declare const featureItem: ({ feature_id, included_usage, interval, }: {
|
|
194
|
+
feature_id: string;
|
|
195
|
+
included_usage: number;
|
|
196
|
+
interval?: ProductItemInterval;
|
|
197
|
+
}) => ProductItem;
|
|
198
|
+
|
|
199
|
+
type Infinity = "infinity";
|
|
200
|
+
|
|
201
|
+
export { type Feature, type Infinity, type Product, type ProductItem, ProductItemInterval, UsageModel, auth, feature, featureItem, priceItem, pricedFeatureItem, product };
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/compose/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ProductItemInterval: () => ProductItemInterval,
|
|
24
|
+
UsageModel: () => UsageModel,
|
|
25
|
+
auth: () => auth,
|
|
26
|
+
feature: () => feature,
|
|
27
|
+
featureItem: () => featureItem,
|
|
28
|
+
priceItem: () => priceItem,
|
|
29
|
+
pricedFeatureItem: () => pricedFeatureItem,
|
|
30
|
+
product: () => product
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(index_exports);
|
|
33
|
+
|
|
34
|
+
// src/compose/models/core.ts
|
|
35
|
+
var import_zod = require("zod");
|
|
36
|
+
var ProductItemInterval = /* @__PURE__ */ ((ProductItemInterval3) => {
|
|
37
|
+
ProductItemInterval3["Minute"] = "minute";
|
|
38
|
+
ProductItemInterval3["Hour"] = "hour";
|
|
39
|
+
ProductItemInterval3["Day"] = "day";
|
|
40
|
+
ProductItemInterval3["Week"] = "week";
|
|
41
|
+
ProductItemInterval3["Month"] = "month";
|
|
42
|
+
ProductItemInterval3["Quarter"] = "quarter";
|
|
43
|
+
ProductItemInterval3["SemiAnnual"] = "semi_annual";
|
|
44
|
+
ProductItemInterval3["Year"] = "year";
|
|
45
|
+
return ProductItemInterval3;
|
|
46
|
+
})(ProductItemInterval || {});
|
|
47
|
+
var UsageModel = /* @__PURE__ */ ((UsageModel2) => {
|
|
48
|
+
UsageModel2["Prepaid"] = "prepaid";
|
|
49
|
+
UsageModel2["PayPerUse"] = "pay_per_use";
|
|
50
|
+
return UsageModel2;
|
|
51
|
+
})(UsageModel || {});
|
|
52
|
+
var ProductItemSchema = import_zod.z.object({
|
|
53
|
+
// Feature stuff
|
|
54
|
+
type: import_zod.z.enum(["feature", "priced_feature"]).nullish(),
|
|
55
|
+
feature_id: import_zod.z.string().nullish(),
|
|
56
|
+
included_usage: import_zod.z.union([import_zod.z.number(), import_zod.z.literal("inf")]).nullish(),
|
|
57
|
+
interval: import_zod.z.nativeEnum(ProductItemInterval).nullish(),
|
|
58
|
+
// Price config
|
|
59
|
+
usage_model: import_zod.z.nativeEnum(UsageModel).nullish(),
|
|
60
|
+
price: import_zod.z.number().nullish(),
|
|
61
|
+
billing_units: import_zod.z.number().nullish()
|
|
62
|
+
// amount per billing unit (eg. $9 / 250 units)
|
|
63
|
+
});
|
|
64
|
+
var ProductSchema = import_zod.z.object({
|
|
65
|
+
id: import_zod.z.string().nonempty(),
|
|
66
|
+
name: import_zod.z.string().nonempty(),
|
|
67
|
+
is_add_on: import_zod.z.boolean().default(false).optional(),
|
|
68
|
+
is_default: import_zod.z.boolean().default(false).optional(),
|
|
69
|
+
items: import_zod.z.array(ProductItemSchema)
|
|
70
|
+
});
|
|
71
|
+
var FeatureSchema = import_zod.z.object({
|
|
72
|
+
id: import_zod.z.string().nonempty(),
|
|
73
|
+
name: import_zod.z.string().nonempty(),
|
|
74
|
+
type: import_zod.z.enum(["boolean", "continuous_use", "credit_system", "metered"]),
|
|
75
|
+
display: import_zod.z.object({
|
|
76
|
+
singular: import_zod.z.string(),
|
|
77
|
+
plural: import_zod.z.string()
|
|
78
|
+
}),
|
|
79
|
+
credit_schema: import_zod.z.array(
|
|
80
|
+
import_zod.z.object({
|
|
81
|
+
metered_feature_id: import_zod.z.string(),
|
|
82
|
+
credit_cost: import_zod.z.number()
|
|
83
|
+
})
|
|
84
|
+
).nullish()
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// src/compose/builders/core.ts
|
|
88
|
+
var product = (p) => p;
|
|
89
|
+
var auth = (info) => info;
|
|
90
|
+
function feature(f) {
|
|
91
|
+
let f_ = f;
|
|
92
|
+
if (!f_.display) {
|
|
93
|
+
f_.display = {
|
|
94
|
+
singular: f_.name,
|
|
95
|
+
plural: f_.name
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return f_;
|
|
99
|
+
}
|
|
100
|
+
var priceItem = ({
|
|
101
|
+
price,
|
|
102
|
+
interval
|
|
103
|
+
}) => {
|
|
104
|
+
return {
|
|
105
|
+
price,
|
|
106
|
+
interval
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
var pricedFeatureItem = ({
|
|
110
|
+
feature_id,
|
|
111
|
+
price,
|
|
112
|
+
interval,
|
|
113
|
+
included_usage = void 0,
|
|
114
|
+
billing_units = 1,
|
|
115
|
+
usage_model = "prepaid" /* Prepaid */
|
|
116
|
+
}) => {
|
|
117
|
+
return {
|
|
118
|
+
price,
|
|
119
|
+
interval,
|
|
120
|
+
billing_units,
|
|
121
|
+
feature_id,
|
|
122
|
+
usage_model,
|
|
123
|
+
included_usage
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
var featureItem = ({
|
|
127
|
+
feature_id,
|
|
128
|
+
included_usage,
|
|
129
|
+
interval
|
|
130
|
+
}) => {
|
|
131
|
+
return {
|
|
132
|
+
included_usage,
|
|
133
|
+
interval,
|
|
134
|
+
feature_id
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
138
|
+
0 && (module.exports = {
|
|
139
|
+
ProductItemInterval,
|
|
140
|
+
UsageModel,
|
|
141
|
+
auth,
|
|
142
|
+
feature,
|
|
143
|
+
featureItem,
|
|
144
|
+
priceItem,
|
|
145
|
+
pricedFeatureItem,
|
|
146
|
+
product
|
|
147
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// src/compose/models/core.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var ProductItemInterval = /* @__PURE__ */ ((ProductItemInterval3) => {
|
|
4
|
+
ProductItemInterval3["Minute"] = "minute";
|
|
5
|
+
ProductItemInterval3["Hour"] = "hour";
|
|
6
|
+
ProductItemInterval3["Day"] = "day";
|
|
7
|
+
ProductItemInterval3["Week"] = "week";
|
|
8
|
+
ProductItemInterval3["Month"] = "month";
|
|
9
|
+
ProductItemInterval3["Quarter"] = "quarter";
|
|
10
|
+
ProductItemInterval3["SemiAnnual"] = "semi_annual";
|
|
11
|
+
ProductItemInterval3["Year"] = "year";
|
|
12
|
+
return ProductItemInterval3;
|
|
13
|
+
})(ProductItemInterval || {});
|
|
14
|
+
var UsageModel = /* @__PURE__ */ ((UsageModel2) => {
|
|
15
|
+
UsageModel2["Prepaid"] = "prepaid";
|
|
16
|
+
UsageModel2["PayPerUse"] = "pay_per_use";
|
|
17
|
+
return UsageModel2;
|
|
18
|
+
})(UsageModel || {});
|
|
19
|
+
var ProductItemSchema = z.object({
|
|
20
|
+
// Feature stuff
|
|
21
|
+
type: z.enum(["feature", "priced_feature"]).nullish(),
|
|
22
|
+
feature_id: z.string().nullish(),
|
|
23
|
+
included_usage: z.union([z.number(), z.literal("inf")]).nullish(),
|
|
24
|
+
interval: z.nativeEnum(ProductItemInterval).nullish(),
|
|
25
|
+
// Price config
|
|
26
|
+
usage_model: z.nativeEnum(UsageModel).nullish(),
|
|
27
|
+
price: z.number().nullish(),
|
|
28
|
+
billing_units: z.number().nullish()
|
|
29
|
+
// amount per billing unit (eg. $9 / 250 units)
|
|
30
|
+
});
|
|
31
|
+
var ProductSchema = z.object({
|
|
32
|
+
id: z.string().nonempty(),
|
|
33
|
+
name: z.string().nonempty(),
|
|
34
|
+
is_add_on: z.boolean().default(false).optional(),
|
|
35
|
+
is_default: z.boolean().default(false).optional(),
|
|
36
|
+
items: z.array(ProductItemSchema)
|
|
37
|
+
});
|
|
38
|
+
var FeatureSchema = z.object({
|
|
39
|
+
id: z.string().nonempty(),
|
|
40
|
+
name: z.string().nonempty(),
|
|
41
|
+
type: z.enum(["boolean", "continuous_use", "credit_system", "metered"]),
|
|
42
|
+
display: z.object({
|
|
43
|
+
singular: z.string(),
|
|
44
|
+
plural: z.string()
|
|
45
|
+
}),
|
|
46
|
+
credit_schema: z.array(
|
|
47
|
+
z.object({
|
|
48
|
+
metered_feature_id: z.string(),
|
|
49
|
+
credit_cost: z.number()
|
|
50
|
+
})
|
|
51
|
+
).nullish()
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/compose/builders/core.ts
|
|
55
|
+
var product = (p) => p;
|
|
56
|
+
var auth = (info) => info;
|
|
57
|
+
function feature(f) {
|
|
58
|
+
let f_ = f;
|
|
59
|
+
if (!f_.display) {
|
|
60
|
+
f_.display = {
|
|
61
|
+
singular: f_.name,
|
|
62
|
+
plural: f_.name
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return f_;
|
|
66
|
+
}
|
|
67
|
+
var priceItem = ({
|
|
68
|
+
price,
|
|
69
|
+
interval
|
|
70
|
+
}) => {
|
|
71
|
+
return {
|
|
72
|
+
price,
|
|
73
|
+
interval
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
var pricedFeatureItem = ({
|
|
77
|
+
feature_id,
|
|
78
|
+
price,
|
|
79
|
+
interval,
|
|
80
|
+
included_usage = void 0,
|
|
81
|
+
billing_units = 1,
|
|
82
|
+
usage_model = "prepaid" /* Prepaid */
|
|
83
|
+
}) => {
|
|
84
|
+
return {
|
|
85
|
+
price,
|
|
86
|
+
interval,
|
|
87
|
+
billing_units,
|
|
88
|
+
feature_id,
|
|
89
|
+
usage_model,
|
|
90
|
+
included_usage
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
var featureItem = ({
|
|
94
|
+
feature_id,
|
|
95
|
+
included_usage,
|
|
96
|
+
interval
|
|
97
|
+
}) => {
|
|
98
|
+
return {
|
|
99
|
+
included_usage,
|
|
100
|
+
interval,
|
|
101
|
+
feature_id
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
ProductItemInterval,
|
|
106
|
+
UsageModel,
|
|
107
|
+
auth,
|
|
108
|
+
feature,
|
|
109
|
+
featureItem,
|
|
110
|
+
priceItem,
|
|
111
|
+
pricedFeatureItem,
|
|
112
|
+
product
|
|
113
|
+
};
|
|
@@ -66,8 +66,9 @@ declare const autumn: (options?: {
|
|
|
66
66
|
}, {
|
|
67
67
|
expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
|
|
68
68
|
}>;
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
metadata: {
|
|
70
|
+
isAction: boolean;
|
|
71
|
+
};
|
|
71
72
|
};
|
|
72
73
|
path: "/autumn/customers";
|
|
73
74
|
};
|
|
@@ -66,8 +66,9 @@ declare const autumn: (options?: {
|
|
|
66
66
|
}, {
|
|
67
67
|
expand?: ("invoices" | "rewards" | "trials_used" | "entities" | "referrals" | "payment_method")[] | undefined;
|
|
68
68
|
}>;
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
metadata: {
|
|
70
|
+
isAction: boolean;
|
|
71
|
+
};
|
|
71
72
|
};
|
|
72
73
|
path: "/autumn/customers";
|
|
73
74
|
};
|