@farcaster/snap 1.3.0 → 1.3.1

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.
@@ -4,7 +4,6 @@ export declare const MEDIA_TYPE: "application/vnd.farcaster.snap+json";
4
4
  export declare const LIMITS: {
5
5
  readonly maxElementsPerPage: 5;
6
6
  readonly maxButtonsPerPage: 4;
7
- readonly maxVideoDurationSeconds: 30;
8
7
  readonly maxTextInputChars: 280;
9
8
  readonly maxListItems: 4;
10
9
  readonly minListItems: 1;
@@ -33,7 +32,6 @@ export declare const TEXT_STYLE: {
33
32
  export declare const TEXT_STYLE_VALUES: readonly ["title", "body", "caption", "label"];
34
33
  export declare const TEXT_ALIGN_VALUES: readonly ["left", "center", "right"];
35
34
  export declare const IMAGE_ASPECT_VALUES: readonly ["1:1", "16:9", "4:3", "3:4", "9:16"];
36
- export declare const VIDEO_ASPECT_VALUES: readonly ["1:1", "16:9", "9:16"];
37
35
  export declare const SPACER_SIZE: {
38
36
  readonly small: "small";
39
37
  readonly medium: "medium";
@@ -103,7 +101,6 @@ export declare const PAGE_ROOT_TYPE: {
103
101
  export declare const ELEMENT_TYPE: {
104
102
  readonly text: "text";
105
103
  readonly image: "image";
106
- readonly video: "video";
107
104
  readonly divider: "divider";
108
105
  readonly spacer: "spacer";
109
106
  readonly progress: "progress";
package/dist/constants.js CHANGED
@@ -4,7 +4,6 @@ export const MEDIA_TYPE = "application/vnd.farcaster.snap+json";
4
4
  export const LIMITS = {
5
5
  maxElementsPerPage: 5,
6
6
  maxButtonsPerPage: 4,
7
- maxVideoDurationSeconds: 30,
8
7
  maxTextInputChars: 280,
9
8
  maxListItems: 4,
10
9
  minListItems: 1,
@@ -44,7 +43,6 @@ export const IMAGE_ASPECT_VALUES = [
44
43
  "3:4",
45
44
  "9:16",
46
45
  ];
47
- export const VIDEO_ASPECT_VALUES = ["1:1", "16:9", "9:16"];
48
46
  export const SPACER_SIZE = {
49
47
  small: "small",
50
48
  medium: "medium",
@@ -162,7 +160,6 @@ export const PAGE_ROOT_TYPE = {
162
160
  export const ELEMENT_TYPE = {
163
161
  text: "text",
164
162
  image: "image",
165
- video: "video",
166
163
  divider: "divider",
167
164
  spacer: "spacer",
168
165
  progress: "progress",
@@ -191,7 +188,6 @@ export const SLIDER_STEP_ALIGN_EPS = 1e-6;
191
188
  export const DEFAULT_SLIDER_STEP = 1;
192
189
  export const MEDIA_ELEMENT_TYPES = [
193
190
  ELEMENT_TYPE.image,
194
- ELEMENT_TYPE.video,
195
191
  ELEMENT_TYPE.grid,
196
192
  ];
197
193
  export const INTERACTIVE_ELEMENT_TYPES = [
package/dist/schemas.d.ts CHANGED
@@ -39,16 +39,6 @@ declare const elementSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
39
39
  "9:16": "9:16";
40
40
  }>;
41
41
  alt: z.ZodOptional<z.ZodString>;
42
- }, z.core.$strip>, z.ZodObject<{
43
- type: z.ZodLiteral<"video">;
44
- url: z.ZodString;
45
- aspect: z.ZodEnum<{
46
- "1:1": "1:1";
47
- "16:9": "16:9";
48
- "9:16": "9:16";
49
- }>;
50
- maxDuration: z.ZodOptional<z.ZodNumber>;
51
- alt: z.ZodOptional<z.ZodString>;
52
42
  }, z.core.$strip>, z.ZodObject<{
53
43
  type: z.ZodLiteral<"divider">;
54
44
  }, z.core.$strip>, z.ZodObject<{
@@ -363,16 +353,6 @@ declare const elementsSchema: z.ZodObject<{
363
353
  "9:16": "9:16";
364
354
  }>;
365
355
  alt: z.ZodOptional<z.ZodString>;
366
- }, z.core.$strip>, z.ZodObject<{
367
- type: z.ZodLiteral<"video">;
368
- url: z.ZodString;
369
- aspect: z.ZodEnum<{
370
- "1:1": "1:1";
371
- "16:9": "16:9";
372
- "9:16": "9:16";
373
- }>;
374
- maxDuration: z.ZodOptional<z.ZodNumber>;
375
- alt: z.ZodOptional<z.ZodString>;
376
356
  }, z.core.$strip>, z.ZodObject<{
377
357
  type: z.ZodLiteral<"divider">;
378
358
  }, z.core.$strip>, z.ZodObject<{
@@ -714,16 +694,6 @@ export declare const rootSchema: z.ZodObject<{
714
694
  "9:16": "9:16";
715
695
  }>;
716
696
  alt: z.ZodOptional<z.ZodString>;
717
- }, z.core.$strip>, z.ZodObject<{
718
- type: z.ZodLiteral<"video">;
719
- url: z.ZodString;
720
- aspect: z.ZodEnum<{
721
- "1:1": "1:1";
722
- "16:9": "16:9";
723
- "9:16": "9:16";
724
- }>;
725
- maxDuration: z.ZodOptional<z.ZodNumber>;
726
- alt: z.ZodOptional<z.ZodString>;
727
697
  }, z.core.$strip>, z.ZodObject<{
728
698
  type: z.ZodLiteral<"divider">;
729
699
  }, z.core.$strip>, z.ZodObject<{
@@ -1078,16 +1048,6 @@ export declare const firstPageRootSchema: z.ZodObject<{
1078
1048
  "9:16": "9:16";
1079
1049
  }>;
1080
1050
  alt: z.ZodOptional<z.ZodString>;
1081
- }, z.core.$strip>, z.ZodObject<{
1082
- type: z.ZodLiteral<"video">;
1083
- url: z.ZodString;
1084
- aspect: z.ZodEnum<{
1085
- "1:1": "1:1";
1086
- "16:9": "16:9";
1087
- "9:16": "9:16";
1088
- }>;
1089
- maxDuration: z.ZodOptional<z.ZodNumber>;
1090
- alt: z.ZodOptional<z.ZodString>;
1091
1051
  }, z.core.$strip>, z.ZodObject<{
1092
1052
  type: z.ZodLiteral<"divider">;
1093
1053
  }, z.core.$strip>, z.ZodObject<{
package/dist/schemas.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod/v4";
2
- import { BAR_CHART_COLOR_VALUES, BUTTON_ACTION, BUTTON_ACTION_VALUES, BUTTON_GROUP_STYLE, BUTTON_GROUP_STYLE_VALUES, BUTTON_LAYOUT_VALUES, BUTTON_STYLE_VALUES, DEFAULT_BUTTON_LAYOUT, DEFAULT_LIST_STYLE, DEFAULT_SLIDER_STEP, DEFAULT_THEME_ACCENT, EFFECT_VALUES, ELEMENT_TYPE, GRID_CELL_SIZE_VALUES, GRID_GAP_VALUES, GROUP_LAYOUT_VALUES, HEX_COLOR_6_RE, HTTP_PREFIX, HTTPS_PREFIX, IMAGE_ASPECT_VALUES, INTERACTIVE_ELEMENT_TYPES, LIMITS, LIST_STYLE_VALUES, MEDIA_ELEMENT_TYPES, PAGE_ROOT_TYPE, PALETTE_COLOR_VALUES, PROGRESS_COLOR_VALUES, SLIDER_STEP_ALIGN_EPS, SPACER_SIZE, SPACER_SIZE_VALUES, SPEC_VERSION, TEXT_ALIGN_VALUES, TEXT_CONTENT_MAX, TEXT_STYLE, TEXT_STYLE_VALUES, VIDEO_ASPECT_VALUES, } from "./constants.js";
2
+ import { BAR_CHART_COLOR_VALUES, BUTTON_ACTION, BUTTON_ACTION_VALUES, BUTTON_GROUP_STYLE, BUTTON_GROUP_STYLE_VALUES, BUTTON_LAYOUT_VALUES, BUTTON_STYLE_VALUES, DEFAULT_BUTTON_LAYOUT, DEFAULT_LIST_STYLE, DEFAULT_SLIDER_STEP, DEFAULT_THEME_ACCENT, EFFECT_VALUES, ELEMENT_TYPE, GRID_CELL_SIZE_VALUES, GRID_GAP_VALUES, GROUP_LAYOUT_VALUES, HEX_COLOR_6_RE, HTTP_PREFIX, HTTPS_PREFIX, IMAGE_ASPECT_VALUES, INTERACTIVE_ELEMENT_TYPES, LIMITS, LIST_STYLE_VALUES, MEDIA_ELEMENT_TYPES, PAGE_ROOT_TYPE, PALETTE_COLOR_VALUES, PROGRESS_COLOR_VALUES, SLIDER_STEP_ALIGN_EPS, SPACER_SIZE, SPACER_SIZE_VALUES, SPEC_VERSION, TEXT_ALIGN_VALUES, TEXT_CONTENT_MAX, TEXT_STYLE, TEXT_STYLE_VALUES, } from "./constants.js";
3
3
  /**
4
4
  * post/link/mini_app targets must be HTTPS in production; allow HTTP only for
5
5
  * loopback hosts so local snap servers (e.g. http://localhost:3014/snap) validate.
@@ -48,11 +48,6 @@ const imageUrlSchema = z
48
48
  .refine((s) => hasAllowedMediaExtension(s, ["jpg", "png", "gif", "webp"]), {
49
49
  message: "image URL must use HTTPS and end with a supported extension (.jpg, .png, .gif, .webp)",
50
50
  });
51
- const videoUrlSchema = z
52
- .string()
53
- .refine((s) => hasAllowedMediaExtension(s, ["mp4", "webm"]), {
54
- message: "video URL must use HTTPS and end with a supported extension (.mp4, .webm)",
55
- });
56
51
  const textAlignSchema = z.enum(TEXT_ALIGN_VALUES);
57
52
  const textElementSchema = z
58
53
  .object({
@@ -77,13 +72,6 @@ const imageElementSchema = z.object({
77
72
  aspect: z.enum(IMAGE_ASPECT_VALUES),
78
73
  alt: z.string().optional(),
79
74
  });
80
- const videoElementSchema = z.object({
81
- type: z.literal(ELEMENT_TYPE.video),
82
- url: videoUrlSchema,
83
- aspect: z.enum(VIDEO_ASPECT_VALUES),
84
- maxDuration: z.number().max(LIMITS.maxVideoDurationSeconds).optional(),
85
- alt: z.string().optional(),
86
- });
87
75
  const dividerElementSchema = z.object({
88
76
  type: z.literal(ELEMENT_TYPE.divider),
89
77
  });
@@ -357,7 +345,6 @@ const groupElementSchema = z.object({
357
345
  const elementSchema = z.discriminatedUnion("type", [
358
346
  textElementSchema,
359
347
  imageElementSchema,
360
- videoElementSchema,
361
348
  dividerElementSchema,
362
349
  spacerElementSchema,
363
350
  progressElementSchema,
@@ -407,7 +394,7 @@ export const rootSchema = z
407
394
  if (mediaCount > 1) {
408
395
  ctx.addIssue({
409
396
  code: "custom",
410
- message: `cannot have more than 1 media element (image, video, or grid)`,
397
+ message: `cannot have more than 1 media element (image or grid)`,
411
398
  path: ["elements", "children"],
412
399
  });
413
400
  }
@@ -431,7 +418,7 @@ export const firstPageRootSchema = rootSchema.superRefine((root, ctx) => {
431
418
  if (!hasInteractive && !hasMedia) {
432
419
  ctx.addIssue({
433
420
  code: "custom",
434
- message: "first page must have at least one interactive element (button_group, slider, text_input, toggle) or media element (image, video, grid)",
421
+ message: "first page must have at least one interactive element (button_group, slider, text_input, toggle) or media element (image, grid)",
435
422
  path: ["page", "elements", "children"],
436
423
  });
437
424
  }
package/dist/validator.js CHANGED
@@ -21,7 +21,6 @@ function estimateElementHeight(el) {
21
21
  return 48;
22
22
  }
23
23
  case ELEMENT_TYPE.image:
24
- case ELEMENT_TYPE.video:
25
24
  return 180;
26
25
  case ELEMENT_TYPE.grid:
27
26
  return 180;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farcaster/snap",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Farcaster Snaps 🫰",
5
5
  "repository": {
6
6
  "type": "git",
package/src/constants.ts CHANGED
@@ -7,7 +7,6 @@ export const MEDIA_TYPE = "application/vnd.farcaster.snap+json" as const;
7
7
  export const LIMITS = {
8
8
  maxElementsPerPage: 5,
9
9
  maxButtonsPerPage: 4,
10
- maxVideoDurationSeconds: 30,
11
10
  maxTextInputChars: 280,
12
11
  maxListItems: 4,
13
12
  minListItems: 1,
@@ -50,7 +49,6 @@ export const IMAGE_ASPECT_VALUES = [
50
49
  "3:4",
51
50
  "9:16",
52
51
  ] as const;
53
- export const VIDEO_ASPECT_VALUES = ["1:1", "16:9", "9:16"] as const;
54
52
 
55
53
  export const SPACER_SIZE = {
56
54
  small: "small",
@@ -192,7 +190,6 @@ export const PAGE_ROOT_TYPE = {
192
190
  export const ELEMENT_TYPE = {
193
191
  text: "text",
194
192
  image: "image",
195
- video: "video",
196
193
  divider: "divider",
197
194
  spacer: "spacer",
198
195
  progress: "progress",
@@ -229,7 +226,6 @@ export const DEFAULT_SLIDER_STEP = 1 as const;
229
226
 
230
227
  export const MEDIA_ELEMENT_TYPES = [
231
228
  ELEMENT_TYPE.image,
232
- ELEMENT_TYPE.video,
233
229
  ELEMENT_TYPE.grid,
234
230
  ] as ElementType[];
235
231
 
package/src/schemas.ts CHANGED
@@ -35,7 +35,6 @@ import {
35
35
  TEXT_CONTENT_MAX,
36
36
  TEXT_STYLE,
37
37
  TEXT_STYLE_VALUES,
38
- VIDEO_ASPECT_VALUES,
39
38
  } from "./constants";
40
39
 
41
40
  /**
@@ -94,13 +93,6 @@ const imageUrlSchema = z
94
93
  "image URL must use HTTPS and end with a supported extension (.jpg, .png, .gif, .webp)",
95
94
  });
96
95
 
97
- const videoUrlSchema = z
98
- .string()
99
- .refine((s) => hasAllowedMediaExtension(s, ["mp4", "webm"]), {
100
- message:
101
- "video URL must use HTTPS and end with a supported extension (.mp4, .webm)",
102
- });
103
-
104
96
  const textAlignSchema = z.enum(TEXT_ALIGN_VALUES);
105
97
 
106
98
  const textElementSchema = z
@@ -128,14 +120,6 @@ const imageElementSchema = z.object({
128
120
  alt: z.string().optional(),
129
121
  });
130
122
 
131
- const videoElementSchema = z.object({
132
- type: z.literal(ELEMENT_TYPE.video),
133
- url: videoUrlSchema,
134
- aspect: z.enum(VIDEO_ASPECT_VALUES),
135
- maxDuration: z.number().max(LIMITS.maxVideoDurationSeconds).optional(),
136
- alt: z.string().optional(),
137
- });
138
-
139
123
  const dividerElementSchema = z.object({
140
124
  type: z.literal(ELEMENT_TYPE.divider),
141
125
  });
@@ -434,7 +418,6 @@ const groupElementSchema = z.object({
434
418
  const elementSchema = z.discriminatedUnion("type", [
435
419
  textElementSchema,
436
420
  imageElementSchema,
437
- videoElementSchema,
438
421
  dividerElementSchema,
439
422
  spacerElementSchema,
440
423
  progressElementSchema,
@@ -490,7 +473,7 @@ export const rootSchema = z
490
473
  if (mediaCount > 1) {
491
474
  ctx.addIssue({
492
475
  code: "custom",
493
- message: `cannot have more than 1 media element (image, video, or grid)`,
476
+ message: `cannot have more than 1 media element (image or grid)`,
494
477
  path: ["elements", "children"],
495
478
  });
496
479
  }
@@ -524,7 +507,7 @@ export const firstPageRootSchema = rootSchema.superRefine((root, ctx) => {
524
507
  ctx.addIssue({
525
508
  code: "custom",
526
509
  message:
527
- "first page must have at least one interactive element (button_group, slider, text_input, toggle) or media element (image, video, grid)",
510
+ "first page must have at least one interactive element (button_group, slider, text_input, toggle) or media element (image, grid)",
528
511
  path: ["page", "elements", "children"],
529
512
  });
530
513
  }
package/src/validator.ts CHANGED
@@ -39,7 +39,6 @@ function estimateElementHeight(el: Element): number {
39
39
  return 48;
40
40
  }
41
41
  case ELEMENT_TYPE.image:
42
- case ELEMENT_TYPE.video:
43
42
  return 180;
44
43
  case ELEMENT_TYPE.grid:
45
44
  return 180;