@cntrl-site/sdk 1.25.0 → 1.25.1-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.
@@ -123,34 +123,67 @@ export declare const ArticleSchema: z.ZodObject<{
123
123
  id: z.ZodString;
124
124
  triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
125
125
  itemId: z.ZodString;
126
- type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
126
+ type: z.ZodLiteral<"item">;
127
+ triggerEvent: z.ZodEnum<["hover-in", "hover-out", "click"]>;
127
128
  from: z.ZodString;
128
129
  to: z.ZodString;
129
130
  }, "strip", z.ZodTypeAny, {
130
- type: "hover-in" | "hover-out" | "click";
131
+ type: "item";
131
132
  from: string;
132
133
  to: string;
133
134
  itemId: string;
135
+ triggerEvent: "hover-in" | "hover-out" | "click";
134
136
  }, {
135
- type: "hover-in" | "hover-out" | "click";
137
+ type: "item";
136
138
  from: string;
137
139
  to: string;
138
140
  itemId: string;
141
+ triggerEvent: "hover-in" | "hover-out" | "click";
139
142
  }>, z.ZodObject<{
143
+ type: z.ZodLiteral<"scroll-position">;
140
144
  position: z.ZodNumber;
141
145
  from: z.ZodString;
142
146
  to: z.ZodString;
143
147
  isReverse: z.ZodBoolean;
144
148
  }, "strip", z.ZodTypeAny, {
145
149
  position: number;
150
+ type: "scroll-position";
146
151
  from: string;
147
152
  to: string;
148
153
  isReverse: boolean;
149
154
  }, {
150
155
  position: number;
156
+ type: "scroll-position";
151
157
  from: string;
152
158
  to: string;
153
159
  isReverse: boolean;
160
+ }>, z.ZodObject<{
161
+ itemId: z.ZodString;
162
+ type: z.ZodLiteral<"item-scroll-position">;
163
+ itemPosition: z.ZodEnum<["bottom", "center", "top"]>;
164
+ screenPosition: z.ZodEnum<["bottom", "center", "top"]>;
165
+ offset: z.ZodNumber;
166
+ from: z.ZodString;
167
+ to: z.ZodString;
168
+ isReverse: z.ZodBoolean;
169
+ }, "strip", z.ZodTypeAny, {
170
+ type: "item-scroll-position";
171
+ from: string;
172
+ to: string;
173
+ itemId: string;
174
+ isReverse: boolean;
175
+ itemPosition: "center" | "top" | "bottom";
176
+ screenPosition: "center" | "top" | "bottom";
177
+ offset: number;
178
+ }, {
179
+ type: "item-scroll-position";
180
+ from: string;
181
+ to: string;
182
+ itemId: string;
183
+ isReverse: boolean;
184
+ itemPosition: "center" | "top" | "bottom";
185
+ screenPosition: "center" | "top" | "bottom";
186
+ offset: number;
154
187
  }>]>, "many">;
