@idelio/contracts 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/api-keys.d.ts +44 -0
- package/dist/api-keys.js +19 -0
- package/dist/assets.d.ts +188 -0
- package/dist/assets.js +107 -0
- package/dist/billing.d.ts +94 -0
- package/dist/billing.js +67 -0
- package/dist/brands.d.ts +641 -0
- package/dist/brands.js +364 -0
- package/dist/catalog.d.ts +26 -0
- package/dist/catalog.js +53 -0
- package/dist/consent.d.ts +60 -0
- package/dist/consent.js +65 -0
- package/dist/creative-direction.d.ts +333 -0
- package/dist/creative-direction.js +681 -0
- package/dist/credits.d.ts +38 -0
- package/dist/credits.js +31 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.js +22 -0
- package/dist/events.d.ts +20 -0
- package/dist/events.js +29 -0
- package/dist/ids.d.ts +28 -0
- package/dist/ids.js +29 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +19 -0
- package/dist/jobs.d.ts +100 -0
- package/dist/jobs.js +81 -0
- package/dist/me.d.ts +77 -0
- package/dist/me.js +45 -0
- package/dist/notifications.d.ts +17 -0
- package/dist/notifications.js +26 -0
- package/dist/pricing.d.ts +38 -0
- package/dist/pricing.js +105 -0
- package/dist/rate-limits.d.ts +8 -0
- package/dist/rate-limits.js +18 -0
- package/dist/usage.d.ts +22 -0
- package/dist/usage.js +11 -0
- package/dist/waitlist.d.ts +34 -0
- package/dist/waitlist.js +27 -0
- package/dist/webhooks.d.ts +74 -0
- package/dist/webhooks.js +26 -0
- package/openapi/openapi.yaml +3026 -0
- package/package.json +54 -0
package/dist/pricing.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
export const ASSET_BASE_CREDITS = {
|
|
2
|
+
logo: 5,
|
|
3
|
+
color_palette: 0,
|
|
4
|
+
font_pairing: 0,
|
|
5
|
+
logo_alternative: 1,
|
|
6
|
+
logo_mono: 1,
|
|
7
|
+
logo_reversed: 1,
|
|
8
|
+
logo_wordmark: 1,
|
|
9
|
+
favicon: 1,
|
|
10
|
+
brand_guide: 10,
|
|
11
|
+
business_card: 3,
|
|
12
|
+
letterhead: 2,
|
|
13
|
+
mockup: 5,
|
|
14
|
+
app_icon: 1,
|
|
15
|
+
og_image: 3,
|
|
16
|
+
email_signature: 2,
|
|
17
|
+
hero_image: 5,
|
|
18
|
+
play_feature_graphic: 3,
|
|
19
|
+
profile_avatar: 1,
|
|
20
|
+
social_x: 2,
|
|
21
|
+
social_linkedin: 2,
|
|
22
|
+
social_linkedin_personal: 2,
|
|
23
|
+
social_facebook: 2,
|
|
24
|
+
social_youtube: 2,
|
|
25
|
+
social_post: 3,
|
|
26
|
+
social_story: 3,
|
|
27
|
+
custom_image: 4,
|
|
28
|
+
};
|
|
29
|
+
export const CREDIT_MULTIPLIERS = {
|
|
30
|
+
flash: 0.8,
|
|
31
|
+
studio: 1.0,
|
|
32
|
+
elite: 1.5,
|
|
33
|
+
};
|
|
34
|
+
export const FREE_KINDS = new Set(["color_palette", "font_pairing"]);
|
|
35
|
+
export const LOW_CREDITS_THRESHOLD = 25;
|
|
36
|
+
export const FREE_PLAN_CREDITS = 25;
|
|
37
|
+
export const DNA_REFINE_CREDITS = 3;
|
|
38
|
+
export const LOGO_CONCEPT_REGENERATE_CREDITS = 2;
|
|
39
|
+
export function estimateCredits(assets, tier) {
|
|
40
|
+
const base = assets.reduce((sum, kind) => sum + ASSET_BASE_CREDITS[kind], 0);
|
|
41
|
+
return Math.ceil(base * CREDIT_MULTIPLIERS[tier]);
|
|
42
|
+
}
|
|
43
|
+
export function creditsForKind(kind) {
|
|
44
|
+
const credits = ASSET_BASE_CREDITS[kind];
|
|
45
|
+
return credits ?? null;
|
|
46
|
+
}
|
|
47
|
+
export const PLANS = [
|
|
48
|
+
{
|
|
49
|
+
id: "free",
|
|
50
|
+
name: "Free",
|
|
51
|
+
priceUsd: 0,
|
|
52
|
+
credits: 25,
|
|
53
|
+
features: ["Your first brand, on us", "Core assets - logo & colors", "No card required"],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "pro",
|
|
57
|
+
name: "Pro",
|
|
58
|
+
priceUsd: 29,
|
|
59
|
+
credits: 250,
|
|
60
|
+
popular: true,
|
|
61
|
+
features: [
|
|
62
|
+
"Unlimited brand projects",
|
|
63
|
+
"Every asset in the catalogue",
|
|
64
|
+
"Chat refinement with the team",
|
|
65
|
+
"Credits roll over month to month",
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "studio",
|
|
70
|
+
name: "Studio",
|
|
71
|
+
priceUsd: 79,
|
|
72
|
+
credits: 750,
|
|
73
|
+
features: [
|
|
74
|
+
"Everything in Pro",
|
|
75
|
+
"Elite AI team included",
|
|
76
|
+
"White-label packages",
|
|
77
|
+
"Team seats (up to 5)",
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "agency",
|
|
82
|
+
name: "Agency",
|
|
83
|
+
priceUsd: 129,
|
|
84
|
+
credits: 1400,
|
|
85
|
+
features: [
|
|
86
|
+
"Everything in Studio",
|
|
87
|
+
"Unlimited team seats",
|
|
88
|
+
"Client workspaces",
|
|
89
|
+
"Dedicated support",
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
export const CREDIT_PACKS = [
|
|
94
|
+
{ credits: 100, priceUsd: 15, perCreditUsd: 0.15 },
|
|
95
|
+
{ credits: 300, priceUsd: 39, perCreditUsd: 0.13, badge: "MOST POPULAR" },
|
|
96
|
+
{ credits: 1000, priceUsd: 99, perCreditUsd: 0.099, badge: "BEST VALUE" },
|
|
97
|
+
];
|
|
98
|
+
export const TAX_NOTICE = "Prices exclude tax. Any tax due is shown at checkout.";
|
|
99
|
+
export const SELLER_NOTICE = "Sold by SFER LABS LLC. Stripe processes the payment.";
|
|
100
|
+
export function renewalNotice(priceUsd) {
|
|
101
|
+
return `Renews automatically at $${priceUsd} every month until canceled. Cancel online at any time.`;
|
|
102
|
+
}
|
|
103
|
+
export const DEFAULT_AUTO_TOPUP_PACK_CREDITS = 300;
|
|
104
|
+
export const AGENCY_RATES = { baseUsd: 3800, perAssetUsd: 520 };
|
|
105
|
+
export const CALCULATOR = { planCoveredAssets: 24, topUpPerAssetUsd: 1.2 };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Plan } from "./pricing.js";
|
|
2
|
+
export declare const RATE_LIMITS_PER_PLAN: Record<Plan["id"], {
|
|
3
|
+
limitPerMinute: number;
|
|
4
|
+
burst: number;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const MAX_CONCURRENT_JOBS_PER_PLAN: Record<Plan["id"], number>;
|
|
7
|
+
export declare const CONCURRENCY_CAPPED_JOB_KINDS: readonly ["brand_generation", "asset_regeneration", "brand_expand", "brand_dna_refine"];
|
|
8
|
+
export type ConcurrencyCappedJobKind = (typeof CONCURRENCY_CAPPED_JOB_KINDS)[number];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const RATE_LIMITS_PER_PLAN = {
|
|
2
|
+
free: { limitPerMinute: 60, burst: 120 },
|
|
3
|
+
pro: { limitPerMinute: 120, burst: 240 },
|
|
4
|
+
studio: { limitPerMinute: 300, burst: 600 },
|
|
5
|
+
agency: { limitPerMinute: 600, burst: 1200 },
|
|
6
|
+
};
|
|
7
|
+
export const MAX_CONCURRENT_JOBS_PER_PLAN = {
|
|
8
|
+
free: 3,
|
|
9
|
+
pro: 6,
|
|
10
|
+
studio: 12,
|
|
11
|
+
agency: 24,
|
|
12
|
+
};
|
|
13
|
+
export const CONCURRENCY_CAPPED_JOB_KINDS = [
|
|
14
|
+
"brand_generation",
|
|
15
|
+
"asset_regeneration",
|
|
16
|
+
"brand_expand",
|
|
17
|
+
"brand_dna_refine",
|
|
18
|
+
];
|
package/dist/usage.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const usageBucketSchema: z.ZodObject<{
|
|
3
|
+
bucket: z.ZodString;
|
|
4
|
+
requests: z.ZodNumber;
|
|
5
|
+
credits: z.ZodNumber;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type UsageBucket = z.infer<typeof usageBucketSchema>;
|
|
8
|
+
export declare const usageGranularities: readonly ["day", "week", "month"];
|
|
9
|
+
export declare const usageGranularitySchema: z.ZodEnum<{
|
|
10
|
+
month: "month";
|
|
11
|
+
day: "day";
|
|
12
|
+
week: "week";
|
|
13
|
+
}>;
|
|
14
|
+
export type UsageGranularity = z.infer<typeof usageGranularitySchema>;
|
|
15
|
+
export declare const usagePageSchema: z.ZodObject<{
|
|
16
|
+
data: z.ZodArray<z.ZodObject<{
|
|
17
|
+
bucket: z.ZodString;
|
|
18
|
+
requests: z.ZodNumber;
|
|
19
|
+
credits: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type UsagePage = z.infer<typeof usagePageSchema>;
|
package/dist/usage.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const usageBucketSchema = z.object({
|
|
3
|
+
bucket: z.string().datetime(),
|
|
4
|
+
requests: z.number().int().nonnegative(),
|
|
5
|
+
credits: z.number().int().nonnegative(),
|
|
6
|
+
});
|
|
7
|
+
export const usageGranularities = ["day", "week", "month"];
|
|
8
|
+
export const usageGranularitySchema = z.enum(usageGranularities);
|
|
9
|
+
export const usagePageSchema = z.object({
|
|
10
|
+
data: z.array(usageBucketSchema),
|
|
11
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const waitlistAttributionSchema: z.ZodObject<{
|
|
3
|
+
utm_source: z.ZodOptional<z.ZodString>;
|
|
4
|
+
utm_medium: z.ZodOptional<z.ZodString>;
|
|
5
|
+
utm_campaign: z.ZodOptional<z.ZodString>;
|
|
6
|
+
utm_term: z.ZodOptional<z.ZodString>;
|
|
7
|
+
utm_content: z.ZodOptional<z.ZodString>;
|
|
8
|
+
gclid: z.ZodOptional<z.ZodString>;
|
|
9
|
+
fbclid: z.ZodOptional<z.ZodString>;
|
|
10
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
11
|
+
landing_page: z.ZodOptional<z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type WaitlistAttribution = z.infer<typeof waitlistAttributionSchema>;
|
|
14
|
+
export declare const waitlistSignupRequestSchema: z.ZodObject<{
|
|
15
|
+
email: z.ZodString;
|
|
16
|
+
marketing_consent: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
+
privacy_policy_version: z.ZodOptional<z.ZodString>;
|
|
18
|
+
attribution: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
utm_source: z.ZodOptional<z.ZodString>;
|
|
20
|
+
utm_medium: z.ZodOptional<z.ZodString>;
|
|
21
|
+
utm_campaign: z.ZodOptional<z.ZodString>;
|
|
22
|
+
utm_term: z.ZodOptional<z.ZodString>;
|
|
23
|
+
utm_content: z.ZodOptional<z.ZodString>;
|
|
24
|
+
gclid: z.ZodOptional<z.ZodString>;
|
|
25
|
+
fbclid: z.ZodOptional<z.ZodString>;
|
|
26
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
27
|
+
landing_page: z.ZodOptional<z.ZodString>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type WaitlistSignupRequest = z.infer<typeof waitlistSignupRequestSchema>;
|
|
31
|
+
export declare const waitlistSignupResponseSchema: z.ZodObject<{
|
|
32
|
+
status: z.ZodLiteral<"joined">;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type WaitlistSignupResponse = z.infer<typeof waitlistSignupResponseSchema>;
|
package/dist/waitlist.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const attributionValue = z.string().trim().min(1).max(512).optional();
|
|
3
|
+
export const waitlistAttributionSchema = z.object({
|
|
4
|
+
utm_source: attributionValue,
|
|
5
|
+
utm_medium: attributionValue,
|
|
6
|
+
utm_campaign: attributionValue,
|
|
7
|
+
utm_term: attributionValue,
|
|
8
|
+
utm_content: attributionValue,
|
|
9
|
+
gclid: attributionValue,
|
|
10
|
+
fbclid: attributionValue,
|
|
11
|
+
referrer: attributionValue,
|
|
12
|
+
landing_page: attributionValue,
|
|
13
|
+
});
|
|
14
|
+
export const waitlistSignupRequestSchema = z
|
|
15
|
+
.object({
|
|
16
|
+
email: z.string().trim().toLowerCase().email(),
|
|
17
|
+
marketing_consent: z.boolean().default(false),
|
|
18
|
+
privacy_policy_version: z.string().min(1).optional(),
|
|
19
|
+
attribution: waitlistAttributionSchema.optional(),
|
|
20
|
+
})
|
|
21
|
+
.refine((v) => !v.marketing_consent || !!v.privacy_policy_version, {
|
|
22
|
+
message: "privacy_policy_version is required when marketing_consent is true",
|
|
23
|
+
path: ["privacy_policy_version"],
|
|
24
|
+
});
|
|
25
|
+
export const waitlistSignupResponseSchema = z.object({
|
|
26
|
+
status: z.literal("joined"),
|
|
27
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const webhookEndpointSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
url: z.ZodString;
|
|
5
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
6
|
+
"brand.completed": "brand.completed";
|
|
7
|
+
"brand.updated": "brand.updated";
|
|
8
|
+
"asset.ready": "asset.ready";
|
|
9
|
+
"asset.regenerated": "asset.regenerated";
|
|
10
|
+
"job.failed": "job.failed";
|
|
11
|
+
"credits.low": "credits.low";
|
|
12
|
+
"credits.settled": "credits.settled";
|
|
13
|
+
"subscription.changed": "subscription.changed";
|
|
14
|
+
}>>;
|
|
15
|
+
disabled: z.ZodBoolean;
|
|
16
|
+
created_at: z.ZodString;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const webhookEndpointCreateResponseSchema: z.ZodObject<{
|
|
19
|
+
endpoint: z.ZodObject<{
|
|
20
|
+
id: z.ZodString;
|
|
21
|
+
url: z.ZodString;
|
|
22
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
23
|
+
"brand.completed": "brand.completed";
|
|
24
|
+
"brand.updated": "brand.updated";
|
|
25
|
+
"asset.ready": "asset.ready";
|
|
26
|
+
"asset.regenerated": "asset.regenerated";
|
|
27
|
+
"job.failed": "job.failed";
|
|
28
|
+
"credits.low": "credits.low";
|
|
29
|
+
"credits.settled": "credits.settled";
|
|
30
|
+
"subscription.changed": "subscription.changed";
|
|
31
|
+
}>>;
|
|
32
|
+
disabled: z.ZodBoolean;
|
|
33
|
+
created_at: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
secret: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const createWebhookEndpointRequestSchema: z.ZodObject<{
|
|
38
|
+
url: z.ZodString;
|
|
39
|
+
events: z.ZodArray<z.ZodEnum<{
|
|
40
|
+
"brand.completed": "brand.completed";
|
|
41
|
+
"brand.updated": "brand.updated";
|
|
42
|
+
"asset.ready": "asset.ready";
|
|
43
|
+
"asset.regenerated": "asset.regenerated";
|
|
44
|
+
"job.failed": "job.failed";
|
|
45
|
+
"credits.low": "credits.low";
|
|
46
|
+
"credits.settled": "credits.settled";
|
|
47
|
+
"subscription.changed": "subscription.changed";
|
|
48
|
+
}>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const updateWebhookEndpointRequestSchema: z.ZodObject<{
|
|
51
|
+
events: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
52
|
+
"brand.completed": "brand.completed";
|
|
53
|
+
"brand.updated": "brand.updated";
|
|
54
|
+
"asset.ready": "asset.ready";
|
|
55
|
+
"asset.regenerated": "asset.regenerated";
|
|
56
|
+
"job.failed": "job.failed";
|
|
57
|
+
"credits.low": "credits.low";
|
|
58
|
+
"credits.settled": "credits.settled";
|
|
59
|
+
"subscription.changed": "subscription.changed";
|
|
60
|
+
}>>>;
|
|
61
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type WebhookEndpoint = z.infer<typeof webhookEndpointSchema>;
|
|
64
|
+
export type WebhookEndpointCreateResponse = z.infer<typeof webhookEndpointCreateResponseSchema>;
|
|
65
|
+
export type CreateWebhookEndpointRequest = z.infer<typeof createWebhookEndpointRequestSchema>;
|
|
66
|
+
export type UpdateWebhookEndpointRequest = z.infer<typeof updateWebhookEndpointRequestSchema>;
|
|
67
|
+
export declare const stripeWebhookEventSchema: z.ZodObject<{
|
|
68
|
+
id: z.ZodString;
|
|
69
|
+
type: z.ZodString;
|
|
70
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
object: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
72
|
+
}, z.core.$strip>>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
export type StripeWebhookEvent = z.infer<typeof stripeWebhookEventSchema>;
|
package/dist/webhooks.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { webhookEventTypes } from "./events.js";
|
|
3
|
+
export const webhookEndpointSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
url: z.string().url(),
|
|
6
|
+
events: z.array(z.enum(webhookEventTypes)),
|
|
7
|
+
disabled: z.boolean(),
|
|
8
|
+
created_at: z.string().datetime(),
|
|
9
|
+
});
|
|
10
|
+
export const webhookEndpointCreateResponseSchema = z.object({
|
|
11
|
+
endpoint: webhookEndpointSchema,
|
|
12
|
+
secret: z.string(),
|
|
13
|
+
});
|
|
14
|
+
export const createWebhookEndpointRequestSchema = z.object({
|
|
15
|
+
url: z.string().url(),
|
|
16
|
+
events: z.array(z.enum(webhookEventTypes)).nonempty(),
|
|
17
|
+
});
|
|
18
|
+
export const updateWebhookEndpointRequestSchema = z.object({
|
|
19
|
+
events: z.array(z.enum(webhookEventTypes)).nonempty().optional(),
|
|
20
|
+
disabled: z.boolean().optional(),
|
|
21
|
+
});
|
|
22
|
+
export const stripeWebhookEventSchema = z.object({
|
|
23
|
+
id: z.string(),
|
|
24
|
+
type: z.string(),
|
|
25
|
+
data: z.object({ object: z.record(z.string(), z.unknown()) }).optional(),
|
|
26
|
+
});
|