@omnichar/contracts 0.0.0-16d2cd3 → 0.0.0-271466a
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/errors.d.ts +3 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +3 -0
- package/dist/errors.js.map +1 -1
- package/dist/v1/builds.d.ts +144 -0
- package/dist/v1/builds.d.ts.map +1 -0
- package/dist/v1/builds.js +80 -0
- package/dist/v1/builds.js.map +1 -0
- package/dist/v1/characters.d.ts +88 -8
- package/dist/v1/characters.d.ts.map +1 -1
- package/dist/v1/characters.js +57 -7
- package/dist/v1/characters.js.map +1 -1
- package/dist/v1/credits.d.ts +13 -1
- package/dist/v1/credits.d.ts.map +1 -1
- package/dist/v1/credits.js +6 -0
- package/dist/v1/credits.js.map +1 -1
- package/dist/v1/datasets.d.ts +64 -0
- package/dist/v1/datasets.d.ts.map +1 -1
- package/dist/v1/datasets.js +36 -0
- package/dist/v1/datasets.js.map +1 -1
- package/dist/v1/guest.d.ts +59 -0
- package/dist/v1/guest.d.ts.map +1 -1
- package/dist/v1/guest.js +25 -3
- package/dist/v1/guest.js.map +1 -1
- package/dist/v1/index.d.ts +6 -0
- package/dist/v1/index.d.ts.map +1 -1
- package/dist/v1/index.js +6 -0
- package/dist/v1/index.js.map +1 -1
- package/dist/v1/mcp.d.ts +109 -0
- package/dist/v1/mcp.d.ts.map +1 -0
- package/dist/v1/mcp.js +128 -0
- package/dist/v1/mcp.js.map +1 -0
- package/dist/v1/me.d.ts +1 -1
- package/dist/v1/planPresets.d.ts +93 -0
- package/dist/v1/planPresets.d.ts.map +1 -0
- package/dist/v1/planPresets.js +80 -0
- package/dist/v1/planPresets.js.map +1 -0
- package/dist/v1/plans.d.ts +2 -2
- package/dist/v1/plans.js +1 -1
- package/dist/v1/runs.d.ts +312 -0
- package/dist/v1/runs.d.ts.map +1 -1
- package/dist/v1/runs.js +72 -0
- package/dist/v1/runs.js.map +1 -1
- package/dist/v1/sessions.d.ts +114 -0
- package/dist/v1/sessions.d.ts.map +1 -1
- package/dist/v1/sessions.js +4 -0
- package/dist/v1/sessions.js.map +1 -1
- package/dist/v1/studio.d.ts +144 -4
- package/dist/v1/studio.d.ts.map +1 -1
- package/dist/v1/studio.js +317 -13
- package/dist/v1/studio.js.map +1 -1
- package/dist/v1/teamKeys.d.ts +144 -0
- package/dist/v1/teamKeys.d.ts.map +1 -0
- package/dist/v1/teamKeys.js +57 -0
- package/dist/v1/teamKeys.js.map +1 -0
- package/dist/v1/teams.d.ts +264 -0
- package/dist/v1/teams.d.ts.map +1 -0
- package/dist/v1/teams.js +108 -0
- package/dist/v1/teams.js.map +1 -0
- package/dist/v1/training.d.ts +256 -0
- package/dist/v1/training.d.ts.map +1 -0
- package/dist/v1/training.js +124 -0
- package/dist/v1/training.js.map +1 -0
- package/dist/v1/videoPricing.d.ts +9 -2
- package/dist/v1/videoPricing.d.ts.map +1 -1
- package/dist/v1/videoPricing.js +18 -8
- package/dist/v1/videoPricing.js.map +1 -1
- package/package.json +1 -1
package/dist/v1/mcp.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { teamEnvSchema } from './teamKeys.js';
|
|
3
|
+
// One public name for the server, so the dashboard, the docs and the OAuth metadata cannot disagree.
|
|
4
|
+
export const MCP_SERVER_URL = 'https://mcp.omnichar.org/mcp';
|
|
5
|
+
export const MCP_DEFAULT_DAILY_LIMIT = 200;
|
|
6
|
+
// Off by default, and enforced by the server: a prompt-injected agent must not be able to delete or sign.
|
|
7
|
+
export const mcpSettingsSchema = z.object({
|
|
8
|
+
dailyCreditLimit: z.number().int().min(0).max(100_000),
|
|
9
|
+
allowDelete: z.boolean(),
|
|
10
|
+
allowLicenseSign: z.boolean(),
|
|
11
|
+
});
|
|
12
|
+
export const mcpSettingsViewSchema = mcpSettingsSchema.extend({
|
|
13
|
+
// Credits charged today through MCP, against dailyCreditLimit.
|
|
14
|
+
spentToday: z.number().int().min(0),
|
|
15
|
+
personal: z.boolean(),
|
|
16
|
+
sandboxAllowed: z.boolean(),
|
|
17
|
+
});
|
|
18
|
+
export const updateMcpSettingsBodySchema = mcpSettingsSchema.partial();
|
|
19
|
+
export const MCP_CLIENT_KINDS = ['oauth', 'key'];
|
|
20
|
+
export const mcpClientSchema = z.object({
|
|
21
|
+
id: z.uuid(),
|
|
22
|
+
kind: z.enum(MCP_CLIENT_KINDS),
|
|
23
|
+
name: z.string(),
|
|
24
|
+
env: teamEnvSchema,
|
|
25
|
+
// Last four characters of a key; null for an OAuth grant.
|
|
26
|
+
hint: z.string().length(4).nullable(),
|
|
27
|
+
createdAt: z.iso.datetime(),
|
|
28
|
+
lastUsedAt: z.iso.datetime().nullable(),
|
|
29
|
+
});
|
|
30
|
+
export const mcpClientListSchema = z.object({ items: z.array(mcpClientSchema) });
|
|
31
|
+
export const createMcpKeyBodySchema = z.object({
|
|
32
|
+
name: z.string().trim().min(1).max(60).default('MCP key'),
|
|
33
|
+
env: teamEnvSchema.default('production'),
|
|
34
|
+
});
|
|
35
|
+
// The only response that carries the secret, which is either an oc_sk_ or an sk_live_/sk_test_ key.
|
|
36
|
+
export const createMcpKeyResponseSchema = z.object({
|
|
37
|
+
client: mcpClientSchema,
|
|
38
|
+
secret: z.string().min(40),
|
|
39
|
+
});
|
|
40
|
+
export const MCP_TOOL_KINDS = ['read', 'upload', 'spend', 'delete', 'team'];
|
|
41
|
+
// The catalogue the dashboard and the docs list; the server registers exactly these names.
|
|
42
|
+
export const MCP_TOOLS = [
|
|
43
|
+
{
|
|
44
|
+
name: 'list_characters',
|
|
45
|
+
kind: 'read',
|
|
46
|
+
group: 'Characters',
|
|
47
|
+
summary: 'Your .char library, and any still building',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'build_character',
|
|
51
|
+
kind: 'spend',
|
|
52
|
+
group: 'Characters',
|
|
53
|
+
summary: 'Build a .char from 1-3 photos and an optional voice clip',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'create_upload',
|
|
57
|
+
kind: 'upload',
|
|
58
|
+
group: 'Characters',
|
|
59
|
+
summary: 'Upload a local photo or voice clip for a build or a pose',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'list_models',
|
|
63
|
+
kind: 'read',
|
|
64
|
+
group: 'Generate',
|
|
65
|
+
summary: 'Image and video models, with sizes and credit price',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'generate_image',
|
|
69
|
+
kind: 'spend',
|
|
70
|
+
group: 'Generate',
|
|
71
|
+
summary: 'Cast one or more characters into an image, posed like a reference',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'generate_video',
|
|
75
|
+
kind: 'spend',
|
|
76
|
+
group: 'Generate',
|
|
77
|
+
summary: 'Image or text to video, with the character’s voice',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'list_runs',
|
|
81
|
+
kind: 'read',
|
|
82
|
+
group: 'Runs and sessions',
|
|
83
|
+
summary: 'Run history, filtered by type, status, character or date',
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'get_run',
|
|
87
|
+
kind: 'read',
|
|
88
|
+
group: 'Runs and sessions',
|
|
89
|
+
summary: 'Status, output links and identity match',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: 'delete_run',
|
|
93
|
+
kind: 'delete',
|
|
94
|
+
group: 'Runs and sessions',
|
|
95
|
+
summary: 'Remove one or more runs from Runs',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'delete_session',
|
|
99
|
+
kind: 'delete',
|
|
100
|
+
group: 'Runs and sessions',
|
|
101
|
+
summary: 'Remove a session and every run in it',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'sign_license',
|
|
105
|
+
kind: 'team',
|
|
106
|
+
group: 'Licenses',
|
|
107
|
+
summary: 'Issue a signed license on a .char: use, territory, term',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'verify_license',
|
|
111
|
+
kind: 'read',
|
|
112
|
+
group: 'Licenses',
|
|
113
|
+
summary: 'Check a license is valid and not revoked',
|
|
114
|
+
},
|
|
115
|
+
{ name: 'get_credits', kind: 'read', group: 'Account', summary: 'Balance and today’s spend' },
|
|
116
|
+
];
|
|
117
|
+
// Sent by the consent page before it approves: binds an OAuth client to the workspace picked there.
|
|
118
|
+
export const bindMcpGrantBodySchema = z.object({
|
|
119
|
+
oauthClientId: z.string().trim().min(1).max(200),
|
|
120
|
+
clientName: z.string().trim().min(1).max(120),
|
|
121
|
+
});
|
|
122
|
+
// For an OAuth grant the dashboard also revokes Supabase's consent, so the next sign-in binds a workspace again.
|
|
123
|
+
export const revokeMcpClientResponseSchema = z.object({
|
|
124
|
+
oauthClientId: z.string().nullable(),
|
|
125
|
+
});
|
|
126
|
+
// The one-time "MCP is live" popup: shown once per person, recorded server-side so it stays gone on every device.
|
|
127
|
+
export const mcpAnnouncementSchema = z.object({ show: z.boolean() });
|
|
128
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/v1/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C,qGAAqG;AACrG,MAAM,CAAC,MAAM,cAAc,GAAG,8BAA8B,CAAA;AAE5D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAE1C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;IACtD,WAAW,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QAAQ,EAAE;CACrC,CAAC,CAAA;AAGF,kHAAkH;AAClH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA"}
|
package/dist/v1/me.d.ts
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
export declare const GIB: number;
|
|
2
|
+
export type PlanPreset = {
|
|
3
|
+
name: string;
|
|
4
|
+
priceUsd: number | null;
|
|
5
|
+
workspace: 'personal' | 'team' | 'any';
|
|
6
|
+
includedSeats: number;
|
|
7
|
+
extraSeatUsd: number | null;
|
|
8
|
+
extraSeatInr: number | null;
|
|
9
|
+
maxSeats: number | null;
|
|
10
|
+
monthlyCredits: number;
|
|
11
|
+
storageBytes: number;
|
|
12
|
+
flags: {
|
|
13
|
+
api_access?: true;
|
|
14
|
+
sandbox?: true;
|
|
15
|
+
};
|
|
16
|
+
selfServe: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const PLAN_PRESETS: {
|
|
19
|
+
readonly free: {
|
|
20
|
+
readonly name: "Flex";
|
|
21
|
+
readonly priceUsd: null;
|
|
22
|
+
readonly workspace: "any";
|
|
23
|
+
readonly includedSeats: 5;
|
|
24
|
+
readonly extraSeatUsd: null;
|
|
25
|
+
readonly extraSeatInr: null;
|
|
26
|
+
readonly maxSeats: null;
|
|
27
|
+
readonly monthlyCredits: 0;
|
|
28
|
+
readonly storageBytes: number;
|
|
29
|
+
readonly flags: {};
|
|
30
|
+
readonly selfServe: false;
|
|
31
|
+
};
|
|
32
|
+
readonly starter: {
|
|
33
|
+
readonly name: "Starter";
|
|
34
|
+
readonly priceUsd: 12;
|
|
35
|
+
readonly workspace: "personal";
|
|
36
|
+
readonly includedSeats: 1;
|
|
37
|
+
readonly extraSeatUsd: null;
|
|
38
|
+
readonly extraSeatInr: null;
|
|
39
|
+
readonly maxSeats: 1;
|
|
40
|
+
readonly monthlyCredits: 1500;
|
|
41
|
+
readonly storageBytes: number;
|
|
42
|
+
readonly flags: {};
|
|
43
|
+
readonly selfServe: true;
|
|
44
|
+
};
|
|
45
|
+
readonly team: {
|
|
46
|
+
readonly name: "Team";
|
|
47
|
+
readonly priceUsd: 39;
|
|
48
|
+
readonly workspace: "team";
|
|
49
|
+
readonly includedSeats: 5;
|
|
50
|
+
readonly extraSeatUsd: 7;
|
|
51
|
+
readonly extraSeatInr: 658;
|
|
52
|
+
readonly maxSeats: 25;
|
|
53
|
+
readonly monthlyCredits: 5200;
|
|
54
|
+
readonly storageBytes: number;
|
|
55
|
+
readonly flags: {
|
|
56
|
+
readonly api_access: true;
|
|
57
|
+
readonly sandbox: true;
|
|
58
|
+
};
|
|
59
|
+
readonly selfServe: true;
|
|
60
|
+
};
|
|
61
|
+
readonly partner: {
|
|
62
|
+
readonly name: "Partner";
|
|
63
|
+
readonly priceUsd: null;
|
|
64
|
+
readonly workspace: "team";
|
|
65
|
+
readonly includedSeats: 25;
|
|
66
|
+
readonly extraSeatUsd: null;
|
|
67
|
+
readonly extraSeatInr: null;
|
|
68
|
+
readonly maxSeats: null;
|
|
69
|
+
readonly monthlyCredits: 0;
|
|
70
|
+
readonly storageBytes: number;
|
|
71
|
+
readonly flags: {
|
|
72
|
+
readonly api_access: true;
|
|
73
|
+
readonly sandbox: true;
|
|
74
|
+
};
|
|
75
|
+
readonly selfServe: false;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type PresetPlan = keyof typeof PLAN_PRESETS;
|
|
79
|
+
export declare const SELF_SERVE_PLANS: readonly ["starter", "team"];
|
|
80
|
+
export type SelfServePlan = (typeof SELF_SERVE_PLANS)[number];
|
|
81
|
+
export declare const TOPUP_USD_PER_CREDIT = 0.01;
|
|
82
|
+
/** Dollars per monthly credit, or null for a plan without a self-serve price. */
|
|
83
|
+
export declare const usdPerCredit: (plan: PresetPlan, bonus?: number) => number | null;
|
|
84
|
+
/** Whole-percent saving against top-ups, e.g. 20 for Starter. */
|
|
85
|
+
export declare const savingVsTopUp: (plan: PresetPlan) => number | null;
|
|
86
|
+
export declare const WELCOME_OFFER: {
|
|
87
|
+
readonly bonusCredits: 500;
|
|
88
|
+
readonly hours: 24;
|
|
89
|
+
};
|
|
90
|
+
export declare const LOW_BALANCE_CREDITS = 100;
|
|
91
|
+
export declare const RECENT_CANCEL_DAYS = 30;
|
|
92
|
+
export declare const HALTED_GRACE_DAYS = 7;
|
|
93
|
+
//# sourceMappingURL=planPresets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planPresets.d.ts","sourceRoot":"","sources":["../../src/v1/planPresets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,GAAG,QAAqB,CAAA;AAErC,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAEvB,SAAS,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAA;IACtC,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IAEpB,KAAK,EAAE;QAAE,UAAU,CAAC,EAAE,IAAI,CAAC;QAAC,OAAO,CAAC,EAAE,IAAI,CAAA;KAAE,CAAA;IAE5C,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDsB,CAAA;AAE/C,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,YAAY,CAAA;AAClD,eAAO,MAAM,gBAAgB,8BAA+B,CAAA;AAC5D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAI7D,eAAO,MAAM,oBAAoB,OAAO,CAAA;AAExC,iFAAiF;AACjF,eAAO,MAAM,YAAY,GAAI,MAAM,UAAU,EAAE,cAAS,KAAG,MAAM,GAAG,IAInE,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,aAAa,GAAI,MAAM,UAAU,KAAG,MAAM,GAAG,IAGzD,CAAA;AAED,eAAO,MAAM,aAAa;;;CAA4C,CAAA;AAEtE,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC,eAAO,MAAM,iBAAiB,IAAI,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// What each workspace plan includes. Prices, credits, storage and seats are read from here, never retyped.
|
|
2
|
+
export const GIB = 1024 * 1024 * 1024;
|
|
3
|
+
export const PLAN_PRESETS = {
|
|
4
|
+
free: {
|
|
5
|
+
name: 'Flex',
|
|
6
|
+
priceUsd: null,
|
|
7
|
+
workspace: 'any',
|
|
8
|
+
includedSeats: 5,
|
|
9
|
+
extraSeatUsd: null,
|
|
10
|
+
extraSeatInr: null,
|
|
11
|
+
maxSeats: null,
|
|
12
|
+
monthlyCredits: 0,
|
|
13
|
+
storageBytes: 5 * GIB,
|
|
14
|
+
flags: {},
|
|
15
|
+
selfServe: false,
|
|
16
|
+
},
|
|
17
|
+
starter: {
|
|
18
|
+
name: 'Starter',
|
|
19
|
+
priceUsd: 12,
|
|
20
|
+
workspace: 'personal',
|
|
21
|
+
includedSeats: 1,
|
|
22
|
+
extraSeatUsd: null,
|
|
23
|
+
extraSeatInr: null,
|
|
24
|
+
maxSeats: 1,
|
|
25
|
+
monthlyCredits: 1_500,
|
|
26
|
+
storageBytes: 20 * GIB,
|
|
27
|
+
flags: {},
|
|
28
|
+
selfServe: true,
|
|
29
|
+
},
|
|
30
|
+
team: {
|
|
31
|
+
name: 'Team',
|
|
32
|
+
priceUsd: 39,
|
|
33
|
+
workspace: 'team',
|
|
34
|
+
includedSeats: 5,
|
|
35
|
+
extraSeatUsd: 7,
|
|
36
|
+
extraSeatInr: 658,
|
|
37
|
+
maxSeats: 25,
|
|
38
|
+
monthlyCredits: 5_200,
|
|
39
|
+
storageBytes: 50 * GIB,
|
|
40
|
+
flags: { api_access: true, sandbox: true },
|
|
41
|
+
selfServe: true,
|
|
42
|
+
},
|
|
43
|
+
partner: {
|
|
44
|
+
name: 'Partner',
|
|
45
|
+
priceUsd: null,
|
|
46
|
+
workspace: 'team',
|
|
47
|
+
includedSeats: 25,
|
|
48
|
+
extraSeatUsd: null,
|
|
49
|
+
extraSeatInr: null,
|
|
50
|
+
maxSeats: null,
|
|
51
|
+
monthlyCredits: 0,
|
|
52
|
+
storageBytes: 100 * GIB,
|
|
53
|
+
flags: { api_access: true, sandbox: true },
|
|
54
|
+
selfServe: false,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
export const SELF_SERVE_PLANS = ['starter', 'team'];
|
|
58
|
+
// The welcome offer shown once, after a person's first generation.
|
|
59
|
+
// Top-ups cost a cent a credit on every plan; a plan's monthly credits come cheaper.
|
|
60
|
+
export const TOPUP_USD_PER_CREDIT = 0.01;
|
|
61
|
+
/** Dollars per monthly credit, or null for a plan without a self-serve price. */
|
|
62
|
+
export const usdPerCredit = (plan, bonus = 0) => {
|
|
63
|
+
const preset = PLAN_PRESETS[plan];
|
|
64
|
+
if (preset.priceUsd === null || preset.monthlyCredits === 0)
|
|
65
|
+
return null;
|
|
66
|
+
return preset.priceUsd / (preset.monthlyCredits + bonus);
|
|
67
|
+
};
|
|
68
|
+
/** Whole-percent saving against top-ups, e.g. 20 for Starter. */
|
|
69
|
+
export const savingVsTopUp = (plan) => {
|
|
70
|
+
const rate = usdPerCredit(plan);
|
|
71
|
+
return rate === null ? null : Math.round((1 - rate / TOPUP_USD_PER_CREDIT) * 100);
|
|
72
|
+
};
|
|
73
|
+
export const WELCOME_OFFER = { bonusCredits: 500, hours: 24 };
|
|
74
|
+
// A Flex personal workspace below this sees the low-balance banner once.
|
|
75
|
+
export const LOW_BALANCE_CREDITS = 100;
|
|
76
|
+
// A cancelled subscription within this many days means no welcome popup.
|
|
77
|
+
export const RECENT_CANCEL_DAYS = 30;
|
|
78
|
+
// Days a halted subscription keeps its plan before the workspace moves to Flex.
|
|
79
|
+
export const HALTED_GRACE_DAYS = 7;
|
|
80
|
+
//# sourceMappingURL=planPresets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planPresets.js","sourceRoot":"","sources":["../../src/v1/planPresets.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,MAAM,CAAC,MAAM,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAqBrC,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,SAAS,EAAE,KAAK;QAChB,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,CAAC,GAAG,GAAG;QACrB,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,KAAK;KACjB;IACD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,UAAU;QACrB,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,IAAI;QAClB,YAAY,EAAE,IAAI;QAClB,QAAQ,EAAE,CAAC;QACX,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,EAAE,GAAG,GAAG;QACtB,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,IAAI;KAChB;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,MAAM;QACjB,aAAa,EAAE,CAAC;QAChB,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AC,CAAA;IAC/B,OAAO,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,oBAAoB,CAAC,GAAG,GAAG,CAAC,CAAA;AACnF,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAW,CAAA;AACtE,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AACtC,yEAAyE;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AACpC,gFAAgF;AAChF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAA"}
|
package/dist/v1/plans.d.ts
CHANGED
|
@@ -13,14 +13,14 @@ export declare const planSchema: z.ZodObject<{
|
|
|
13
13
|
}, z.core.$strip>;
|
|
14
14
|
export declare const FREE_PLAN: {
|
|
15
15
|
readonly id: "free";
|
|
16
|
-
readonly name: "
|
|
16
|
+
readonly name: "Flex";
|
|
17
17
|
readonly storageBytes: number;
|
|
18
18
|
readonly unlimitedCredits: true;
|
|
19
19
|
};
|
|
20
20
|
export declare const PLANS: {
|
|
21
21
|
readonly free: {
|
|
22
22
|
readonly id: "free";
|
|
23
|
-
readonly name: "
|
|
23
|
+
readonly name: "Flex";
|
|
24
24
|
readonly storageBytes: number;
|
|
25
25
|
readonly unlimitedCredits: true;
|
|
26
26
|
};
|