155
188
  states: z.ZodArray<z.ZodObject<{
156
189
  id: z.ZodString;
@@ -181,15 +214,26 @@ export declare const ArticleSchema: z.ZodObject<{
181
214
  }, "strip", z.ZodTypeAny, {
182
215
  id: string;
183
216
  triggers: ({
184
- type: "hover-in" | "hover-out" | "click";
217
+ type: "item";
185
218
  from: string;
186
219
  to: string;
187
220
  itemId: string;
221
+ triggerEvent: "hover-in" | "hover-out" | "click";
188
222
  } | {
189
223
  position: number;
224
+ type: "scroll-position";
190
225
  from: string;
191
226
  to: string;
192
227
  isReverse: boolean;
228
+ } | {
229
+ type: "item-scroll-position";
230
+ from: string;
231
+ to: string;
232
+ itemId: string;
233
+ isReverse: boolean;
234
+ itemPosition: "center" | "top" | "bottom";
235
+ screenPosition: "center" | "top" | "bottom";
236
+ offset: number;
193
237
  })[];
194
238
  states: {
195
239
  id: string;
@@ -202,15 +246,26 @@ export declare const ArticleSchema: z.ZodObject<{
202
246
  }, {
203
247
  id: string;
204
248
  triggers: ({
205
- type: "hover-in" | "hover-out" | "click";
249
+ type: "item";
206
250
  from: string;
207
251
  to: string;
208
252
  itemId: string;
253
+ triggerEvent: "hover-in" | "hover-out" | "click";
209
254
  } | {
210
255
  position: number;
256
+ type: "scroll-position";
211
257
  from: string;
212
258
  to: string;
213
259
  isReverse: boolean;
260
+ } | {
261
+ type: "item-scroll-position";
262
+ from: string;
263
+ to: string;
264
+ itemId: string;
265
+ isReverse: boolean;
266
+ itemPosition: "center" | "top" | "bottom";
267
+ screenPosition: "center" | "top" | "bottom";
268
+ offset: number;
214
269
  })[];
215
270
  states: {
216
271
  id: string;
@@ -254,15 +309,26 @@ export declare const ArticleSchema: z.ZodObject<{
254
309
  interactions: Record<string, {
255
310
  id: string;
256
311
  triggers: ({
257
- type: "hover-in" | "hover-out" | "click";
312
+ type: "item";
258
313
  from: string;
259
314
  to: string;
260
315
  itemId: string;
316
+ triggerEvent: "hover-in" | "hover-out" | "click";
261
317
  } | {
262
318
  position: number;
319
+ type: "scroll-position";
263
320
  from: string;
264
321
  to: string;
265
322
  isReverse: boolean;
323
+ } | {
324
+ type: "item-scroll-position";
325
+ from: string;
326
+ to: string;
327
+ itemId: string;
328
+ isReverse: boolean;
329
+ itemPosition: "center" | "top" | "bottom";
330
+ screenPosition: "center" | "top" | "bottom";
331
+ offset: number;
266
332
  })[];
267
333
  states: {
268
334
  id: string;
@@ -306,15 +372,26 @@ export declare const ArticleSchema: z.ZodObject<{
306
372
  interactions: Record<string, {
307
373
  id: string;
308
374
  triggers: ({
309
- type: "hover-in" | "hover-out" | "click";
375
+ type: "item";
310
376
  from: string;
311
377
  to: string;
312
378
  itemId: string;
379
+ triggerEvent: "hover-in" | "hover-out" | "click";
313
380
  } | {
314
381
  position: number;
382
+ type: "scroll-position";
383
+ from: string;
384
+ to: string;
385
+ isReverse: boolean;
386
+ } | {
387
+ type: "item-scroll-position";
315
388
  from: string;
316
389
  to: string;
390
+ itemId: string;
317
391
  isReverse: boolean;
392
+ itemPosition: "center" | "top" | "bottom";
393
+ screenPosition: "center" | "top" | "bottom";
394
+ offset: number;
318
395
  })[];
319
396
  states: {
320
397
  id: string;
@@ -3,34 +3,67 @@ export declare const InteractionSchema: z.ZodObject<{
3
3
  id: z.ZodString;
4
4
  triggers: z.ZodArray<z.ZodUnion<[z.ZodObject<{
5
5
  itemId: z.ZodString;
6
- type: z.ZodEnum<["hover-in", "hover-out", "click"]>;
6
+ type: z.ZodLiteral<"item">;
7
+ triggerEvent: z.ZodEnum<["hover-in", "hover-out", "click"]>;
7
8
  from: z.ZodString;
8
9
  to: z.ZodString;
9
10
  }, "strip", z.ZodTypeAny, {
10
- type: "hover-in" | "hover-out" | "click";
11
+ type: "item";
11
12
  from: string;
12
13
  to: string;
13
14
  itemId: string;
15
+ triggerEvent: "hover-in" | "hover-out" | "click";
14
16
  }, {
15
- type: "hover-in" | "hover-out" | "click";
17
+ type: "item";
16
18
  from: string;
17
19
  to: string;
18
20
  itemId: string;
21
+ triggerEvent: "hover-in" | "hover-out" | "click";
19
22
  }>, z.ZodObject<{
23
+ type: z.ZodLiteral<"scroll-position">;
20
24
  position: z.ZodNumber;
21
25
  from: z.ZodString;
22
26
  to: z.ZodString;
23
27
  isReverse: z.ZodBoolean;
24
28
  }, "strip", z.ZodTypeAny, {
25
29
  position: number;
30
+ type: "scroll-position";
26
31
  from: string;
27
32
  to: string;
28
33
  isReverse: boolean;
29
34
  }, {
30
35
  position: number;
36
+ type: "scroll-position";
31
37
  from: string;
32
38
  to: string;
33
39
  isReverse: boolean;
40
+ }>, z.ZodObject<{
41
+ itemId: z.ZodString;
42
+ type: z.ZodLiteral<"item-scroll-position">;
43
+ itemPosition: z.ZodEnum<["bottom", "center", "top"]>;
44
+ screenPosition: z.ZodEnum<["bottom", "center", "top"]>;
45
+ offset: z.ZodNumber;
46
+ from: z.ZodString;
47
+ to: z.ZodString;
48
+ isReverse: z.ZodBoolean;
49
+ }, "strip", z.ZodTypeAny, {
50
+ type: "item-scroll-position";
51
+ from: string;
52
+ to: string;
53
+ itemId: string;
54
+ isReverse: boolean;
55
+ itemPosition: "center" | "top" | "bottom";
56
+ screenPosition: "center" | "top" | "bottom";
57
+ offset: number;
58
+ }, {
59
+ type: "item-scroll-position";
60
+ from: string;
61
+ to: string;
62
+ itemId: string;
63
+ isReverse: boolean;
64
+ itemPosition: "center" | "top" | "bottom";
65
+ screenPosition: "center" | "top" | "bottom";
66
+ offset: number;
34
67
  }>]>, "many">;
35
68
  states: z.ZodArray<z.ZodObject<{
36
69
  id: z.ZodString;
@@ -61,15 +94,26 @@ export declare const InteractionSchema: z.ZodObject<{
61
94
  }, "strip", z.ZodTypeAny, {
62
95
  id: string;
63
96
  triggers: ({
64
- type: "hover-in" | "hover-out" | "click";
97
+ type: "item";
65
98
  from: string;
66
99
  to: string;
67
100
  itemId: string;
101
+ triggerEvent: "hover-in" | "hover-out" | "click";
68
102
  } | {
69
103
  position: number;
104
+ type: "scroll-position";
105
+ from: string;
106
+ to: string;
107
+ isReverse: boolean;
108
+ } | {
109
+ type: "item-scroll-position";
70
110
  from: string;
71
111
  to: string;
112
+ itemId: string;
72
113
  isReverse: boolean;
114
+ itemPosition: "center" | "top" | "bottom";
115
+ screenPosition: "center" | "top" | "bottom";
116
+ offset: number;
73
117
  })[];
74
118
  states: {
75
119
  id: string;
@@ -82,15 +126,26 @@ export declare const InteractionSchema: z.ZodObject<{
82
126
  }, {
83
127
  id: string;
84
128
  triggers: ({
85
- type: "hover-in" | "hover-out" | "click";
129
+ type: "item";
86
130
  from: string;
87
131
  to: string;
88
132
  itemId: string;
133
+ triggerEvent: "hover-in" | "hover-out" | "click";
89
134
  } | {
90
135
  position: number;
136
+ type: "scroll-position";
137
+ from: string;
138
+ to: string;
139
+ isReverse: boolean;
140
+ } | {
141
+ type: "item-scroll-position";
91
142
  from: string;
92
143
  to: string;
144
+ itemId: string;
93
145
  isReverse: boolean;
146
+ itemPosition: "center" | "top" | "bottom";
147
+ screenPosition: "center" | "top" | "bottom";
148
+ offset: number;
94
149
  })[];
95
150
  states: {
96
151
  id: string;
@@ -4,16 +4,28 @@ exports.InteractionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const ItemTriggerSchema = zod_1.z.object({
6
6
  itemId: zod_1.z.string(),
7
- type: zod_1.z.enum(['hover-in', 'hover-out', 'click']),
7
+ type: zod_1.z.literal('item'),
8
+ triggerEvent: zod_1.z.enum(['hover-in', 'hover-out', 'click']),
8
9
  from: zod_1.z.string(),
9
10
  to: zod_1.z.string()
10
11
  });
11
12
  const ScrollTriggerSchema = zod_1.z.object({
13
+ type: zod_1.z.literal('scroll-position'),
12
14
  position: zod_1.z.number(),
13
15
  from: zod_1.z.string(),
14
16
  to: zod_1.z.string(),
15
17
  isReverse: zod_1.z.boolean()
16
18
  });
19
+ const ItemScrollTriggerSchema = zod_1.z.object({
20
+ itemId: zod_1.z.string(),
21
+ type: zod_1.z.literal('item-scroll-position'),
22
+ itemPosition: zod_1.z.enum(['bottom', 'center', 'top']),
23
+ screenPosition: zod_1.z.enum(['bottom', 'center', 'top']),
24
+ offset: zod_1.z.number(),
25
+ from: zod_1.z.string(),
26
+ to: zod_1.z.string(),
27
+ isReverse: zod_1.z.boolean()
28
+ });
17
29
  const VideoInteractionActionSchema = zod_1.z.object({
18
30
  type: zod_1.z.enum(['play', 'pause']),
19
31
  itemId: zod_1.z.string()
@@ -24,7 +36,7 @@ const StateSchema = zod_1.z.object({
24
36
  });
25
37
  exports.InteractionSchema = zod_1.z.object({
26
38
  id: zod_1.z.string(),
27
- triggers: zod_1.z.array(zod_1.z.union([ItemTriggerSchema, ScrollTriggerSchema])),
39
+ triggers: zod_1.z.array(zod_1.z.union([ItemTriggerSchema, ScrollTriggerSchema, ItemScrollTriggerSchema])),
28
40
  states: zod_1.z.array(StateSchema),
29
41
  startStateId: zod_1.z.string(),
30
42
  });
@@ -1,21 +1,33 @@
1
1
  export interface Interaction {
2
2
  id: string;
3
- triggers: (InteractionItemTrigger | InteractionScrollTrigger)[];
3
+ triggers: InteractionTrigger[];
4
4
  states: InteractionState[];
5
5
  startStateId: string;
6
6
  }
7
7
  export interface InteractionItemTrigger {
8
8
  itemId: string;
9
- type: 'hover-in' | 'hover-out' | 'click';
9
+ type: 'item';
10
+ triggerEvent: 'hover-in' | 'hover-out' | 'click';
10
11
  from: StateId;
11
12
  to: StateId;
12
13
  }
13
14
  export interface InteractionScrollTrigger {
15
+ type: 'scroll-position';
14
16
  position: number;
15
17
  from: StateId;
16
18
  to: StateId;
17
19
  isReverse: boolean;
18
20
  }
21
+ export interface InteractionItemScrollTrigger {
22
+ itemId: string;
23
+ type: 'item-scroll-position';
24
+ itemPosition: 'bottom' | 'center' | 'top';
25
+ screenPosition: 'bottom' | 'center' | 'top';
26
+ offset: number;
27
+ from: StateId;
28
+ to: StateId;
29
+ isReverse: boolean;
30
+ }
19
31
  export type VideoInteractionAction = {
20
32
  type: 'play' | 'pause';
21
33
  itemId: string;
@@ -25,4 +37,5 @@ export interface InteractionState {
25
37
  actions?: VideoInteractionAction[];
26
38
  }
27
39
  type StateId = string;
40
+ export type InteractionTrigger = InteractionItemTrigger | InteractionScrollTrigger | InteractionItemScrollTrigger;
28
41
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk",
3
- "version": "1.25.0",
3
+ "version": "1.25.1-0",
4
4
  "description": "Generic SDK for use in public websites.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",