@cntrl-site/sdk 1.22.16 → 1.22.18-alpha.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.js CHANGED
@@ -521,6 +521,23 @@ const SectionHeightSchema = zod.z.object({
521
521
  units: zod.z.number().nonnegative(),
522
522
  vhUnits: zod.z.number().nonnegative().optional()
523
523
  });
524
+ const SectionVideoSchema = zod.z.object({
525
+ url: zod.z.string(),
526
+ size: zod.z.string(),
527
+ type: zod.z.literal("video"),
528
+ play: zod.z.enum(["on-click", "auto"]),
529
+ coverUrl: zod.z.string().nullable(),
530
+ position: zod.z.string(),
531
+ offsetX: zod.z.number().nullable()
532
+ });
533
+ const SectionImageSchema = zod.z.object({
534
+ url: zod.z.string(),
535
+ type: zod.z.literal("image"),
536
+ size: zod.z.string(),
537
+ position: zod.z.string(),
538
+ offsetX: zod.z.number().nullable()
539
+ });
540
+ const SectionMediaSchema = zod.z.discriminatedUnion("type", [SectionVideoSchema, SectionImageSchema]);
524
541
  const SectionSchema = zod.z.object({
525
542
  id: zod.z.string().min(1),
526
543
  items: zod.z.array(ItemSchema),
@@ -529,12 +546,7 @@ const SectionSchema = zod.z.object({
529
546
  position: zod.z.record(zod.z.number()),
530
547
  hidden: zod.z.record(zod.z.boolean()),
531
548
  color: zod.z.record(zod.z.nullable(zod.z.string())),
532
- media: zod.z.record(zod.z.object({
533
- url: zod.z.string(),
534
- size: zod.z.string(),
535
- position: zod.z.string(),
536
- offsetX: zod.z.number().nullable()
537
- })).optional()
549
+ media: zod.z.record(SectionMediaSchema).optional()
538
550
  });
539
551
  const TriggerSchema = zod.z.object({
540
552
  itemId: zod.z.string(),
package/dist/index.mjs CHANGED
@@ -502,6 +502,23 @@ const SectionHeightSchema = z.object({
502
502
  units: z.number().nonnegative(),
503
503
  vhUnits: z.number().nonnegative().optional()
504
504
  });
505
+ const SectionVideoSchema = z.object({
506
+ url: z.string(),
507
+ size: z.string(),
508
+ type: z.literal("video"),
509
+ play: z.enum(["on-click", "auto"]),
510
+ coverUrl: z.string().nullable(),
511
+ position: z.string(),
512
+ offsetX: z.number().nullable()
513
+ });
514
+ const SectionImageSchema = z.object({
515
+ url: z.string(),
516
+ type: z.literal("image"),
517
+ size: z.string(),
518
+ position: z.string(),
519
+ offsetX: z.number().nullable()
520
+ });
521
+ const SectionMediaSchema = z.discriminatedUnion("type", [SectionVideoSchema, SectionImageSchema]);
505
522
  const SectionSchema = z.object({
506
523
  id: z.string().min(1),
507
524
  items: z.array(ItemSchema),
@@ -510,12 +527,7 @@ const SectionSchema = z.object({
510
527
  position: z.record(z.number()),
511
528
  hidden: z.record(z.boolean()),
512
529
  color: z.record(z.nullable(z.string())),
513
- media: z.record(z.object({
514
- url: z.string(),
515
- size: z.string(),
516
- position: z.string(),
517
- offsetX: z.number().nullable()
518
- })).optional()
530
+ media: z.record(SectionMediaSchema).optional()
519
531
  });
520
532
  const TriggerSchema = z.object({
521
533
  itemId: z.string(),
@@ -21,22 +21,49 @@ export declare const ArticleSchema: z.ZodObject<{
21
21
  position: z.ZodRecord<z.ZodString, z.ZodNumber>;
22
22
  hidden: z.ZodRecord<z.ZodString, z.ZodBoolean>;
23
23
  color: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
24
- media: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
24
+ media: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
25
25
  url: z.ZodString;
26
26
  size: z.ZodString;
27
+ type: z.ZodLiteral<"video">;
28
+ play: z.ZodEnum<["on-click", "auto"]>;
29
+ coverUrl: z.ZodNullable<z.ZodString>;
27
30
  position: z.ZodString;
28
31
  offsetX: z.ZodNullable<z.ZodNumber>;
29
32
  }, "strip", z.ZodTypeAny, {
30
33
  url: string;
34
+ play: "on-click" | "auto";
35
+ coverUrl: string | null;
31
36
  position: string;
37
+ type: "video";
32
38
  size: string;
33
39
  offsetX: number | null;
34
40
  }, {
35
41
  url: string;
42
+ play: "on-click" | "auto";
43
+ coverUrl: string | null;
36
44
  position: string;
45
+ type: "video";
37
46
  size: string;
38
47
  offsetX: number | null;
39
- }>>>;
48
+ }>, z.ZodObject<{
49
+ url: z.ZodString;
50
+ type: z.ZodLiteral<"image">;
51
+ size: z.ZodString;
52
+ position: z.ZodString;
53
+ offsetX: z.ZodNullable<z.ZodNumber>;
54
+ }, "strip", z.ZodTypeAny, {
55
+ url: string;
56
+ position: string;
57
+ type: "image";
58
+ size: string;
59
+ offsetX: number | null;
60
+ }, {
61
+ url: string;
62
+ position: string;
63
+ type: "image";
64
+ size: string;
65
+ offsetX: number | null;
66
+ }>]>>>;
40
67
  }, "strip", z.ZodTypeAny, {
41
68
  color: Record<string, string | null>;
42
69
  hidden: Record<string, boolean>;
@@ -50,8 +77,17 @@ export declare const ArticleSchema: z.ZodObject<{
50
77
  items: import('../..').ItemAny[];
51
78
  name?: string | undefined;
52
79
  media?: Record<string, {
80
+ url: string;
81
+ play: "on-click" | "auto";
82
+ coverUrl: string | null;
83
+ position: string;
84
+ type: "video";
85
+ size: string;
86
+ offsetX: number | null;
87
+ } | {
53
88
  url: string;
54
89
  position: string;
90
+ type: "image";
55
91
  size: string;
56
92
  offsetX: number | null;
57
93
  }> | undefined;
@@ -68,8 +104,17 @@ export declare const ArticleSchema: z.ZodObject<{
68
104
  items: import('../..').ItemAny[];
69
105
  name?: string | undefined;
70
106
  media?: Record<string, {
107
+ url: string;
108
+ play: "on-click" | "auto";
109
+ coverUrl: string | null;
110
+ position: string;
111
+ type: "video";
112
+ size: string;
113
+ offsetX: number | null;
114
+ } | {
71
115
  url: string;
72
116
  position: string;
117
+ type: "image";
73
118
  size: string;
74
119
  offsetX: number | null;
75
120
  }> | undefined;
@@ -167,7 +212,16 @@ export declare const ArticleSchema: z.ZodObject<{
167
212
  name?: string | undefined;
168
213
  media?: Record<string, {
169
214
  url: string;
215
+ play: "on-click" | "auto";
216
+ coverUrl: string | null;
170
217
  position: string;
218
+ type: "video";
219
+ size: string;
220
+ offsetX: number | null;
221
+ } | {
222
+ url: string;
223
+ position: string;
224
+ type: "image";
171
225
  size: string;
172
226
  offsetX: number | null;
173
227
  }> | undefined;
@@ -204,8 +258,17 @@ export declare const ArticleSchema: z.ZodObject<{
204
258
  items: import('../..').ItemAny[];
205
259
  name?: string | undefined;
206
260
  media?: Record<string, {
261
+ url: string;
262
+ play: "on-click" | "auto";
263
+ coverUrl: string | null;
264
+ position: string;
265
+ type: "video";
266
+ size: string;
267
+ offsetX: number | null;
268
+ } | {
207
269
  url: string;
208
270
  position: string;
271
+ type: "image";
209
272
  size: string;
210
273
  offsetX: number | null;
211
274
  }> | undefined;
@@ -13,6 +13,49 @@ export declare const SectionHeightSchema: z.ZodObject<{
13
13
  units: number;
14
14
  vhUnits?: number | undefined;
15
15
  }>;
16
+ export declare const SectionMediaSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
17
+ url: z.ZodString;
18
+ size: z.ZodString;
19
+ type: z.ZodLiteral<"video">;
20
+ play: z.ZodEnum<["on-click", "auto"]>;
21
+ coverUrl: z.ZodNullable<z.ZodString>;
22
+ position: z.ZodString;
23
+ offsetX: z.ZodNullable<z.ZodNumber>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ url: string;
26
+ play: "on-click" | "auto";
27
+ coverUrl: string | null;
28
+ position: string;
29
+ type: "video";
30
+ size: string;
31
+ offsetX: number | null;
32
+ }, {
33
+ url: string;
34
+ play: "on-click" | "auto";
35
+ coverUrl: string | null;
36
+ position: string;
37
+ type: "video";
38
+ size: string;
39
+ offsetX: number | null;
40
+ }>, z.ZodObject<{
41
+ url: z.ZodString;
42
+ type: z.ZodLiteral<"image">;
43
+ size: z.ZodString;
44
+ position: z.ZodString;
45
+ offsetX: z.ZodNullable<z.ZodNumber>;
46
+ }, "strip", z.ZodTypeAny, {
47
+ url: string;
48
+ position: string;
49
+ type: "image";
50
+ size: string;
51
+ offsetX: number | null;
52
+ }, {
53
+ url: string;
54
+ position: string;
55
+ type: "image";
56
+ size: string;
57
+ offsetX: number | null;
58
+ }>]>;
16
59
  export declare const SectionSchema: z.ZodObject<{
17
60
  id: z.ZodString;
18
61
  items: z.ZodArray<z.ZodType<import('../..').ItemAny, z.ZodTypeDef, import('../..').ItemAny>, "many">;
@@ -33,22 +76,49 @@ export declare const SectionSchema: z.ZodObject<{
33
76
  position: z.ZodRecord<z.ZodString, z.ZodNumber>;
34
77
  hidden: z.ZodRecord<z.ZodString, z.ZodBoolean>;
35
78
  color: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
36
- media: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
79
+ media: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
80
+ url: z.ZodString;
81
+ size: z.ZodString;
82
+ type: z.ZodLiteral<"video">;
83
+ play: z.ZodEnum<["on-click", "auto"]>;
84
+ coverUrl: z.ZodNullable<z.ZodString>;
85
+ position: z.ZodString;
86
+ offsetX: z.ZodNullable<z.ZodNumber>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ url: string;
89
+ play: "on-click" | "auto";
90
+ coverUrl: string | null;
91
+ position: string;
92
+ type: "video";
93
+ size: string;
94
+ offsetX: number | null;
95
+ }, {
96
+ url: string;
97
+ play: "on-click" | "auto";
98
+ coverUrl: string | null;
99
+ position: string;
100
+ type: "video";
101
+ size: string;
102
+ offsetX: number | null;
103
+ }>, z.ZodObject<{
37
104
  url: z.ZodString;
105
+ type: z.ZodLiteral<"image">;
38
106
  size: z.ZodString;
39
107
  position: z.ZodString;
40
108
  offsetX: z.ZodNullable<z.ZodNumber>;
41
109
  }, "strip", z.ZodTypeAny, {
42
110
  url: string;
43
111
  position: string;
112
+ type: "image";
44
113
  size: string;
45
114
  offsetX: number | null;
46
115
  }, {
47
116
  url: string;
48
117
  position: string;
118
+ type: "image";
49
119
  size: string;
50
120
  offsetX: number | null;
51
- }>>>;
121
+ }>]>>>;
52
122
  }, "strip", z.ZodTypeAny, {
53
123
  color: Record<string, string | null>;
54
124
  hidden: Record<string, boolean>;
@@ -63,7 +133,16 @@ export declare const SectionSchema: z.ZodObject<{
63
133
  name?: string | undefined;
64
134
  media?: Record<string, {
65
135
  url: string;
136
+ play: "on-click" | "auto";
137
+ coverUrl: string | null;
66
138
  position: string;
139
+ type: "video";
140
+ size: string;
141
+ offsetX: number | null;
142
+ } | {
143
+ url: string;
144
+ position: string;
145
+ type: "image";
67
146
  size: string;
68
147
  offsetX: number | null;
69
148
  }> | undefined;
@@ -80,8 +159,17 @@ export declare const SectionSchema: z.ZodObject<{
80
159
  items: import('../..').ItemAny[];
81
160
  name?: string | undefined;
82
161
  media?: Record<string, {
162
+ url: string;
163
+ play: "on-click" | "auto";
164
+ coverUrl: string | null;
165
+ position: string;
166
+ type: "video";
167
+ size: string;
168
+ offsetX: number | null;
169
+ } | {
83
170
  url: string;
84
171
  position: string;
172
+ type: "image";
85
173
  size: string;
86
174
  offsetX: number | null;
87
175
  }> | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SectionSchema = exports.SectionHeightSchema = void 0;
3
+ exports.SectionSchema = exports.SectionMediaSchema = exports.SectionHeightSchema = void 0;
4
4
  const Section_1 = require("../../types/article/Section");
5
5
  const zod_1 = require("zod");
6
6
  const Item_schema_1 = require("./Item.schema");
@@ -9,6 +9,23 @@ exports.SectionHeightSchema = zod_1.z.object({
9
9
  units: zod_1.z.number().nonnegative(),
10
10
  vhUnits: zod_1.z.number().nonnegative().optional()
11
11
  });
12
+ const SectionVideoSchema = zod_1.z.object({
13
+ url: zod_1.z.string(),
14
+ size: zod_1.z.string(),
15
+ type: zod_1.z.literal('video'),
16
+ play: zod_1.z.enum(['on-click', 'auto']),
17
+ coverUrl: zod_1.z.string().nullable(),
18
+ position: zod_1.z.string(),
19
+ offsetX: zod_1.z.number().nullable()
20
+ });
21
+ const SectionImageSchema = zod_1.z.object({
22
+ url: zod_1.z.string(),
23
+ type: zod_1.z.literal('image'),
24
+ size: zod_1.z.string(),
25
+ position: zod_1.z.string(),
26
+ offsetX: zod_1.z.number().nullable()
27
+ });
28
+ exports.SectionMediaSchema = zod_1.z.discriminatedUnion('type', [SectionVideoSchema, SectionImageSchema]);
12
29
  exports.SectionSchema = zod_1.z.object({
13
30
  id: zod_1.z.string().min(1),
14
31
  items: zod_1.z.array(Item_schema_1.ItemSchema),
@@ -17,10 +34,5 @@ exports.SectionSchema = zod_1.z.object({
17
34
  position: zod_1.z.record(zod_1.z.number()),
18
35
  hidden: zod_1.z.record(zod_1.z.boolean()),
19
36
  color: zod_1.z.record(zod_1.z.nullable(zod_1.z.string())),
20
- media: zod_1.z.record((zod_1.z.object({
21
- url: zod_1.z.string(),
22
- size: zod_1.z.string(),
23
- position: zod_1.z.string(),
24
- offsetX: zod_1.z.number().nullable(),
25
- }))).optional()
37
+ media: zod_1.z.record(exports.SectionMediaSchema).optional()
26
38
  });
@@ -8,6 +8,23 @@ export interface SectionHeight {
8
8
  units: number;
9
9
  vhUnits?: number;
10
10
  }
11
+ export type SectionVideo = {
12
+ url: string;
13
+ size: string;
14
+ type: 'video';
15
+ play: 'on-click' | 'auto';
16
+ position: string;
17
+ coverUrl: string | null;
18
+ offsetX: number | null;
19
+ };
20
+ export type SectionImage = {
21
+ url: string;
22
+ type: 'image';
23
+ size: string;
24
+ position: string;
25
+ offsetX: number | null;
26
+ };
27
+ export type SectionMedia = SectionVideo | SectionImage;
11
28
  export interface Section {
12
29
  id: string;
13
30
  name?: string;
@@ -16,10 +33,5 @@ export interface Section {
16
33
  items: ItemAny[];
17
34
  position: Record<string, number>;
18
35
  color: Record<string, string | null>;
19
- media?: Record<string, {
20
- url: string;
21
- size: string;
22
- position: string;
23
- offsetX: number | null;
24
- }>;
36
+ media?: Record<string, SectionMedia>;
25
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.22.16",
3
+ "version": "1.22.18-alpha.0",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",