@anuragpal02/zcl-contracts 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './client.js';
6
6
  export * from './common.js';
7
7
  export * from './collection.js';
8
8
  export * from './credits.js';
9
+ export * from './pricing.js';
9
10
  export * from './frame-iterator.js';
10
11
  export * from './generation.js';
11
12
  export * from './guidelines.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './client.js';
6
6
  export * from './common.js';
7
7
  export * from './collection.js';
8
8
  export * from './credits.js';
9
+ export * from './pricing.js';
9
10
  export * from './frame-iterator.js';
10
11
  export * from './generation.js';
11
12
  export * from './guidelines.js';
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * What the tools cost, served BY the API so a client never has to know.
4
+ *
5
+ * ── Why this exists ──────────────────────────────────────────────────────────
6
+ *
7
+ * The Loop Generator's price lived in three places: `LOOP_TOOL_CREDIT_COST` in
8
+ * zcl-api, a `creditsFor()` helper in the web app's hook, and a third copy as
9
+ * display strings in the markup. Nothing kept them in step, and they drifted — the
10
+ * UI quoted 250 / 1,250 while the API charged 188 / 313. At 4K that is FOUR TIMES
11
+ * the real price, shown to customers deciding whether they could afford it.
12
+ *
13
+ * The Frame Iterator has the identical shape (10 in the UI, 10 in the API) and is
14
+ * currently correct by luck rather than by construction — it drifts the moment
15
+ * either number moves.
16
+ *
17
+ * So the fix is not "correct the numbers", it is "have one number". The API owns
18
+ * the price because the API is what charges it; a client that displays a different
19
+ * figure is by definition wrong.
20
+ *
21
+ * ── Why it is public ─────────────────────────────────────────────────────────
22
+ *
23
+ * Both tools render for signed-out visitors, and they show the price before anyone
24
+ * has an account. A workspace-scoped shape could not serve that, and gating it
25
+ * behind auth would mean the signed-out UI going back to hardcoding — which is the
26
+ * bug this removes.
27
+ *
28
+ * Prices are already public information: they are on the pricing page.
29
+ */
30
+ export declare const loopToolPricingSchema: z.ZodObject<{
31
+ '1080p': z.ZodNumber;
32
+ '4k': z.ZodNumber;
33
+ }, z.core.$strip>;
34
+ export declare const pricingSchema: z.ZodObject<{
35
+ loopTool: z.ZodObject<{
36
+ '1080p': z.ZodNumber;
37
+ '4k': z.ZodNumber;
38
+ }, z.core.$strip>;
39
+ frameIterationCredits: z.ZodNumber;
40
+ imageCredits: z.ZodNumber;
41
+ }, z.core.$strip>;
42
+ export declare const pricingResponseSchema: z.ZodObject<{
43
+ data: z.ZodObject<{
44
+ loopTool: z.ZodObject<{
45
+ '1080p': z.ZodNumber;
46
+ '4k': z.ZodNumber;
47
+ }, z.core.$strip>;
48
+ frameIterationCredits: z.ZodNumber;
49
+ imageCredits: z.ZodNumber;
50
+ }, z.core.$strip>;
51
+ }, z.core.$strip>;
52
+ export type LoopToolPricing = z.infer<typeof loopToolPricingSchema>;
53
+ export type Pricing = z.infer<typeof pricingSchema>;
54
+ export type PricingResponse = z.infer<typeof pricingResponseSchema>;
55
+ //# sourceMappingURL=pricing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../src/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;iBAUxB,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;iBAAkC,CAAA;AAEpE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { apiSuccessSchema } from './common.js';
3
+ /**
4
+ * What the tools cost, served BY the API so a client never has to know.
5
+ *
6
+ * ── Why this exists ──────────────────────────────────────────────────────────
7
+ *
8
+ * The Loop Generator's price lived in three places: `LOOP_TOOL_CREDIT_COST` in
9
+ * zcl-api, a `creditsFor()` helper in the web app's hook, and a third copy as
10
+ * display strings in the markup. Nothing kept them in step, and they drifted — the
11
+ * UI quoted 250 / 1,250 while the API charged 188 / 313. At 4K that is FOUR TIMES
12
+ * the real price, shown to customers deciding whether they could afford it.
13
+ *
14
+ * The Frame Iterator has the identical shape (10 in the UI, 10 in the API) and is
15
+ * currently correct by luck rather than by construction — it drifts the moment
16
+ * either number moves.
17
+ *
18
+ * So the fix is not "correct the numbers", it is "have one number". The API owns
19
+ * the price because the API is what charges it; a client that displays a different
20
+ * figure is by definition wrong.
21
+ *
22
+ * ── Why it is public ─────────────────────────────────────────────────────────
23
+ *
24
+ * Both tools render for signed-out visitors, and they show the price before anyone
25
+ * has an account. A workspace-scoped shape could not serve that, and gating it
26
+ * behind auth would mean the signed-out UI going back to hardcoding — which is the
27
+ * bug this removes.
28
+ *
29
+ * Prices are already public information: they are on the pricing page.
30
+ */
31
+ export const loopToolPricingSchema = z.object({
32
+ '1080p': z.number().int().positive(),
33
+ '4k': z.number().int().positive()
34
+ });
35
+ export const pricingSchema = z.object({
36
+ /** Standalone Loop Generator, keyed by the output resolution the user picks. */
37
+ loopTool: loopToolPricingSchema,
38
+ /** Frame Iterator, charged per variation — the client multiplies by the count. */
39
+ frameIterationCredits: z.number().int().positive(),
40
+ /**
41
+ * A single generated image: one concept variation, one panel, one edit. The wall
42
+ * flows multiply this by their own panel counts, which the client already knows.
43
+ */
44
+ imageCredits: z.number().int().positive()
45
+ });
46
+ export const pricingResponseSchema = apiSuccessSchema(pricingSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anuragpal02/zcl-contracts",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",