@guided-tour-s4marth/core 0.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.
@@ -0,0 +1,525 @@
1
+ import { z } from 'zod';
2
+ export declare const Condition: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
3
+ kind: z.ZodLiteral<"route">;
4
+ match: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ kind: "route";
7
+ match: string;
8
+ }, {
9
+ kind: "route";
10
+ match: string;
11
+ }>, z.ZodObject<{
12
+ kind: z.ZodLiteral<"role">;
13
+ in: z.ZodArray<z.ZodString, "many">;
14
+ }, "strip", z.ZodTypeAny, {
15
+ kind: "role";
16
+ in: string[];
17
+ }, {
18
+ kind: "role";
19
+ in: string[];
20
+ }>, z.ZodObject<{
21
+ kind: z.ZodLiteral<"version">;
22
+ range: z.ZodString;
23
+ }, "strip", z.ZodTypeAny, {
24
+ kind: "version";
25
+ range: string;
26
+ }, {
27
+ kind: "version";
28
+ range: string;
29
+ }>, z.ZodObject<{
30
+ kind: z.ZodLiteral<"flag">;
31
+ key: z.ZodString;
32
+ on: z.ZodBoolean;
33
+ }, "strip", z.ZodTypeAny, {
34
+ kind: "flag";
35
+ key: string;
36
+ on: boolean;
37
+ }, {
38
+ kind: "flag";
39
+ key: string;
40
+ on: boolean;
41
+ }>, z.ZodObject<{
42
+ kind: z.ZodLiteral<"seen">;
43
+ tourId: z.ZodString;
44
+ value: z.ZodBoolean;
45
+ }, "strip", z.ZodTypeAny, {
46
+ kind: "seen";
47
+ value: boolean;
48
+ tourId: string;
49
+ }, {
50
+ kind: "seen";
51
+ value: boolean;
52
+ tourId: string;
53
+ }>, z.ZodObject<{
54
+ kind: z.ZodLiteral<"custom">;
55
+ predicateId: z.ZodString;
56
+ }, "strip", z.ZodTypeAny, {
57
+ kind: "custom";
58
+ predicateId: string;
59
+ }, {
60
+ kind: "custom";
61
+ predicateId: string;
62
+ }>]>;
63
+ export declare const InteractionAction: z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
64
+ action: z.ZodLiteral<"click">;
65
+ anchorId: z.ZodString;
66
+ }, "strip", z.ZodTypeAny, {
67
+ action: "click";
68
+ anchorId: string;
69
+ }, {
70
+ action: "click";
71
+ anchorId: string;
72
+ }>, z.ZodObject<{
73
+ action: z.ZodLiteral<"navigate">;
74
+ route: z.ZodString;
75
+ }, "strip", z.ZodTypeAny, {
76
+ route: string;
77
+ action: "navigate";
78
+ }, {
79
+ route: string;
80
+ action: "navigate";
81
+ }>, z.ZodObject<{
82
+ action: z.ZodLiteral<"wait">;
83
+ anchorId: z.ZodOptional<z.ZodString>;
84
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
85
+ }, "strip", z.ZodTypeAny, {
86
+ action: "wait";
87
+ anchorId?: string | undefined;
88
+ timeoutMs?: number | undefined;
89
+ }, {
90
+ action: "wait";
91
+ anchorId?: string | undefined;
92
+ timeoutMs?: number | undefined;
93
+ }>]>;
94
+ export declare const Step: z.ZodObject<{
95
+ anchorId: z.ZodOptional<z.ZodString>;
96
+ title: z.ZodString;
97
+ body: z.ZodString;
98
+ placement: z.ZodDefault<z.ZodEnum<["top", "bottom", "left", "right", "auto"]>>;
99
+ prepare: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
100
+ action: z.ZodLiteral<"click">;
101
+ anchorId: z.ZodString;
102
+ }, "strip", z.ZodTypeAny, {
103
+ action: "click";
104
+ anchorId: string;
105
+ }, {
106
+ action: "click";
107
+ anchorId: string;
108
+ }>, z.ZodObject<{
109
+ action: z.ZodLiteral<"navigate">;
110
+ route: z.ZodString;
111
+ }, "strip", z.ZodTypeAny, {
112
+ route: string;
113
+ action: "navigate";
114
+ }, {
115
+ route: string;
116
+ action: "navigate";
117
+ }>, z.ZodObject<{
118
+ action: z.ZodLiteral<"wait">;
119
+ anchorId: z.ZodOptional<z.ZodString>;
120
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ action: "wait";
123
+ anchorId?: string | undefined;
124
+ timeoutMs?: number | undefined;
125
+ }, {
126
+ action: "wait";
127
+ anchorId?: string | undefined;
128
+ timeoutMs?: number | undefined;
129
+ }>]>, "many">>;
130
+ }, "strip", z.ZodTypeAny, {
131
+ title: string;
132
+ body: string;
133
+ placement: "top" | "bottom" | "left" | "right" | "auto";
134
+ anchorId?: string | undefined;
135
+ prepare?: ({
136
+ action: "click";
137
+ anchorId: string;
138
+ } | {
139
+ route: string;
140
+ action: "navigate";
141
+ } | {
142
+ action: "wait";
143
+ anchorId?: string | undefined;
144
+ timeoutMs?: number | undefined;
145
+ })[] | undefined;
146
+ }, {
147
+ title: string;
148
+ body: string;
149
+ anchorId?: string | undefined;
150
+ placement?: "top" | "bottom" | "left" | "right" | "auto" | undefined;
151
+ prepare?: ({
152
+ action: "click";
153
+ anchorId: string;
154
+ } | {
155
+ route: string;
156
+ action: "navigate";
157
+ } | {
158
+ action: "wait";
159
+ anchorId?: string | undefined;
160
+ timeoutMs?: number | undefined;
161
+ })[] | undefined;
162
+ }>;
163
+ export declare const ThemeOverrides: z.ZodObject<{
164
+ overlayColor: z.ZodOptional<z.ZodString>;
165
+ overlayOpacity: z.ZodOptional<z.ZodNumber>;
166
+ popoverBg: z.ZodOptional<z.ZodString>;
167
+ textColor: z.ZodOptional<z.ZodString>;
168
+ mutedColor: z.ZodOptional<z.ZodString>;
169
+ primaryColor: z.ZodOptional<z.ZodString>;
170
+ primaryTextColor: z.ZodOptional<z.ZodString>;
171
+ borderRadius: z.ZodOptional<z.ZodString>;
172
+ fontFamily: z.ZodOptional<z.ZodString>;
173
+ shadow: z.ZodOptional<z.ZodString>;
174
+ stagePadding: z.ZodOptional<z.ZodNumber>;
175
+ stageRadius: z.ZodOptional<z.ZodNumber>;
176
+ animate: z.ZodOptional<z.ZodBoolean>;
177
+ popoverClass: z.ZodOptional<z.ZodString>;
178
+ }, "strip", z.ZodTypeAny, {
179
+ overlayColor?: string | undefined;
180
+ overlayOpacity?: number | undefined;
181
+ popoverBg?: string | undefined;
182
+ textColor?: string | undefined;
183
+ mutedColor?: string | undefined;
184
+ primaryColor?: string | undefined;
185
+ primaryTextColor?: string | undefined;
186
+ borderRadius?: string | undefined;
187
+ fontFamily?: string | undefined;
188
+ shadow?: string | undefined;
189
+ stagePadding?: number | undefined;
190
+ stageRadius?: number | undefined;
191
+ animate?: boolean | undefined;
192
+ popoverClass?: string | undefined;
193
+ }, {
194
+ overlayColor?: string | undefined;
195
+ overlayOpacity?: number | undefined;
196
+ popoverBg?: string | undefined;
197
+ textColor?: string | undefined;
198
+ mutedColor?: string | undefined;
199
+ primaryColor?: string | undefined;
200
+ primaryTextColor?: string | undefined;
201
+ borderRadius?: string | undefined;
202
+ fontFamily?: string | undefined;
203
+ shadow?: string | undefined;
204
+ stagePadding?: number | undefined;
205
+ stageRadius?: number | undefined;
206
+ animate?: boolean | undefined;
207
+ popoverClass?: string | undefined;
208
+ }>;
209
+ export declare const Tour: z.ZodObject<{
210
+ id: z.ZodString;
211
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
212
+ type: z.ZodEnum<["onboarding", "release"]>;
213
+ version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ status: z.ZodDefault<z.ZodEnum<["active", "deprecated", "archived"]>>;
215
+ conditions: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
216
+ kind: z.ZodLiteral<"route">;
217
+ match: z.ZodString;
218
+ }, "strip", z.ZodTypeAny, {
219
+ kind: "route";
220
+ match: string;
221
+ }, {
222
+ kind: "route";
223
+ match: string;
224
+ }>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"role">;
226
+ in: z.ZodArray<z.ZodString, "many">;
227
+ }, "strip", z.ZodTypeAny, {
228
+ kind: "role";
229
+ in: string[];
230
+ }, {
231
+ kind: "role";
232
+ in: string[];
233
+ }>, z.ZodObject<{
234
+ kind: z.ZodLiteral<"version">;
235
+ range: z.ZodString;
236
+ }, "strip", z.ZodTypeAny, {
237
+ kind: "version";
238
+ range: string;
239
+ }, {
240
+ kind: "version";
241
+ range: string;
242
+ }>, z.ZodObject<{
243
+ kind: z.ZodLiteral<"flag">;
244
+ key: z.ZodString;
245
+ on: z.ZodBoolean;
246
+ }, "strip", z.ZodTypeAny, {
247
+ kind: "flag";
248
+ key: string;
249
+ on: boolean;
250
+ }, {
251
+ kind: "flag";
252
+ key: string;
253
+ on: boolean;
254
+ }>, z.ZodObject<{
255
+ kind: z.ZodLiteral<"seen">;
256
+ tourId: z.ZodString;
257
+ value: z.ZodBoolean;
258
+ }, "strip", z.ZodTypeAny, {
259
+ kind: "seen";
260
+ value: boolean;
261
+ tourId: string;
262
+ }, {
263
+ kind: "seen";
264
+ value: boolean;
265
+ tourId: string;
266
+ }>, z.ZodObject<{
267
+ kind: z.ZodLiteral<"custom">;
268
+ predicateId: z.ZodString;
269
+ }, "strip", z.ZodTypeAny, {
270
+ kind: "custom";
271
+ predicateId: string;
272
+ }, {
273
+ kind: "custom";
274
+ predicateId: string;
275
+ }>]>, "many">>;
276
+ theme: z.ZodOptional<z.ZodNullable<z.ZodObject<{
277
+ overlayColor: z.ZodOptional<z.ZodString>;
278
+ overlayOpacity: z.ZodOptional<z.ZodNumber>;
279
+ popoverBg: z.ZodOptional<z.ZodString>;
280
+ textColor: z.ZodOptional<z.ZodString>;
281
+ mutedColor: z.ZodOptional<z.ZodString>;
282
+ primaryColor: z.ZodOptional<z.ZodString>;
283
+ primaryTextColor: z.ZodOptional<z.ZodString>;
284
+ borderRadius: z.ZodOptional<z.ZodString>;
285
+ fontFamily: z.ZodOptional<z.ZodString>;
286
+ shadow: z.ZodOptional<z.ZodString>;
287
+ stagePadding: z.ZodOptional<z.ZodNumber>;
288
+ stageRadius: z.ZodOptional<z.ZodNumber>;
289
+ animate: z.ZodOptional<z.ZodBoolean>;
290
+ popoverClass: z.ZodOptional<z.ZodString>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ overlayColor?: string | undefined;
293
+ overlayOpacity?: number | undefined;
294
+ popoverBg?: string | undefined;
295
+ textColor?: string | undefined;
296
+ mutedColor?: string | undefined;
297
+ primaryColor?: string | undefined;
298
+ primaryTextColor?: string | undefined;
299
+ borderRadius?: string | undefined;
300
+ fontFamily?: string | undefined;
301
+ shadow?: string | undefined;
302
+ stagePadding?: number | undefined;
303
+ stageRadius?: number | undefined;
304
+ animate?: boolean | undefined;
305
+ popoverClass?: string | undefined;
306
+ }, {
307
+ overlayColor?: string | undefined;
308
+ overlayOpacity?: number | undefined;
309
+ popoverBg?: string | undefined;
310
+ textColor?: string | undefined;
311
+ mutedColor?: string | undefined;
312
+ primaryColor?: string | undefined;
313
+ primaryTextColor?: string | undefined;
314
+ borderRadius?: string | undefined;
315
+ fontFamily?: string | undefined;
316
+ shadow?: string | undefined;
317
+ stagePadding?: number | undefined;
318
+ stageRadius?: number | undefined;
319
+ animate?: boolean | undefined;
320
+ popoverClass?: string | undefined;
321
+ }>>>;
322
+ steps: z.ZodArray<z.ZodObject<{
323
+ anchorId: z.ZodOptional<z.ZodString>;
324
+ title: z.ZodString;
325
+ body: z.ZodString;
326
+ placement: z.ZodDefault<z.ZodEnum<["top", "bottom", "left", "right", "auto"]>>;
327
+ prepare: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<"action", [z.ZodObject<{
328
+ action: z.ZodLiteral<"click">;
329
+ anchorId: z.ZodString;
330
+ }, "strip", z.ZodTypeAny, {
331
+ action: "click";
332
+ anchorId: string;
333
+ }, {
334
+ action: "click";
335
+ anchorId: string;
336
+ }>, z.ZodObject<{
337
+ action: z.ZodLiteral<"navigate">;
338
+ route: z.ZodString;
339
+ }, "strip", z.ZodTypeAny, {
340
+ route: string;
341
+ action: "navigate";
342
+ }, {
343
+ route: string;
344
+ action: "navigate";
345
+ }>, z.ZodObject<{
346
+ action: z.ZodLiteral<"wait">;
347
+ anchorId: z.ZodOptional<z.ZodString>;
348
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
349
+ }, "strip", z.ZodTypeAny, {
350
+ action: "wait";
351
+ anchorId?: string | undefined;
352
+ timeoutMs?: number | undefined;
353
+ }, {
354
+ action: "wait";
355
+ anchorId?: string | undefined;
356
+ timeoutMs?: number | undefined;
357
+ }>]>, "many">>;
358
+ }, "strip", z.ZodTypeAny, {
359
+ title: string;
360
+ body: string;
361
+ placement: "top" | "bottom" | "left" | "right" | "auto";
362
+ anchorId?: string | undefined;
363
+ prepare?: ({
364
+ action: "click";
365
+ anchorId: string;
366
+ } | {
367
+ route: string;
368
+ action: "navigate";
369
+ } | {
370
+ action: "wait";
371
+ anchorId?: string | undefined;
372
+ timeoutMs?: number | undefined;
373
+ })[] | undefined;
374
+ }, {
375
+ title: string;
376
+ body: string;
377
+ anchorId?: string | undefined;
378
+ placement?: "top" | "bottom" | "left" | "right" | "auto" | undefined;
379
+ prepare?: ({
380
+ action: "click";
381
+ anchorId: string;
382
+ } | {
383
+ route: string;
384
+ action: "navigate";
385
+ } | {
386
+ action: "wait";
387
+ anchorId?: string | undefined;
388
+ timeoutMs?: number | undefined;
389
+ })[] | undefined;
390
+ }>, "many">;
391
+ seen: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, boolean, boolean | null | undefined>;
392
+ autoplay: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, boolean, boolean | null | undefined>;
393
+ }, "strip", z.ZodTypeAny, {
394
+ type: "onboarding" | "release";
395
+ status: "active" | "deprecated" | "archived";
396
+ seen: boolean;
397
+ id: string;
398
+ conditions: ({
399
+ kind: "route";
400
+ match: string;
401
+ } | {
402
+ kind: "role";
403
+ in: string[];
404
+ } | {
405
+ kind: "version";
406
+ range: string;
407
+ } | {
408
+ kind: "flag";
409
+ key: string;
410
+ on: boolean;
411
+ } | {
412
+ kind: "seen";
413
+ value: boolean;
414
+ tourId: string;
415
+ } | {
416
+ kind: "custom";
417
+ predicateId: string;
418
+ })[];
419
+ steps: {
420
+ title: string;
421
+ body: string;
422
+ placement: "top" | "bottom" | "left" | "right" | "auto";
423
+ anchorId?: string | undefined;
424
+ prepare?: ({
425
+ action: "click";
426
+ anchorId: string;
427
+ } | {
428
+ route: string;
429
+ action: "navigate";
430
+ } | {
431
+ action: "wait";
432
+ anchorId?: string | undefined;
433
+ timeoutMs?: number | undefined;
434
+ })[] | undefined;
435
+ }[];
436
+ autoplay: boolean;
437
+ version?: string | null | undefined;
438
+ title?: string | null | undefined;
439
+ theme?: {
440
+ overlayColor?: string | undefined;
441
+ overlayOpacity?: number | undefined;
442
+ popoverBg?: string | undefined;
443
+ textColor?: string | undefined;
444
+ mutedColor?: string | undefined;
445
+ primaryColor?: string | undefined;
446
+ primaryTextColor?: string | undefined;
447
+ borderRadius?: string | undefined;
448
+ fontFamily?: string | undefined;
449
+ shadow?: string | undefined;
450
+ stagePadding?: number | undefined;
451
+ stageRadius?: number | undefined;
452
+ animate?: boolean | undefined;
453
+ popoverClass?: string | undefined;
454
+ } | null | undefined;
455
+ }, {
456
+ type: "onboarding" | "release";
457
+ id: string;
458
+ steps: {
459
+ title: string;
460
+ body: string;
461
+ anchorId?: string | undefined;
462
+ placement?: "top" | "bottom" | "left" | "right" | "auto" | undefined;
463
+ prepare?: ({
464
+ action: "click";
465
+ anchorId: string;
466
+ } | {
467
+ route: string;
468
+ action: "navigate";
469
+ } | {
470
+ action: "wait";
471
+ anchorId?: string | undefined;
472
+ timeoutMs?: number | undefined;
473
+ })[] | undefined;
474
+ }[];
475
+ status?: "active" | "deprecated" | "archived" | undefined;
476
+ version?: string | null | undefined;
477
+ seen?: boolean | null | undefined;
478
+ title?: string | null | undefined;
479
+ conditions?: ({
480
+ kind: "route";
481
+ match: string;
482
+ } | {
483
+ kind: "role";
484
+ in: string[];
485
+ } | {
486
+ kind: "version";
487
+ range: string;
488
+ } | {
489
+ kind: "flag";
490
+ key: string;
491
+ on: boolean;
492
+ } | {
493
+ kind: "seen";
494
+ value: boolean;
495
+ tourId: string;
496
+ } | {
497
+ kind: "custom";
498
+ predicateId: string;
499
+ })[] | undefined;
500
+ theme?: {
501
+ overlayColor?: string | undefined;
502
+ overlayOpacity?: number | undefined;
503
+ popoverBg?: string | undefined;
504
+ textColor?: string | undefined;
505
+ mutedColor?: string | undefined;
506
+ primaryColor?: string | undefined;
507
+ primaryTextColor?: string | undefined;
508
+ borderRadius?: string | undefined;
509
+ fontFamily?: string | undefined;
510
+ shadow?: string | undefined;
511
+ stagePadding?: number | undefined;
512
+ stageRadius?: number | undefined;
513
+ animate?: boolean | undefined;
514
+ popoverClass?: string | undefined;
515
+ } | null | undefined;
516
+ autoplay?: boolean | null | undefined;
517
+ }>;
518
+ export type Condition = z.infer<typeof Condition>;
519
+ export type InteractionAction = z.infer<typeof InteractionAction>;
520
+ export type Step = z.infer<typeof Step>;
521
+ export type ThemeOverrides = z.infer<typeof ThemeOverrides>;
522
+ export type Tour = z.infer<typeof Tour>;
523
+ export declare function parseTour(raw: unknown): Tour;
524
+ export declare function parseTours(raw: unknown[]): Tour[];
525
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOpB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAW5B,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMf,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBzB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBf,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAClD,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AACxC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC5D,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAE5C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CASjD"}
package/dist/schema.js ADDED
@@ -0,0 +1,78 @@
1
+ import { z } from 'zod';
2
+ export const Condition = z.discriminatedUnion('kind', [
3
+ z.object({ kind: z.literal('route'), match: z.string() }),
4
+ z.object({ kind: z.literal('role'), in: z.array(z.string()) }),
5
+ z.object({ kind: z.literal('version'), range: z.string() }),
6
+ z.object({ kind: z.literal('flag'), key: z.string(), on: z.boolean() }),
7
+ z.object({ kind: z.literal('seen'), tourId: z.string(), value: z.boolean() }),
8
+ z.object({ kind: z.literal('custom'), predicateId: z.string() }),
9
+ ]);
10
+ export const InteractionAction = z.discriminatedUnion('action', [
11
+ z.object({ action: z.literal('click'), anchorId: z.string() }),
12
+ z.object({
13
+ action: z.literal('navigate'),
14
+ route: z.string(),
15
+ }),
16
+ z.object({
17
+ action: z.literal('wait'),
18
+ anchorId: z.string().optional(),
19
+ timeoutMs: z.number().optional(),
20
+ }),
21
+ ]);
22
+ export const Step = z.object({
23
+ anchorId: z.string().optional(),
24
+ title: z.string(),
25
+ body: z.string(),
26
+ placement: z.enum(['top', 'bottom', 'left', 'right', 'auto']).default('auto'),
27
+ prepare: z.array(InteractionAction).optional(),
28
+ });
29
+ export const ThemeOverrides = z.object({
30
+ // Overlay (the dimmed backdrop with the spotlight cutout)
31
+ overlayColor: z.string().optional(),
32
+ overlayOpacity: z.number().min(0).max(1).optional(),
33
+ // Popover surface
34
+ popoverBg: z.string().optional(), // popover background
35
+ textColor: z.string().optional(), // title / primary text
36
+ mutedColor: z.string().optional(), // description, progress, secondary text
37
+ primaryColor: z.string().optional(), // accent: primary buttons, highlights
38
+ primaryTextColor: z.string().optional(), // text on primary buttons (default #fff)
39
+ borderRadius: z.string().optional(), // popover radius (buttons derive from it)
40
+ fontFamily: z.string().optional(),
41
+ shadow: z.string().optional(), // popover box-shadow
42
+ // Spotlight cutout shaping (driver.js stage)
43
+ stagePadding: z.number().optional(), // px of breathing room around the target
44
+ stageRadius: z.number().optional(), // px corner radius of the cutout
45
+ animate: z.boolean().optional(), // stage move animation (default true)
46
+ popoverClass: z.string().optional(), // extra class for deep custom overrides
47
+ });
48
+ export const Tour = z.object({
49
+ id: z.string().min(1),
50
+ title: z.string().nullish(),
51
+ type: z.enum(['onboarding', 'release']),
52
+ version: z.string().nullish(),
53
+ status: z.enum(['active', 'deprecated', 'archived']).default('active'),
54
+ conditions: z.array(Condition).default([]),
55
+ theme: ThemeOverrides.nullish(),
56
+ steps: z.array(Step).min(1),
57
+ // Per-user annotations computed by the backend on GET (keyed off the
58
+ // userId the frontend passes). Not authored — read-only at runtime.
59
+ // seen — this user has already completed or dismissed the tour
60
+ // autoplay — backend designates exactly one tour to auto-start: the
61
+ // newest (by created_at) active, unseen release tour
62
+ seen: z.boolean().nullish().transform(v => v ?? false),
63
+ autoplay: z.boolean().nullish().transform(v => v ?? false),
64
+ });
65
+ export function parseTour(raw) {
66
+ return Tour.parse(raw);
67
+ }
68
+ export function parseTours(raw) {
69
+ return raw.flatMap(item => {
70
+ const result = Tour.safeParse(item);
71
+ if (!result.success) {
72
+ console.warn('[tour] invalid tour definition:', result.error.issues, item);
73
+ return [];
74
+ }
75
+ return [result.data];
76
+ });
77
+ }
78
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACpD,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IACzD,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC3D,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,E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,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAc;IACvC,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,iCAAiC,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,46 @@
1
+ export type TourEvent = {
2
+ type: 'tour.started';
3
+ tourId: string;
4
+ } | {
5
+ type: 'tour.completed';
6
+ tourId: string;
7
+ } | {
8
+ type: 'tour.skipped';
9
+ tourId: string;
10
+ stepIndex: number;
11
+ } | {
12
+ type: 'tour.unavailable';
13
+ tourId: string;
14
+ missingAnchors: string[];
15
+ } | {
16
+ type: 'step.viewed';
17
+ tourId: string;
18
+ stepIndex: number;
19
+ anchorId?: string;
20
+ } | {
21
+ type: 'anchor.fallback';
22
+ anchorId: string;
23
+ strategy: 'testid' | 'role' | 'xpath';
24
+ } | {
25
+ type: 'anchor.healed';
26
+ anchorId: string;
27
+ tourId: string;
28
+ stepIndex: number;
29
+ } | {
30
+ type: 'anchor.mismatch';
31
+ anchorId: string;
32
+ tourId: string;
33
+ stepIndex: number;
34
+ } | {
35
+ type: 'anchor.broken';
36
+ anchorId: string;
37
+ tourId: string;
38
+ stepIndex: number;
39
+ };
40
+ export type TelemetryHandler = (event: TourEvent) => void;
41
+ /** Tour id used for in-authoring preview plays. Hosts should ignore telemetry
42
+ * with this id (it isn't a real, persisted tour) — e.g. skip health reporting. */
43
+ export declare const PREVIEW_TOUR_ID = "__tour_preview__";
44
+ export declare function setTelemetryHandler(fn: TelemetryHandler): void;
45
+ export declare function emit(event: TourEvent): void;
46
+ //# sourceMappingURL=telemetry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAG3D;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAC7E;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,GAEpF;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAE9E;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAChF;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;AAE1D;mFACmF;AACnF,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAIlD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,gBAAgB,GAAG,IAAI,CAE9D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAM3C"}
@@ -0,0 +1,16 @@
1
+ /** Tour id used for in-authoring preview plays. Hosts should ignore telemetry
2
+ * with this id (it isn't a real, persisted tour) — e.g. skip health reporting. */
3
+ export const PREVIEW_TOUR_ID = '__tour_preview__';
4
+ let _handler = () => { };
5
+ export function setTelemetryHandler(fn) {
6
+ _handler = fn;
7
+ }
8
+ export function emit(event) {
9
+ try {
10
+ _handler(event);
11
+ }
12
+ catch {
13
+ // telemetry errors must never crash tours
14
+ }
15
+ }
16
+ //# sourceMappingURL=telemetry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAiBA;mFACmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAElD,IAAI,QAAQ,GAAqB,GAAG,EAAE,GAAE,CAAC,CAAC;AAE1C,MAAM,UAAU,mBAAmB,CAAC,EAAoB;IACtD,QAAQ,GAAG,EAAE,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,IAAI,CAAC;QACH,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,0CAA0C;IAC5C,CAAC;AACH,CAAC"}