@syntrologie/adapt-gamification 2.4.1 → 2.5.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.
package/dist/schema.d.ts CHANGED
@@ -148,55 +148,1771 @@ export declare const AwardBadgeSchema: z.ZodObject<{
148
148
  anchorId: z.ZodOptional<z.ZodString>;
149
149
  label: z.ZodOptional<z.ZodString>;
150
150
  } & {
151
- activation: z.ZodOptional<z.ZodObject<{
152
- routes: z.ZodObject<{
153
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
154
- exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
151
+ triggerWhen: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
152
+ type: z.ZodLiteral<"rules">;
153
+ rules: z.ZodArray<z.ZodObject<{
154
+ conditions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
155
+ type: z.ZodLiteral<"page_url">;
156
+ url: z.ZodString;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: "page_url";
159
+ url: string;
160
+ }, {
161
+ type: "page_url";
162
+ url: string;
163
+ }>, z.ZodObject<{
164
+ type: z.ZodLiteral<"route">;
165
+ routeId: z.ZodString;
166
+ }, "strip", z.ZodTypeAny, {
167
+ type: "route";
168
+ routeId: string;
169
+ }, {
170
+ type: "route";
171
+ routeId: string;
172
+ }>, z.ZodObject<{
173
+ type: z.ZodLiteral<"anchor_visible">;
174
+ anchorId: z.ZodString;
175
+ state: z.ZodEnum<["visible", "present", "absent"]>;
176
+ }, "strip", z.ZodTypeAny, {
177
+ type: "anchor_visible";
178
+ anchorId: string;
179
+ state: "visible" | "present" | "absent";
180
+ }, {
181
+ type: "anchor_visible";
182
+ anchorId: string;
183
+ state: "visible" | "present" | "absent";
184
+ }>, z.ZodObject<{
185
+ type: z.ZodLiteral<"event_occurred">;
186
+ eventName: z.ZodString;
187
+ withinMs: z.ZodOptional<z.ZodNumber>;
188
+ }, "strip", z.ZodTypeAny, {
189
+ type: "event_occurred";
190
+ eventName: string;
191
+ withinMs?: number | undefined;
192
+ }, {
193
+ type: "event_occurred";
194
+ eventName: string;
195
+ withinMs?: number | undefined;
196
+ }>, z.ZodObject<{
197
+ type: z.ZodLiteral<"state_equals">;
198
+ key: z.ZodString;
199
+ value: z.ZodUnknown;
200
+ }, "strip", z.ZodTypeAny, {
201
+ type: "state_equals";
202
+ key: string;
203
+ value?: unknown;
204
+ }, {
205
+ type: "state_equals";
206
+ key: string;
207
+ value?: unknown;
208
+ }>, z.ZodObject<{
209
+ type: z.ZodLiteral<"viewport">;
210
+ minWidth: z.ZodOptional<z.ZodNumber>;
211
+ maxWidth: z.ZodOptional<z.ZodNumber>;
212
+ minHeight: z.ZodOptional<z.ZodNumber>;
213
+ maxHeight: z.ZodOptional<z.ZodNumber>;
214
+ }, "strip", z.ZodTypeAny, {
215
+ type: "viewport";
216
+ minWidth?: number | undefined;
217
+ maxWidth?: number | undefined;
218
+ minHeight?: number | undefined;
219
+ maxHeight?: number | undefined;
220
+ }, {
221
+ type: "viewport";
222
+ minWidth?: number | undefined;
223
+ maxWidth?: number | undefined;
224
+ minHeight?: number | undefined;
225
+ maxHeight?: number | undefined;
226
+ }>, z.ZodObject<{
227
+ type: z.ZodLiteral<"session_metric">;
228
+ key: z.ZodString;
229
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
230
+ threshold: z.ZodNumber;
231
+ }, "strip", z.ZodTypeAny, {
232
+ type: "session_metric";
233
+ key: string;
234
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
235
+ threshold: number;
236
+ }, {
237
+ type: "session_metric";
238
+ key: string;
239
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
240
+ threshold: number;
241
+ }>, z.ZodObject<{
242
+ type: z.ZodLiteral<"dismissed">;
243
+ key: z.ZodString;
244
+ inverted: z.ZodOptional<z.ZodBoolean>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ type: "dismissed";
247
+ key: string;
248
+ inverted?: boolean | undefined;
249
+ }, {
250
+ type: "dismissed";
251
+ key: string;
252
+ inverted?: boolean | undefined;
253
+ }>, z.ZodObject<{
254
+ type: z.ZodLiteral<"cooldown_active">;
255
+ key: z.ZodString;
256
+ inverted: z.ZodOptional<z.ZodBoolean>;
257
+ }, "strip", z.ZodTypeAny, {
258
+ type: "cooldown_active";
259
+ key: string;
260
+ inverted?: boolean | undefined;
261
+ }, {
262
+ type: "cooldown_active";
263
+ key: string;
264
+ inverted?: boolean | undefined;
265
+ }>, z.ZodObject<{
266
+ type: z.ZodLiteral<"frequency_limit">;
267
+ key: z.ZodString;
268
+ limit: z.ZodNumber;
269
+ inverted: z.ZodOptional<z.ZodBoolean>;
270
+ }, "strip", z.ZodTypeAny, {
271
+ type: "frequency_limit";
272
+ key: string;
273
+ limit: number;
274
+ inverted?: boolean | undefined;
275
+ }, {
276
+ type: "frequency_limit";
277
+ key: string;
278
+ limit: number;
279
+ inverted?: boolean | undefined;
280
+ }>, z.ZodObject<{
281
+ type: z.ZodLiteral<"event_count">;
282
+ key: z.ZodString;
283
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
284
+ count: z.ZodNumber;
285
+ withinMs: z.ZodOptional<z.ZodNumber>;
286
+ counter: z.ZodOptional<z.ZodObject<{
287
+ events: z.ZodArray<z.ZodString, "many">;
288
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
289
+ equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
290
+ contains: z.ZodOptional<z.ZodString>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ equals?: string | number | boolean | undefined;
293
+ contains?: string | undefined;
294
+ }, {
295
+ equals?: string | number | boolean | undefined;
296
+ contains?: string | undefined;
297
+ }>>>;
298
+ }, "strip", z.ZodTypeAny, {
299
+ events: string[];
300
+ match?: Record<string, {
301
+ equals?: string | number | boolean | undefined;
302
+ contains?: string | undefined;
303
+ }> | undefined;
304
+ }, {
305
+ events: string[];
306
+ match?: Record<string, {
307
+ equals?: string | number | boolean | undefined;
308
+ contains?: string | undefined;
309
+ }> | undefined;
310
+ }>>;
311
+ }, "strip", z.ZodTypeAny, {
312
+ type: "event_count";
313
+ key: string;
314
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
315
+ count: number;
316
+ withinMs?: number | undefined;
317
+ counter?: {
318
+ events: string[];
319
+ match?: Record<string, {
320
+ equals?: string | number | boolean | undefined;
321
+ contains?: string | undefined;
322
+ }> | undefined;
323
+ } | undefined;
324
+ }, {
325
+ type: "event_count";
326
+ key: string;
327
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
328
+ count: number;
329
+ withinMs?: number | undefined;
330
+ counter?: {
331
+ events: string[];
332
+ match?: Record<string, {
333
+ equals?: string | number | boolean | undefined;
334
+ contains?: string | undefined;
335
+ }> | undefined;
336
+ } | undefined;
337
+ }>]>, "many">;
338
+ value: z.ZodUnknown;
155
339
  }, "strip", z.ZodTypeAny, {
156
- include?: string[] | undefined;
157
- exclude?: string[] | undefined;
340
+ conditions: ({
341
+ type: "page_url";
342
+ url: string;
343
+ } | {
344
+ type: "route";
345
+ routeId: string;
346
+ } | {
347
+ type: "anchor_visible";
348
+ anchorId: string;
349
+ state: "visible" | "present" | "absent";
350
+ } | {
351
+ type: "event_occurred";
352
+ eventName: string;
353
+ withinMs?: number | undefined;
354
+ } | {
355
+ type: "state_equals";
356
+ key: string;
357
+ value?: unknown;
358
+ } | {
359
+ type: "viewport";
360
+ minWidth?: number | undefined;
361
+ maxWidth?: number | undefined;
362
+ minHeight?: number | undefined;
363
+ maxHeight?: number | undefined;
364
+ } | {
365
+ type: "session_metric";
366
+ key: string;
367
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
368
+ threshold: number;
369
+ } | {
370
+ type: "dismissed";
371
+ key: string;
372
+ inverted?: boolean | undefined;
373
+ } | {
374
+ type: "cooldown_active";
375
+ key: string;
376
+ inverted?: boolean | undefined;
377
+ } | {
378
+ type: "frequency_limit";
379
+ key: string;
380
+ limit: number;
381
+ inverted?: boolean | undefined;
382
+ } | {
383
+ type: "event_count";
384
+ key: string;
385
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
386
+ count: number;
387
+ withinMs?: number | undefined;
388
+ counter?: {
389
+ events: string[];
390
+ match?: Record<string, {
391
+ equals?: string | number | boolean | undefined;
392
+ contains?: string | undefined;
393
+ }> | undefined;
394
+ } | undefined;
395
+ })[];
396
+ value?: unknown;
158
397
  }, {
159
- include?: string[] | undefined;
160
- exclude?: string[] | undefined;
161
- }>;
162
- strategy: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
398
+ conditions: ({
399
+ type: "page_url";
400
+ url: string;
401
+ } | {
402
+ type: "route";
403
+ routeId: string;
404
+ } | {
405
+ type: "anchor_visible";
406
+ anchorId: string;
407
+ state: "visible" | "present" | "absent";
408
+ } | {
409
+ type: "event_occurred";
410
+ eventName: string;
411
+ withinMs?: number | undefined;
412
+ } | {
413
+ type: "state_equals";
414
+ key: string;
415
+ value?: unknown;
416
+ } | {
417
+ type: "viewport";
418
+ minWidth?: number | undefined;
419
+ maxWidth?: number | undefined;
420
+ minHeight?: number | undefined;
421
+ maxHeight?: number | undefined;
422
+ } | {
423
+ type: "session_metric";
424
+ key: string;
425
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
426
+ threshold: number;
427
+ } | {
428
+ type: "dismissed";
429
+ key: string;
430
+ inverted?: boolean | undefined;
431
+ } | {
432
+ type: "cooldown_active";
433
+ key: string;
434
+ inverted?: boolean | undefined;
435
+ } | {
436
+ type: "frequency_limit";
437
+ key: string;
438
+ limit: number;
439
+ inverted?: boolean | undefined;
440
+ } | {
441
+ type: "event_count";
442
+ key: string;
443
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
444
+ count: number;
445
+ withinMs?: number | undefined;
446
+ counter?: {
447
+ events: string[];
448
+ match?: Record<string, {
449
+ equals?: string | number | boolean | undefined;
450
+ contains?: string | undefined;
451
+ }> | undefined;
452
+ } | undefined;
453
+ })[];
454
+ value?: unknown;
455
+ }>, "many">;
456
+ default: z.ZodUnknown;
457
+ }, "strip", z.ZodTypeAny, {
458
+ type: "rules";
459
+ rules: {
460
+ conditions: ({
461
+ type: "page_url";
462
+ url: string;
463
+ } | {
464
+ type: "route";
465
+ routeId: string;
466
+ } | {
467
+ type: "anchor_visible";
468
+ anchorId: string;
469
+ state: "visible" | "present" | "absent";
470
+ } | {
471
+ type: "event_occurred";
472
+ eventName: string;
473
+ withinMs?: number | undefined;
474
+ } | {
475
+ type: "state_equals";
476
+ key: string;
477
+ value?: unknown;
478
+ } | {
479
+ type: "viewport";
480
+ minWidth?: number | undefined;
481
+ maxWidth?: number | undefined;
482
+ minHeight?: number | undefined;
483
+ maxHeight?: number | undefined;
484
+ } | {
485
+ type: "session_metric";
486
+ key: string;
487
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
488
+ threshold: number;
489
+ } | {
490
+ type: "dismissed";
491
+ key: string;
492
+ inverted?: boolean | undefined;
493
+ } | {
494
+ type: "cooldown_active";
495
+ key: string;
496
+ inverted?: boolean | undefined;
497
+ } | {
498
+ type: "frequency_limit";
499
+ key: string;
500
+ limit: number;
501
+ inverted?: boolean | undefined;
502
+ } | {
503
+ type: "event_count";
504
+ key: string;
505
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
506
+ count: number;
507
+ withinMs?: number | undefined;
508
+ counter?: {
509
+ events: string[];
510
+ match?: Record<string, {
511
+ equals?: string | number | boolean | undefined;
512
+ contains?: string | undefined;
513
+ }> | undefined;
514
+ } | undefined;
515
+ })[];
516
+ value?: unknown;
517
+ }[];
518
+ default?: unknown;
519
+ }, {
520
+ type: "rules";
521
+ rules: {
522
+ conditions: ({
523
+ type: "page_url";
524
+ url: string;
525
+ } | {
526
+ type: "route";
527
+ routeId: string;
528
+ } | {
529
+ type: "anchor_visible";
530
+ anchorId: string;
531
+ state: "visible" | "present" | "absent";
532
+ } | {
533
+ type: "event_occurred";
534
+ eventName: string;
535
+ withinMs?: number | undefined;
536
+ } | {
537
+ type: "state_equals";
538
+ key: string;
539
+ value?: unknown;
540
+ } | {
541
+ type: "viewport";
542
+ minWidth?: number | undefined;
543
+ maxWidth?: number | undefined;
544
+ minHeight?: number | undefined;
545
+ maxHeight?: number | undefined;
546
+ } | {
547
+ type: "session_metric";
548
+ key: string;
549
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
550
+ threshold: number;
551
+ } | {
552
+ type: "dismissed";
553
+ key: string;
554
+ inverted?: boolean | undefined;
555
+ } | {
556
+ type: "cooldown_active";
557
+ key: string;
558
+ inverted?: boolean | undefined;
559
+ } | {
560
+ type: "frequency_limit";
561
+ key: string;
562
+ limit: number;
563
+ inverted?: boolean | undefined;
564
+ } | {
565
+ type: "event_count";
566
+ key: string;
567
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
568
+ count: number;
569
+ withinMs?: number | undefined;
570
+ counter?: {
571
+ events: string[];
572
+ match?: Record<string, {
573
+ equals?: string | number | boolean | undefined;
574
+ contains?: string | undefined;
575
+ }> | undefined;
576
+ } | undefined;
577
+ })[];
578
+ value?: unknown;
579
+ }[];
580
+ default?: unknown;
581
+ }>, z.ZodObject<{
582
+ type: z.ZodLiteral<"score">;
583
+ field: z.ZodString;
584
+ threshold: z.ZodNumber;
585
+ above: z.ZodUnknown;
586
+ below: z.ZodUnknown;
587
+ }, "strip", z.ZodTypeAny, {
588
+ type: "score";
589
+ threshold: number;
590
+ field: string;
591
+ above?: unknown;
592
+ below?: unknown;
593
+ }, {
594
+ type: "score";
595
+ threshold: number;
596
+ field: string;
597
+ above?: unknown;
598
+ below?: unknown;
599
+ }>, z.ZodObject<{
600
+ type: z.ZodLiteral<"model">;
601
+ modelId: z.ZodString;
602
+ inputs: z.ZodArray<z.ZodString, "many">;
603
+ outputMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
604
+ default: z.ZodUnknown;
605
+ }, "strip", z.ZodTypeAny, {
606
+ type: "model";
607
+ modelId: string;
608
+ inputs: string[];
609
+ outputMapping: Record<string, unknown>;
610
+ default?: unknown;
611
+ }, {
612
+ type: "model";
613
+ modelId: string;
614
+ inputs: string[];
615
+ outputMapping: Record<string, unknown>;
616
+ default?: unknown;
617
+ }>, z.ZodObject<{
618
+ type: z.ZodLiteral<"external">;
619
+ endpoint: z.ZodString;
620
+ method: z.ZodOptional<z.ZodEnum<["GET", "POST"]>>;
621
+ default: z.ZodUnknown;
622
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
623
+ }, "strip", z.ZodTypeAny, {
624
+ type: "external";
625
+ endpoint: string;
626
+ default?: unknown;
627
+ method?: "GET" | "POST" | undefined;
628
+ timeoutMs?: number | undefined;
629
+ }, {
630
+ type: "external";
631
+ endpoint: string;
632
+ default?: unknown;
633
+ method?: "GET" | "POST" | undefined;
634
+ timeoutMs?: number | undefined;
635
+ }>]>>>;
636
+ }, "strip", z.ZodTypeAny, {
637
+ badgeId: string;
638
+ kind: "gamification:awardBadge";
639
+ anchorId?: string | undefined;
640
+ label?: string | undefined;
641
+ triggerWhen?: {
642
+ type: "rules";
643
+ rules: {
644
+ conditions: ({
645
+ type: "page_url";
646
+ url: string;
647
+ } | {
648
+ type: "route";
649
+ routeId: string;
650
+ } | {
651
+ type: "anchor_visible";
652
+ anchorId: string;
653
+ state: "visible" | "present" | "absent";
654
+ } | {
655
+ type: "event_occurred";
656
+ eventName: string;
657
+ withinMs?: number | undefined;
658
+ } | {
659
+ type: "state_equals";
660
+ key: string;
661
+ value?: unknown;
662
+ } | {
663
+ type: "viewport";
664
+ minWidth?: number | undefined;
665
+ maxWidth?: number | undefined;
666
+ minHeight?: number | undefined;
667
+ maxHeight?: number | undefined;
668
+ } | {
669
+ type: "session_metric";
670
+ key: string;
671
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
672
+ threshold: number;
673
+ } | {
674
+ type: "dismissed";
675
+ key: string;
676
+ inverted?: boolean | undefined;
677
+ } | {
678
+ type: "cooldown_active";
679
+ key: string;
680
+ inverted?: boolean | undefined;
681
+ } | {
682
+ type: "frequency_limit";
683
+ key: string;
684
+ limit: number;
685
+ inverted?: boolean | undefined;
686
+ } | {
687
+ type: "event_count";
688
+ key: string;
689
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
690
+ count: number;
691
+ withinMs?: number | undefined;
692
+ counter?: {
693
+ events: string[];
694
+ match?: Record<string, {
695
+ equals?: string | number | boolean | undefined;
696
+ contains?: string | undefined;
697
+ }> | undefined;
698
+ } | undefined;
699
+ })[];
700
+ value?: unknown;
701
+ }[];
702
+ default?: unknown;
703
+ } | {
704
+ type: "score";
705
+ threshold: number;
706
+ field: string;
707
+ above?: unknown;
708
+ below?: unknown;
709
+ } | {
710
+ type: "model";
711
+ modelId: string;
712
+ inputs: string[];
713
+ outputMapping: Record<string, unknown>;
714
+ default?: unknown;
715
+ } | {
716
+ type: "external";
717
+ endpoint: string;
718
+ default?: unknown;
719
+ method?: "GET" | "POST" | undefined;
720
+ timeoutMs?: number | undefined;
721
+ } | null | undefined;
722
+ }, {
723
+ badgeId: string;
724
+ kind: "gamification:awardBadge";
725
+ anchorId?: string | undefined;
726
+ label?: string | undefined;
727
+ triggerWhen?: {
728
+ type: "rules";
729
+ rules: {
730
+ conditions: ({
731
+ type: "page_url";
732
+ url: string;
733
+ } | {
734
+ type: "route";
735
+ routeId: string;
736
+ } | {
737
+ type: "anchor_visible";
738
+ anchorId: string;
739
+ state: "visible" | "present" | "absent";
740
+ } | {
741
+ type: "event_occurred";
742
+ eventName: string;
743
+ withinMs?: number | undefined;
744
+ } | {
745
+ type: "state_equals";
746
+ key: string;
747
+ value?: unknown;
748
+ } | {
749
+ type: "viewport";
750
+ minWidth?: number | undefined;
751
+ maxWidth?: number | undefined;
752
+ minHeight?: number | undefined;
753
+ maxHeight?: number | undefined;
754
+ } | {
755
+ type: "session_metric";
756
+ key: string;
757
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
758
+ threshold: number;
759
+ } | {
760
+ type: "dismissed";
761
+ key: string;
762
+ inverted?: boolean | undefined;
763
+ } | {
764
+ type: "cooldown_active";
765
+ key: string;
766
+ inverted?: boolean | undefined;
767
+ } | {
768
+ type: "frequency_limit";
769
+ key: string;
770
+ limit: number;
771
+ inverted?: boolean | undefined;
772
+ } | {
773
+ type: "event_count";
774
+ key: string;
775
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
776
+ count: number;
777
+ withinMs?: number | undefined;
778
+ counter?: {
779
+ events: string[];
780
+ match?: Record<string, {
781
+ equals?: string | number | boolean | undefined;
782
+ contains?: string | undefined;
783
+ }> | undefined;
784
+ } | undefined;
785
+ })[];
786
+ value?: unknown;
787
+ }[];
788
+ default?: unknown;
789
+ } | {
790
+ type: "score";
791
+ threshold: number;
792
+ field: string;
793
+ above?: unknown;
794
+ below?: unknown;
795
+ } | {
796
+ type: "model";
797
+ modelId: string;
798
+ inputs: string[];
799
+ outputMapping: Record<string, unknown>;
800
+ default?: unknown;
801
+ } | {
802
+ type: "external";
803
+ endpoint: string;
804
+ default?: unknown;
805
+ method?: "GET" | "POST" | undefined;
806
+ timeoutMs?: number | undefined;
807
+ } | null | undefined;
808
+ }>;
809
+ /**
810
+ * Schema for adding points to a user's score.
811
+ */
812
+ export declare const AddPointsSchema: z.ZodObject<{
813
+ kind: z.ZodLiteral<"gamification:addPoints">;
814
+ points: z.ZodNumber;
815
+ reason: z.ZodOptional<z.ZodString>;
816
+ label: z.ZodOptional<z.ZodString>;
817
+ } & {
818
+ triggerWhen: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
819
+ type: z.ZodLiteral<"rules">;
820
+ rules: z.ZodArray<z.ZodObject<{
821
+ conditions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
822
+ type: z.ZodLiteral<"page_url">;
823
+ url: z.ZodString;
824
+ }, "strip", z.ZodTypeAny, {
825
+ type: "page_url";
826
+ url: string;
827
+ }, {
828
+ type: "page_url";
829
+ url: string;
830
+ }>, z.ZodObject<{
831
+ type: z.ZodLiteral<"route">;
832
+ routeId: z.ZodString;
833
+ }, "strip", z.ZodTypeAny, {
834
+ type: "route";
835
+ routeId: string;
836
+ }, {
837
+ type: "route";
838
+ routeId: string;
839
+ }>, z.ZodObject<{
840
+ type: z.ZodLiteral<"anchor_visible">;
841
+ anchorId: z.ZodString;
842
+ state: z.ZodEnum<["visible", "present", "absent"]>;
843
+ }, "strip", z.ZodTypeAny, {
844
+ type: "anchor_visible";
845
+ anchorId: string;
846
+ state: "visible" | "present" | "absent";
847
+ }, {
848
+ type: "anchor_visible";
849
+ anchorId: string;
850
+ state: "visible" | "present" | "absent";
851
+ }>, z.ZodObject<{
852
+ type: z.ZodLiteral<"event_occurred">;
853
+ eventName: z.ZodString;
854
+ withinMs: z.ZodOptional<z.ZodNumber>;
855
+ }, "strip", z.ZodTypeAny, {
856
+ type: "event_occurred";
857
+ eventName: string;
858
+ withinMs?: number | undefined;
859
+ }, {
860
+ type: "event_occurred";
861
+ eventName: string;
862
+ withinMs?: number | undefined;
863
+ }>, z.ZodObject<{
864
+ type: z.ZodLiteral<"state_equals">;
865
+ key: z.ZodString;
866
+ value: z.ZodUnknown;
867
+ }, "strip", z.ZodTypeAny, {
868
+ type: "state_equals";
869
+ key: string;
870
+ value?: unknown;
871
+ }, {
872
+ type: "state_equals";
873
+ key: string;
874
+ value?: unknown;
875
+ }>, z.ZodObject<{
876
+ type: z.ZodLiteral<"viewport">;
877
+ minWidth: z.ZodOptional<z.ZodNumber>;
878
+ maxWidth: z.ZodOptional<z.ZodNumber>;
879
+ minHeight: z.ZodOptional<z.ZodNumber>;
880
+ maxHeight: z.ZodOptional<z.ZodNumber>;
881
+ }, "strip", z.ZodTypeAny, {
882
+ type: "viewport";
883
+ minWidth?: number | undefined;
884
+ maxWidth?: number | undefined;
885
+ minHeight?: number | undefined;
886
+ maxHeight?: number | undefined;
887
+ }, {
888
+ type: "viewport";
889
+ minWidth?: number | undefined;
890
+ maxWidth?: number | undefined;
891
+ minHeight?: number | undefined;
892
+ maxHeight?: number | undefined;
893
+ }>, z.ZodObject<{
894
+ type: z.ZodLiteral<"session_metric">;
895
+ key: z.ZodString;
896
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
897
+ threshold: z.ZodNumber;
898
+ }, "strip", z.ZodTypeAny, {
899
+ type: "session_metric";
900
+ key: string;
901
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
902
+ threshold: number;
903
+ }, {
904
+ type: "session_metric";
905
+ key: string;
906
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
907
+ threshold: number;
908
+ }>, z.ZodObject<{
909
+ type: z.ZodLiteral<"dismissed">;
910
+ key: z.ZodString;
911
+ inverted: z.ZodOptional<z.ZodBoolean>;
912
+ }, "strip", z.ZodTypeAny, {
913
+ type: "dismissed";
914
+ key: string;
915
+ inverted?: boolean | undefined;
916
+ }, {
917
+ type: "dismissed";
918
+ key: string;
919
+ inverted?: boolean | undefined;
920
+ }>, z.ZodObject<{
921
+ type: z.ZodLiteral<"cooldown_active">;
922
+ key: z.ZodString;
923
+ inverted: z.ZodOptional<z.ZodBoolean>;
924
+ }, "strip", z.ZodTypeAny, {
925
+ type: "cooldown_active";
926
+ key: string;
927
+ inverted?: boolean | undefined;
928
+ }, {
929
+ type: "cooldown_active";
930
+ key: string;
931
+ inverted?: boolean | undefined;
932
+ }>, z.ZodObject<{
933
+ type: z.ZodLiteral<"frequency_limit">;
934
+ key: z.ZodString;
935
+ limit: z.ZodNumber;
936
+ inverted: z.ZodOptional<z.ZodBoolean>;
937
+ }, "strip", z.ZodTypeAny, {
938
+ type: "frequency_limit";
939
+ key: string;
940
+ limit: number;
941
+ inverted?: boolean | undefined;
942
+ }, {
943
+ type: "frequency_limit";
944
+ key: string;
945
+ limit: number;
946
+ inverted?: boolean | undefined;
947
+ }>, z.ZodObject<{
948
+ type: z.ZodLiteral<"event_count">;
949
+ key: z.ZodString;
950
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
951
+ count: z.ZodNumber;
952
+ withinMs: z.ZodOptional<z.ZodNumber>;
953
+ counter: z.ZodOptional<z.ZodObject<{
954
+ events: z.ZodArray<z.ZodString, "many">;
955
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
956
+ equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
957
+ contains: z.ZodOptional<z.ZodString>;
958
+ }, "strip", z.ZodTypeAny, {
959
+ equals?: string | number | boolean | undefined;
960
+ contains?: string | undefined;
961
+ }, {
962
+ equals?: string | number | boolean | undefined;
963
+ contains?: string | undefined;
964
+ }>>>;
965
+ }, "strip", z.ZodTypeAny, {
966
+ events: string[];
967
+ match?: Record<string, {
968
+ equals?: string | number | boolean | undefined;
969
+ contains?: string | undefined;
970
+ }> | undefined;
971
+ }, {
972
+ events: string[];
973
+ match?: Record<string, {
974
+ equals?: string | number | boolean | undefined;
975
+ contains?: string | undefined;
976
+ }> | undefined;
977
+ }>>;
978
+ }, "strip", z.ZodTypeAny, {
979
+ type: "event_count";
980
+ key: string;
981
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
982
+ count: number;
983
+ withinMs?: number | undefined;
984
+ counter?: {
985
+ events: string[];
986
+ match?: Record<string, {
987
+ equals?: string | number | boolean | undefined;
988
+ contains?: string | undefined;
989
+ }> | undefined;
990
+ } | undefined;
991
+ }, {
992
+ type: "event_count";
993
+ key: string;
994
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
995
+ count: number;
996
+ withinMs?: number | undefined;
997
+ counter?: {
998
+ events: string[];
999
+ match?: Record<string, {
1000
+ equals?: string | number | boolean | undefined;
1001
+ contains?: string | undefined;
1002
+ }> | undefined;
1003
+ } | undefined;
1004
+ }>]>, "many">;
1005
+ value: z.ZodUnknown;
1006
+ }, "strip", z.ZodTypeAny, {
1007
+ conditions: ({
1008
+ type: "page_url";
1009
+ url: string;
1010
+ } | {
1011
+ type: "route";
1012
+ routeId: string;
1013
+ } | {
1014
+ type: "anchor_visible";
1015
+ anchorId: string;
1016
+ state: "visible" | "present" | "absent";
1017
+ } | {
1018
+ type: "event_occurred";
1019
+ eventName: string;
1020
+ withinMs?: number | undefined;
1021
+ } | {
1022
+ type: "state_equals";
1023
+ key: string;
1024
+ value?: unknown;
1025
+ } | {
1026
+ type: "viewport";
1027
+ minWidth?: number | undefined;
1028
+ maxWidth?: number | undefined;
1029
+ minHeight?: number | undefined;
1030
+ maxHeight?: number | undefined;
1031
+ } | {
1032
+ type: "session_metric";
1033
+ key: string;
1034
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1035
+ threshold: number;
1036
+ } | {
1037
+ type: "dismissed";
1038
+ key: string;
1039
+ inverted?: boolean | undefined;
1040
+ } | {
1041
+ type: "cooldown_active";
1042
+ key: string;
1043
+ inverted?: boolean | undefined;
1044
+ } | {
1045
+ type: "frequency_limit";
1046
+ key: string;
1047
+ limit: number;
1048
+ inverted?: boolean | undefined;
1049
+ } | {
1050
+ type: "event_count";
1051
+ key: string;
1052
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1053
+ count: number;
1054
+ withinMs?: number | undefined;
1055
+ counter?: {
1056
+ events: string[];
1057
+ match?: Record<string, {
1058
+ equals?: string | number | boolean | undefined;
1059
+ contains?: string | undefined;
1060
+ }> | undefined;
1061
+ } | undefined;
1062
+ })[];
1063
+ value?: unknown;
1064
+ }, {
1065
+ conditions: ({
1066
+ type: "page_url";
1067
+ url: string;
1068
+ } | {
1069
+ type: "route";
1070
+ routeId: string;
1071
+ } | {
1072
+ type: "anchor_visible";
1073
+ anchorId: string;
1074
+ state: "visible" | "present" | "absent";
1075
+ } | {
1076
+ type: "event_occurred";
1077
+ eventName: string;
1078
+ withinMs?: number | undefined;
1079
+ } | {
1080
+ type: "state_equals";
1081
+ key: string;
1082
+ value?: unknown;
1083
+ } | {
1084
+ type: "viewport";
1085
+ minWidth?: number | undefined;
1086
+ maxWidth?: number | undefined;
1087
+ minHeight?: number | undefined;
1088
+ maxHeight?: number | undefined;
1089
+ } | {
1090
+ type: "session_metric";
1091
+ key: string;
1092
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1093
+ threshold: number;
1094
+ } | {
1095
+ type: "dismissed";
1096
+ key: string;
1097
+ inverted?: boolean | undefined;
1098
+ } | {
1099
+ type: "cooldown_active";
1100
+ key: string;
1101
+ inverted?: boolean | undefined;
1102
+ } | {
1103
+ type: "frequency_limit";
1104
+ key: string;
1105
+ limit: number;
1106
+ inverted?: boolean | undefined;
1107
+ } | {
1108
+ type: "event_count";
1109
+ key: string;
1110
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1111
+ count: number;
1112
+ withinMs?: number | undefined;
1113
+ counter?: {
1114
+ events: string[];
1115
+ match?: Record<string, {
1116
+ equals?: string | number | boolean | undefined;
1117
+ contains?: string | undefined;
1118
+ }> | undefined;
1119
+ } | undefined;
1120
+ })[];
1121
+ value?: unknown;
1122
+ }>, "many">;
1123
+ default: z.ZodUnknown;
1124
+ }, "strip", z.ZodTypeAny, {
1125
+ type: "rules";
1126
+ rules: {
1127
+ conditions: ({
1128
+ type: "page_url";
1129
+ url: string;
1130
+ } | {
1131
+ type: "route";
1132
+ routeId: string;
1133
+ } | {
1134
+ type: "anchor_visible";
1135
+ anchorId: string;
1136
+ state: "visible" | "present" | "absent";
1137
+ } | {
1138
+ type: "event_occurred";
1139
+ eventName: string;
1140
+ withinMs?: number | undefined;
1141
+ } | {
1142
+ type: "state_equals";
1143
+ key: string;
1144
+ value?: unknown;
1145
+ } | {
1146
+ type: "viewport";
1147
+ minWidth?: number | undefined;
1148
+ maxWidth?: number | undefined;
1149
+ minHeight?: number | undefined;
1150
+ maxHeight?: number | undefined;
1151
+ } | {
1152
+ type: "session_metric";
1153
+ key: string;
1154
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1155
+ threshold: number;
1156
+ } | {
1157
+ type: "dismissed";
1158
+ key: string;
1159
+ inverted?: boolean | undefined;
1160
+ } | {
1161
+ type: "cooldown_active";
1162
+ key: string;
1163
+ inverted?: boolean | undefined;
1164
+ } | {
1165
+ type: "frequency_limit";
1166
+ key: string;
1167
+ limit: number;
1168
+ inverted?: boolean | undefined;
1169
+ } | {
1170
+ type: "event_count";
1171
+ key: string;
1172
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1173
+ count: number;
1174
+ withinMs?: number | undefined;
1175
+ counter?: {
1176
+ events: string[];
1177
+ match?: Record<string, {
1178
+ equals?: string | number | boolean | undefined;
1179
+ contains?: string | undefined;
1180
+ }> | undefined;
1181
+ } | undefined;
1182
+ })[];
1183
+ value?: unknown;
1184
+ }[];
1185
+ default?: unknown;
1186
+ }, {
1187
+ type: "rules";
1188
+ rules: {
1189
+ conditions: ({
1190
+ type: "page_url";
1191
+ url: string;
1192
+ } | {
1193
+ type: "route";
1194
+ routeId: string;
1195
+ } | {
1196
+ type: "anchor_visible";
1197
+ anchorId: string;
1198
+ state: "visible" | "present" | "absent";
1199
+ } | {
1200
+ type: "event_occurred";
1201
+ eventName: string;
1202
+ withinMs?: number | undefined;
1203
+ } | {
1204
+ type: "state_equals";
1205
+ key: string;
1206
+ value?: unknown;
1207
+ } | {
1208
+ type: "viewport";
1209
+ minWidth?: number | undefined;
1210
+ maxWidth?: number | undefined;
1211
+ minHeight?: number | undefined;
1212
+ maxHeight?: number | undefined;
1213
+ } | {
1214
+ type: "session_metric";
1215
+ key: string;
1216
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1217
+ threshold: number;
1218
+ } | {
1219
+ type: "dismissed";
1220
+ key: string;
1221
+ inverted?: boolean | undefined;
1222
+ } | {
1223
+ type: "cooldown_active";
1224
+ key: string;
1225
+ inverted?: boolean | undefined;
1226
+ } | {
1227
+ type: "frequency_limit";
1228
+ key: string;
1229
+ limit: number;
1230
+ inverted?: boolean | undefined;
1231
+ } | {
1232
+ type: "event_count";
1233
+ key: string;
1234
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1235
+ count: number;
1236
+ withinMs?: number | undefined;
1237
+ counter?: {
1238
+ events: string[];
1239
+ match?: Record<string, {
1240
+ equals?: string | number | boolean | undefined;
1241
+ contains?: string | undefined;
1242
+ }> | undefined;
1243
+ } | undefined;
1244
+ })[];
1245
+ value?: unknown;
1246
+ }[];
1247
+ default?: unknown;
1248
+ }>, z.ZodObject<{
1249
+ type: z.ZodLiteral<"score">;
1250
+ field: z.ZodString;
1251
+ threshold: z.ZodNumber;
1252
+ above: z.ZodUnknown;
1253
+ below: z.ZodUnknown;
1254
+ }, "strip", z.ZodTypeAny, {
1255
+ type: "score";
1256
+ threshold: number;
1257
+ field: string;
1258
+ above?: unknown;
1259
+ below?: unknown;
1260
+ }, {
1261
+ type: "score";
1262
+ threshold: number;
1263
+ field: string;
1264
+ above?: unknown;
1265
+ below?: unknown;
1266
+ }>, z.ZodObject<{
1267
+ type: z.ZodLiteral<"model">;
1268
+ modelId: z.ZodString;
1269
+ inputs: z.ZodArray<z.ZodString, "many">;
1270
+ outputMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1271
+ default: z.ZodUnknown;
1272
+ }, "strip", z.ZodTypeAny, {
1273
+ type: "model";
1274
+ modelId: string;
1275
+ inputs: string[];
1276
+ outputMapping: Record<string, unknown>;
1277
+ default?: unknown;
1278
+ }, {
1279
+ type: "model";
1280
+ modelId: string;
1281
+ inputs: string[];
1282
+ outputMapping: Record<string, unknown>;
1283
+ default?: unknown;
1284
+ }>, z.ZodObject<{
1285
+ type: z.ZodLiteral<"external">;
1286
+ endpoint: z.ZodString;
1287
+ method: z.ZodOptional<z.ZodEnum<["GET", "POST"]>>;
1288
+ default: z.ZodUnknown;
1289
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
1290
+ }, "strip", z.ZodTypeAny, {
1291
+ type: "external";
1292
+ endpoint: string;
1293
+ default?: unknown;
1294
+ method?: "GET" | "POST" | undefined;
1295
+ timeoutMs?: number | undefined;
1296
+ }, {
1297
+ type: "external";
1298
+ endpoint: string;
1299
+ default?: unknown;
1300
+ method?: "GET" | "POST" | undefined;
1301
+ timeoutMs?: number | undefined;
1302
+ }>]>>>;
1303
+ }, "strip", z.ZodTypeAny, {
1304
+ points: number;
1305
+ kind: "gamification:addPoints";
1306
+ reason?: string | undefined;
1307
+ label?: string | undefined;
1308
+ triggerWhen?: {
1309
+ type: "rules";
1310
+ rules: {
1311
+ conditions: ({
1312
+ type: "page_url";
1313
+ url: string;
1314
+ } | {
1315
+ type: "route";
1316
+ routeId: string;
1317
+ } | {
1318
+ type: "anchor_visible";
1319
+ anchorId: string;
1320
+ state: "visible" | "present" | "absent";
1321
+ } | {
1322
+ type: "event_occurred";
1323
+ eventName: string;
1324
+ withinMs?: number | undefined;
1325
+ } | {
1326
+ type: "state_equals";
1327
+ key: string;
1328
+ value?: unknown;
1329
+ } | {
1330
+ type: "viewport";
1331
+ minWidth?: number | undefined;
1332
+ maxWidth?: number | undefined;
1333
+ minHeight?: number | undefined;
1334
+ maxHeight?: number | undefined;
1335
+ } | {
1336
+ type: "session_metric";
1337
+ key: string;
1338
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1339
+ threshold: number;
1340
+ } | {
1341
+ type: "dismissed";
1342
+ key: string;
1343
+ inverted?: boolean | undefined;
1344
+ } | {
1345
+ type: "cooldown_active";
1346
+ key: string;
1347
+ inverted?: boolean | undefined;
1348
+ } | {
1349
+ type: "frequency_limit";
1350
+ key: string;
1351
+ limit: number;
1352
+ inverted?: boolean | undefined;
1353
+ } | {
1354
+ type: "event_count";
1355
+ key: string;
1356
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1357
+ count: number;
1358
+ withinMs?: number | undefined;
1359
+ counter?: {
1360
+ events: string[];
1361
+ match?: Record<string, {
1362
+ equals?: string | number | boolean | undefined;
1363
+ contains?: string | undefined;
1364
+ }> | undefined;
1365
+ } | undefined;
1366
+ })[];
1367
+ value?: unknown;
1368
+ }[];
1369
+ default?: unknown;
1370
+ } | {
1371
+ type: "score";
1372
+ threshold: number;
1373
+ field: string;
1374
+ above?: unknown;
1375
+ below?: unknown;
1376
+ } | {
1377
+ type: "model";
1378
+ modelId: string;
1379
+ inputs: string[];
1380
+ outputMapping: Record<string, unknown>;
1381
+ default?: unknown;
1382
+ } | {
1383
+ type: "external";
1384
+ endpoint: string;
1385
+ default?: unknown;
1386
+ method?: "GET" | "POST" | undefined;
1387
+ timeoutMs?: number | undefined;
1388
+ } | null | undefined;
1389
+ }, {
1390
+ points: number;
1391
+ kind: "gamification:addPoints";
1392
+ reason?: string | undefined;
1393
+ label?: string | undefined;
1394
+ triggerWhen?: {
1395
+ type: "rules";
1396
+ rules: {
1397
+ conditions: ({
1398
+ type: "page_url";
1399
+ url: string;
1400
+ } | {
1401
+ type: "route";
1402
+ routeId: string;
1403
+ } | {
1404
+ type: "anchor_visible";
1405
+ anchorId: string;
1406
+ state: "visible" | "present" | "absent";
1407
+ } | {
1408
+ type: "event_occurred";
1409
+ eventName: string;
1410
+ withinMs?: number | undefined;
1411
+ } | {
1412
+ type: "state_equals";
1413
+ key: string;
1414
+ value?: unknown;
1415
+ } | {
1416
+ type: "viewport";
1417
+ minWidth?: number | undefined;
1418
+ maxWidth?: number | undefined;
1419
+ minHeight?: number | undefined;
1420
+ maxHeight?: number | undefined;
1421
+ } | {
1422
+ type: "session_metric";
1423
+ key: string;
1424
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1425
+ threshold: number;
1426
+ } | {
1427
+ type: "dismissed";
1428
+ key: string;
1429
+ inverted?: boolean | undefined;
1430
+ } | {
1431
+ type: "cooldown_active";
1432
+ key: string;
1433
+ inverted?: boolean | undefined;
1434
+ } | {
1435
+ type: "frequency_limit";
1436
+ key: string;
1437
+ limit: number;
1438
+ inverted?: boolean | undefined;
1439
+ } | {
1440
+ type: "event_count";
1441
+ key: string;
1442
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1443
+ count: number;
1444
+ withinMs?: number | undefined;
1445
+ counter?: {
1446
+ events: string[];
1447
+ match?: Record<string, {
1448
+ equals?: string | number | boolean | undefined;
1449
+ contains?: string | undefined;
1450
+ }> | undefined;
1451
+ } | undefined;
1452
+ })[];
1453
+ value?: unknown;
1454
+ }[];
1455
+ default?: unknown;
1456
+ } | {
1457
+ type: "score";
1458
+ threshold: number;
1459
+ field: string;
1460
+ above?: unknown;
1461
+ below?: unknown;
1462
+ } | {
1463
+ type: "model";
1464
+ modelId: string;
1465
+ inputs: string[];
1466
+ outputMapping: Record<string, unknown>;
1467
+ default?: unknown;
1468
+ } | {
1469
+ type: "external";
1470
+ endpoint: string;
1471
+ default?: unknown;
1472
+ method?: "GET" | "POST" | undefined;
1473
+ timeoutMs?: number | undefined;
1474
+ } | null | undefined;
1475
+ }>;
1476
+ /**
1477
+ * Action step schemas for unified JSON Schema generation.
1478
+ * The build script reads this array to merge adaptive actions into the
1479
+ * unified canvas-config.schema.json.
1480
+ */
1481
+ export declare const actionStepSchemas: ({
1482
+ defName: string;
1483
+ schema: z.ZodObject<{
1484
+ kind: z.ZodLiteral<"gamification:awardBadge">;
1485
+ badgeId: z.ZodString;
1486
+ anchorId: z.ZodOptional<z.ZodString>;
1487
+ label: z.ZodOptional<z.ZodString>;
1488
+ } & {
1489
+ triggerWhen: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
163
1490
  type: z.ZodLiteral<"rules">;
164
1491
  rules: z.ZodArray<z.ZodObject<{
165
- conditions: z.ZodArray<z.ZodObject<{
166
- type: z.ZodString;
167
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
168
- type: z.ZodString;
169
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
170
- type: z.ZodString;
171
- }, z.ZodTypeAny, "passthrough">>, "many">;
1492
+ conditions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1493
+ type: z.ZodLiteral<"page_url">;
1494
+ url: z.ZodString;
1495
+ }, "strip", z.ZodTypeAny, {
1496
+ type: "page_url";
1497
+ url: string;
1498
+ }, {
1499
+ type: "page_url";
1500
+ url: string;
1501
+ }>, z.ZodObject<{
1502
+ type: z.ZodLiteral<"route">;
1503
+ routeId: z.ZodString;
1504
+ }, "strip", z.ZodTypeAny, {
1505
+ type: "route";
1506
+ routeId: string;
1507
+ }, {
1508
+ type: "route";
1509
+ routeId: string;
1510
+ }>, z.ZodObject<{
1511
+ type: z.ZodLiteral<"anchor_visible">;
1512
+ anchorId: z.ZodString;
1513
+ state: z.ZodEnum<["visible", "present", "absent"]>;
1514
+ }, "strip", z.ZodTypeAny, {
1515
+ type: "anchor_visible";
1516
+ anchorId: string;
1517
+ state: "visible" | "present" | "absent";
1518
+ }, {
1519
+ type: "anchor_visible";
1520
+ anchorId: string;
1521
+ state: "visible" | "present" | "absent";
1522
+ }>, z.ZodObject<{
1523
+ type: z.ZodLiteral<"event_occurred">;
1524
+ eventName: z.ZodString;
1525
+ withinMs: z.ZodOptional<z.ZodNumber>;
1526
+ }, "strip", z.ZodTypeAny, {
1527
+ type: "event_occurred";
1528
+ eventName: string;
1529
+ withinMs?: number | undefined;
1530
+ }, {
1531
+ type: "event_occurred";
1532
+ eventName: string;
1533
+ withinMs?: number | undefined;
1534
+ }>, z.ZodObject<{
1535
+ type: z.ZodLiteral<"state_equals">;
1536
+ key: z.ZodString;
1537
+ value: z.ZodUnknown;
1538
+ }, "strip", z.ZodTypeAny, {
1539
+ type: "state_equals";
1540
+ key: string;
1541
+ value?: unknown;
1542
+ }, {
1543
+ type: "state_equals";
1544
+ key: string;
1545
+ value?: unknown;
1546
+ }>, z.ZodObject<{
1547
+ type: z.ZodLiteral<"viewport">;
1548
+ minWidth: z.ZodOptional<z.ZodNumber>;
1549
+ maxWidth: z.ZodOptional<z.ZodNumber>;
1550
+ minHeight: z.ZodOptional<z.ZodNumber>;
1551
+ maxHeight: z.ZodOptional<z.ZodNumber>;
1552
+ }, "strip", z.ZodTypeAny, {
1553
+ type: "viewport";
1554
+ minWidth?: number | undefined;
1555
+ maxWidth?: number | undefined;
1556
+ minHeight?: number | undefined;
1557
+ maxHeight?: number | undefined;
1558
+ }, {
1559
+ type: "viewport";
1560
+ minWidth?: number | undefined;
1561
+ maxWidth?: number | undefined;
1562
+ minHeight?: number | undefined;
1563
+ maxHeight?: number | undefined;
1564
+ }>, z.ZodObject<{
1565
+ type: z.ZodLiteral<"session_metric">;
1566
+ key: z.ZodString;
1567
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
1568
+ threshold: z.ZodNumber;
1569
+ }, "strip", z.ZodTypeAny, {
1570
+ type: "session_metric";
1571
+ key: string;
1572
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1573
+ threshold: number;
1574
+ }, {
1575
+ type: "session_metric";
1576
+ key: string;
1577
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1578
+ threshold: number;
1579
+ }>, z.ZodObject<{
1580
+ type: z.ZodLiteral<"dismissed">;
1581
+ key: z.ZodString;
1582
+ inverted: z.ZodOptional<z.ZodBoolean>;
1583
+ }, "strip", z.ZodTypeAny, {
1584
+ type: "dismissed";
1585
+ key: string;
1586
+ inverted?: boolean | undefined;
1587
+ }, {
1588
+ type: "dismissed";
1589
+ key: string;
1590
+ inverted?: boolean | undefined;
1591
+ }>, z.ZodObject<{
1592
+ type: z.ZodLiteral<"cooldown_active">;
1593
+ key: z.ZodString;
1594
+ inverted: z.ZodOptional<z.ZodBoolean>;
1595
+ }, "strip", z.ZodTypeAny, {
1596
+ type: "cooldown_active";
1597
+ key: string;
1598
+ inverted?: boolean | undefined;
1599
+ }, {
1600
+ type: "cooldown_active";
1601
+ key: string;
1602
+ inverted?: boolean | undefined;
1603
+ }>, z.ZodObject<{
1604
+ type: z.ZodLiteral<"frequency_limit">;
1605
+ key: z.ZodString;
1606
+ limit: z.ZodNumber;
1607
+ inverted: z.ZodOptional<z.ZodBoolean>;
1608
+ }, "strip", z.ZodTypeAny, {
1609
+ type: "frequency_limit";
1610
+ key: string;
1611
+ limit: number;
1612
+ inverted?: boolean | undefined;
1613
+ }, {
1614
+ type: "frequency_limit";
1615
+ key: string;
1616
+ limit: number;
1617
+ inverted?: boolean | undefined;
1618
+ }>, z.ZodObject<{
1619
+ type: z.ZodLiteral<"event_count">;
1620
+ key: z.ZodString;
1621
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
1622
+ count: z.ZodNumber;
1623
+ withinMs: z.ZodOptional<z.ZodNumber>;
1624
+ counter: z.ZodOptional<z.ZodObject<{
1625
+ events: z.ZodArray<z.ZodString, "many">;
1626
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1627
+ equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
1628
+ contains: z.ZodOptional<z.ZodString>;
1629
+ }, "strip", z.ZodTypeAny, {
1630
+ equals?: string | number | boolean | undefined;
1631
+ contains?: string | undefined;
1632
+ }, {
1633
+ equals?: string | number | boolean | undefined;
1634
+ contains?: string | undefined;
1635
+ }>>>;
1636
+ }, "strip", z.ZodTypeAny, {
1637
+ events: string[];
1638
+ match?: Record<string, {
1639
+ equals?: string | number | boolean | undefined;
1640
+ contains?: string | undefined;
1641
+ }> | undefined;
1642
+ }, {
1643
+ events: string[];
1644
+ match?: Record<string, {
1645
+ equals?: string | number | boolean | undefined;
1646
+ contains?: string | undefined;
1647
+ }> | undefined;
1648
+ }>>;
1649
+ }, "strip", z.ZodTypeAny, {
1650
+ type: "event_count";
1651
+ key: string;
1652
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1653
+ count: number;
1654
+ withinMs?: number | undefined;
1655
+ counter?: {
1656
+ events: string[];
1657
+ match?: Record<string, {
1658
+ equals?: string | number | boolean | undefined;
1659
+ contains?: string | undefined;
1660
+ }> | undefined;
1661
+ } | undefined;
1662
+ }, {
1663
+ type: "event_count";
1664
+ key: string;
1665
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1666
+ count: number;
1667
+ withinMs?: number | undefined;
1668
+ counter?: {
1669
+ events: string[];
1670
+ match?: Record<string, {
1671
+ equals?: string | number | boolean | undefined;
1672
+ contains?: string | undefined;
1673
+ }> | undefined;
1674
+ } | undefined;
1675
+ }>]>, "many">;
172
1676
  value: z.ZodUnknown;
173
1677
  }, "strip", z.ZodTypeAny, {
174
- conditions: z.objectOutputType<{
175
- type: z.ZodString;
176
- }, z.ZodTypeAny, "passthrough">[];
1678
+ conditions: ({
1679
+ type: "page_url";
1680
+ url: string;
1681
+ } | {
1682
+ type: "route";
1683
+ routeId: string;
1684
+ } | {
1685
+ type: "anchor_visible";
1686
+ anchorId: string;
1687
+ state: "visible" | "present" | "absent";
1688
+ } | {
1689
+ type: "event_occurred";
1690
+ eventName: string;
1691
+ withinMs?: number | undefined;
1692
+ } | {
1693
+ type: "state_equals";
1694
+ key: string;
1695
+ value?: unknown;
1696
+ } | {
1697
+ type: "viewport";
1698
+ minWidth?: number | undefined;
1699
+ maxWidth?: number | undefined;
1700
+ minHeight?: number | undefined;
1701
+ maxHeight?: number | undefined;
1702
+ } | {
1703
+ type: "session_metric";
1704
+ key: string;
1705
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1706
+ threshold: number;
1707
+ } | {
1708
+ type: "dismissed";
1709
+ key: string;
1710
+ inverted?: boolean | undefined;
1711
+ } | {
1712
+ type: "cooldown_active";
1713
+ key: string;
1714
+ inverted?: boolean | undefined;
1715
+ } | {
1716
+ type: "frequency_limit";
1717
+ key: string;
1718
+ limit: number;
1719
+ inverted?: boolean | undefined;
1720
+ } | {
1721
+ type: "event_count";
1722
+ key: string;
1723
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1724
+ count: number;
1725
+ withinMs?: number | undefined;
1726
+ counter?: {
1727
+ events: string[];
1728
+ match?: Record<string, {
1729
+ equals?: string | number | boolean | undefined;
1730
+ contains?: string | undefined;
1731
+ }> | undefined;
1732
+ } | undefined;
1733
+ })[];
177
1734
  value?: unknown;
178
1735
  }, {
179
- conditions: z.objectInputType<{
180
- type: z.ZodString;
181
- }, z.ZodTypeAny, "passthrough">[];
1736
+ conditions: ({
1737
+ type: "page_url";
1738
+ url: string;
1739
+ } | {
1740
+ type: "route";
1741
+ routeId: string;
1742
+ } | {
1743
+ type: "anchor_visible";
1744
+ anchorId: string;
1745
+ state: "visible" | "present" | "absent";
1746
+ } | {
1747
+ type: "event_occurred";
1748
+ eventName: string;
1749
+ withinMs?: number | undefined;
1750
+ } | {
1751
+ type: "state_equals";
1752
+ key: string;
1753
+ value?: unknown;
1754
+ } | {
1755
+ type: "viewport";
1756
+ minWidth?: number | undefined;
1757
+ maxWidth?: number | undefined;
1758
+ minHeight?: number | undefined;
1759
+ maxHeight?: number | undefined;
1760
+ } | {
1761
+ type: "session_metric";
1762
+ key: string;
1763
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1764
+ threshold: number;
1765
+ } | {
1766
+ type: "dismissed";
1767
+ key: string;
1768
+ inverted?: boolean | undefined;
1769
+ } | {
1770
+ type: "cooldown_active";
1771
+ key: string;
1772
+ inverted?: boolean | undefined;
1773
+ } | {
1774
+ type: "frequency_limit";
1775
+ key: string;
1776
+ limit: number;
1777
+ inverted?: boolean | undefined;
1778
+ } | {
1779
+ type: "event_count";
1780
+ key: string;
1781
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1782
+ count: number;
1783
+ withinMs?: number | undefined;
1784
+ counter?: {
1785
+ events: string[];
1786
+ match?: Record<string, {
1787
+ equals?: string | number | boolean | undefined;
1788
+ contains?: string | undefined;
1789
+ }> | undefined;
1790
+ } | undefined;
1791
+ })[];
182
1792
  value?: unknown;
183
1793
  }>, "many">;
184
1794
  default: z.ZodUnknown;
185
1795
  }, "strip", z.ZodTypeAny, {
186
1796
  type: "rules";
187
1797
  rules: {
188
- conditions: z.objectOutputType<{
189
- type: z.ZodString;
190
- }, z.ZodTypeAny, "passthrough">[];
1798
+ conditions: ({
1799
+ type: "page_url";
1800
+ url: string;
1801
+ } | {
1802
+ type: "route";
1803
+ routeId: string;
1804
+ } | {
1805
+ type: "anchor_visible";
1806
+ anchorId: string;
1807
+ state: "visible" | "present" | "absent";
1808
+ } | {
1809
+ type: "event_occurred";
1810
+ eventName: string;
1811
+ withinMs?: number | undefined;
1812
+ } | {
1813
+ type: "state_equals";
1814
+ key: string;
1815
+ value?: unknown;
1816
+ } | {
1817
+ type: "viewport";
1818
+ minWidth?: number | undefined;
1819
+ maxWidth?: number | undefined;
1820
+ minHeight?: number | undefined;
1821
+ maxHeight?: number | undefined;
1822
+ } | {
1823
+ type: "session_metric";
1824
+ key: string;
1825
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1826
+ threshold: number;
1827
+ } | {
1828
+ type: "dismissed";
1829
+ key: string;
1830
+ inverted?: boolean | undefined;
1831
+ } | {
1832
+ type: "cooldown_active";
1833
+ key: string;
1834
+ inverted?: boolean | undefined;
1835
+ } | {
1836
+ type: "frequency_limit";
1837
+ key: string;
1838
+ limit: number;
1839
+ inverted?: boolean | undefined;
1840
+ } | {
1841
+ type: "event_count";
1842
+ key: string;
1843
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1844
+ count: number;
1845
+ withinMs?: number | undefined;
1846
+ counter?: {
1847
+ events: string[];
1848
+ match?: Record<string, {
1849
+ equals?: string | number | boolean | undefined;
1850
+ contains?: string | undefined;
1851
+ }> | undefined;
1852
+ } | undefined;
1853
+ })[];
191
1854
  value?: unknown;
192
1855
  }[];
193
1856
  default?: unknown;
194
1857
  }, {
195
1858
  type: "rules";
196
1859
  rules: {
197
- conditions: z.objectInputType<{
198
- type: z.ZodString;
199
- }, z.ZodTypeAny, "passthrough">[];
1860
+ conditions: ({
1861
+ type: "page_url";
1862
+ url: string;
1863
+ } | {
1864
+ type: "route";
1865
+ routeId: string;
1866
+ } | {
1867
+ type: "anchor_visible";
1868
+ anchorId: string;
1869
+ state: "visible" | "present" | "absent";
1870
+ } | {
1871
+ type: "event_occurred";
1872
+ eventName: string;
1873
+ withinMs?: number | undefined;
1874
+ } | {
1875
+ type: "state_equals";
1876
+ key: string;
1877
+ value?: unknown;
1878
+ } | {
1879
+ type: "viewport";
1880
+ minWidth?: number | undefined;
1881
+ maxWidth?: number | undefined;
1882
+ minHeight?: number | undefined;
1883
+ maxHeight?: number | undefined;
1884
+ } | {
1885
+ type: "session_metric";
1886
+ key: string;
1887
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1888
+ threshold: number;
1889
+ } | {
1890
+ type: "dismissed";
1891
+ key: string;
1892
+ inverted?: boolean | undefined;
1893
+ } | {
1894
+ type: "cooldown_active";
1895
+ key: string;
1896
+ inverted?: boolean | undefined;
1897
+ } | {
1898
+ type: "frequency_limit";
1899
+ key: string;
1900
+ limit: number;
1901
+ inverted?: boolean | undefined;
1902
+ } | {
1903
+ type: "event_count";
1904
+ key: string;
1905
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
1906
+ count: number;
1907
+ withinMs?: number | undefined;
1908
+ counter?: {
1909
+ events: string[];
1910
+ match?: Record<string, {
1911
+ equals?: string | number | boolean | undefined;
1912
+ contains?: string | undefined;
1913
+ }> | undefined;
1914
+ } | undefined;
1915
+ })[];
200
1916
  value?: unknown;
201
1917
  }[];
202
1918
  default?: unknown;
@@ -208,14 +1924,14 @@ export declare const AwardBadgeSchema: z.ZodObject<{
208
1924
  below: z.ZodUnknown;
209
1925
  }, "strip", z.ZodTypeAny, {
210
1926
  type: "score";
211
- field: string;
212
1927
  threshold: number;
1928
+ field: string;
213
1929
  above?: unknown;
214
1930
  below?: unknown;
215
1931
  }, {
216
1932
  type: "score";
217
- field: string;
218
1933
  threshold: number;
1934
+ field: string;
219
1935
  above?: unknown;
220
1936
  below?: unknown;
221
1937
  }>, z.ZodObject<{
@@ -254,97 +1970,78 @@ export declare const AwardBadgeSchema: z.ZodObject<{
254
1970
  default?: unknown;
255
1971
  method?: "GET" | "POST" | undefined;
256
1972
  timeoutMs?: number | undefined;
257
- }>]>>;
1973
+ }>]>>>;
258
1974
  }, "strip", z.ZodTypeAny, {
259
- routes: {
260
- include?: string[] | undefined;
261
- exclude?: string[] | undefined;
262
- };
263
- strategy?: {
264
- type: "rules";
265
- rules: {
266
- conditions: z.objectOutputType<{
267
- type: z.ZodString;
268
- }, z.ZodTypeAny, "passthrough">[];
269
- value?: unknown;
270
- }[];
271
- default?: unknown;
272
- } | {
273
- type: "score";
274
- field: string;
275
- threshold: number;
276
- above?: unknown;
277
- below?: unknown;
278
- } | {
279
- type: "model";
280
- modelId: string;
281
- inputs: string[];
282
- outputMapping: Record<string, unknown>;
283
- default?: unknown;
284
- } | {
285
- type: "external";
286
- endpoint: string;
287
- default?: unknown;
288
- method?: "GET" | "POST" | undefined;
289
- timeoutMs?: number | undefined;
290
- } | undefined;
291
- }, {
292
- routes: {
293
- include?: string[] | undefined;
294
- exclude?: string[] | undefined;
295
- };
296
- strategy?: {
1975
+ badgeId: string;
1976
+ kind: "gamification:awardBadge";
1977
+ anchorId?: string | undefined;
1978
+ label?: string | undefined;
1979
+ triggerWhen?: {
297
1980
  type: "rules";
298
1981
  rules: {
299
- conditions: z.objectInputType<{
300
- type: z.ZodString;
301
- }, z.ZodTypeAny, "passthrough">[];
1982
+ conditions: ({
1983
+ type: "page_url";
1984
+ url: string;
1985
+ } | {
1986
+ type: "route";
1987
+ routeId: string;
1988
+ } | {
1989
+ type: "anchor_visible";
1990
+ anchorId: string;
1991
+ state: "visible" | "present" | "absent";
1992
+ } | {
1993
+ type: "event_occurred";
1994
+ eventName: string;
1995
+ withinMs?: number | undefined;
1996
+ } | {
1997
+ type: "state_equals";
1998
+ key: string;
1999
+ value?: unknown;
2000
+ } | {
2001
+ type: "viewport";
2002
+ minWidth?: number | undefined;
2003
+ maxWidth?: number | undefined;
2004
+ minHeight?: number | undefined;
2005
+ maxHeight?: number | undefined;
2006
+ } | {
2007
+ type: "session_metric";
2008
+ key: string;
2009
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2010
+ threshold: number;
2011
+ } | {
2012
+ type: "dismissed";
2013
+ key: string;
2014
+ inverted?: boolean | undefined;
2015
+ } | {
2016
+ type: "cooldown_active";
2017
+ key: string;
2018
+ inverted?: boolean | undefined;
2019
+ } | {
2020
+ type: "frequency_limit";
2021
+ key: string;
2022
+ limit: number;
2023
+ inverted?: boolean | undefined;
2024
+ } | {
2025
+ type: "event_count";
2026
+ key: string;
2027
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2028
+ count: number;
2029
+ withinMs?: number | undefined;
2030
+ counter?: {
2031
+ events: string[];
2032
+ match?: Record<string, {
2033
+ equals?: string | number | boolean | undefined;
2034
+ contains?: string | undefined;
2035
+ }> | undefined;
2036
+ } | undefined;
2037
+ })[];
302
2038
  value?: unknown;
303
2039
  }[];
304
2040
  default?: unknown;
305
2041
  } | {
306
2042
  type: "score";
307
- field: string;
308
2043
  threshold: number;
309
- above?: unknown;
310
- below?: unknown;
311
- } | {
312
- type: "model";
313
- modelId: string;
314
- inputs: string[];
315
- outputMapping: Record<string, unknown>;
316
- default?: unknown;
317
- } | {
318
- type: "external";
319
- endpoint: string;
320
- default?: unknown;
321
- method?: "GET" | "POST" | undefined;
322
- timeoutMs?: number | undefined;
323
- } | undefined;
324
- }>>;
325
- }, "strip", z.ZodTypeAny, {
326
- badgeId: string;
327
- kind: "gamification:awardBadge";
328
- anchorId?: string | undefined;
329
- label?: string | undefined;
330
- activation?: {
331
- routes: {
332
- include?: string[] | undefined;
333
- exclude?: string[] | undefined;
334
- };
335
- strategy?: {
336
- type: "rules";
337
- rules: {
338
- conditions: z.objectOutputType<{
339
- type: z.ZodString;
340
- }, z.ZodTypeAny, "passthrough">[];
341
- value?: unknown;
342
- }[];
343
- default?: unknown;
344
- } | {
345
- type: "score";
346
2044
  field: string;
347
- threshold: number;
348
2045
  above?: unknown;
349
2046
  below?: unknown;
350
2047
  } | {
@@ -359,31 +2056,78 @@ export declare const AwardBadgeSchema: z.ZodObject<{
359
2056
  default?: unknown;
360
2057
  method?: "GET" | "POST" | undefined;
361
2058
  timeoutMs?: number | undefined;
362
- } | undefined;
363
- } | undefined;
364
- }, {
365
- badgeId: string;
366
- kind: "gamification:awardBadge";
367
- anchorId?: string | undefined;
368
- label?: string | undefined;
369
- activation?: {
370
- routes: {
371
- include?: string[] | undefined;
372
- exclude?: string[] | undefined;
373
- };
374
- strategy?: {
2059
+ } | null | undefined;
2060
+ }, {
2061
+ badgeId: string;
2062
+ kind: "gamification:awardBadge";
2063
+ anchorId?: string | undefined;
2064
+ label?: string | undefined;
2065
+ triggerWhen?: {
375
2066
  type: "rules";
376
2067
  rules: {
377
- conditions: z.objectInputType<{
378
- type: z.ZodString;
379
- }, z.ZodTypeAny, "passthrough">[];
2068
+ conditions: ({
2069
+ type: "page_url";
2070
+ url: string;
2071
+ } | {
2072
+ type: "route";
2073
+ routeId: string;
2074
+ } | {
2075
+ type: "anchor_visible";
2076
+ anchorId: string;
2077
+ state: "visible" | "present" | "absent";
2078
+ } | {
2079
+ type: "event_occurred";
2080
+ eventName: string;
2081
+ withinMs?: number | undefined;
2082
+ } | {
2083
+ type: "state_equals";
2084
+ key: string;
2085
+ value?: unknown;
2086
+ } | {
2087
+ type: "viewport";
2088
+ minWidth?: number | undefined;
2089
+ maxWidth?: number | undefined;
2090
+ minHeight?: number | undefined;
2091
+ maxHeight?: number | undefined;
2092
+ } | {
2093
+ type: "session_metric";
2094
+ key: string;
2095
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2096
+ threshold: number;
2097
+ } | {
2098
+ type: "dismissed";
2099
+ key: string;
2100
+ inverted?: boolean | undefined;
2101
+ } | {
2102
+ type: "cooldown_active";
2103
+ key: string;
2104
+ inverted?: boolean | undefined;
2105
+ } | {
2106
+ type: "frequency_limit";
2107
+ key: string;
2108
+ limit: number;
2109
+ inverted?: boolean | undefined;
2110
+ } | {
2111
+ type: "event_count";
2112
+ key: string;
2113
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2114
+ count: number;
2115
+ withinMs?: number | undefined;
2116
+ counter?: {
2117
+ events: string[];
2118
+ match?: Record<string, {
2119
+ equals?: string | number | boolean | undefined;
2120
+ contains?: string | undefined;
2121
+ }> | undefined;
2122
+ } | undefined;
2123
+ })[];
380
2124
  value?: unknown;
381
2125
  }[];
382
2126
  default?: unknown;
383
2127
  } | {
384
2128
  type: "score";
385
- field: string;
386
2129
  threshold: number;
2130
+ field: string;
387
2131
  above?: unknown;
388
2132
  below?: unknown;
389
2133
  } | {
@@ -398,67 +2142,443 @@ export declare const AwardBadgeSchema: z.ZodObject<{
398
2142
  default?: unknown;
399
2143
  method?: "GET" | "POST" | undefined;
400
2144
  timeoutMs?: number | undefined;
401
- } | undefined;
402
- } | undefined;
403
- }>;
404
- /**
405
- * Schema for adding points to a user's score.
406
- */
407
- export declare const AddPointsSchema: z.ZodObject<{
408
- kind: z.ZodLiteral<"gamification:addPoints">;
409
- points: z.ZodNumber;
410
- reason: z.ZodOptional<z.ZodString>;
411
- label: z.ZodOptional<z.ZodString>;
412
- } & {
413
- activation: z.ZodOptional<z.ZodObject<{
414
- routes: z.ZodObject<{
415
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
416
- exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
417
- }, "strip", z.ZodTypeAny, {
418
- include?: string[] | undefined;
419
- exclude?: string[] | undefined;
420
- }, {
421
- include?: string[] | undefined;
422
- exclude?: string[] | undefined;
423
- }>;
424
- strategy: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2145
+ } | null | undefined;
2146
+ }>;
2147
+ } | {
2148
+ defName: string;
2149
+ schema: z.ZodObject<{
2150
+ kind: z.ZodLiteral<"gamification:addPoints">;
2151
+ points: z.ZodNumber;
2152
+ reason: z.ZodOptional<z.ZodString>;
2153
+ label: z.ZodOptional<z.ZodString>;
2154
+ } & {
2155
+ triggerWhen: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
425
2156
  type: z.ZodLiteral<"rules">;
426
2157
  rules: z.ZodArray<z.ZodObject<{
427
- conditions: z.ZodArray<z.ZodObject<{
428
- type: z.ZodString;
429
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
430
- type: z.ZodString;
431
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
432
- type: z.ZodString;
433
- }, z.ZodTypeAny, "passthrough">>, "many">;
2158
+ conditions: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2159
+ type: z.ZodLiteral<"page_url">;
2160
+ url: z.ZodString;
2161
+ }, "strip", z.ZodTypeAny, {
2162
+ type: "page_url";
2163
+ url: string;
2164
+ }, {
2165
+ type: "page_url";
2166
+ url: string;
2167
+ }>, z.ZodObject<{
2168
+ type: z.ZodLiteral<"route">;
2169
+ routeId: z.ZodString;
2170
+ }, "strip", z.ZodTypeAny, {
2171
+ type: "route";
2172
+ routeId: string;
2173
+ }, {
2174
+ type: "route";
2175
+ routeId: string;
2176
+ }>, z.ZodObject<{
2177
+ type: z.ZodLiteral<"anchor_visible">;
2178
+ anchorId: z.ZodString;
2179
+ state: z.ZodEnum<["visible", "present", "absent"]>;
2180
+ }, "strip", z.ZodTypeAny, {
2181
+ type: "anchor_visible";
2182
+ anchorId: string;
2183
+ state: "visible" | "present" | "absent";
2184
+ }, {
2185
+ type: "anchor_visible";
2186
+ anchorId: string;
2187
+ state: "visible" | "present" | "absent";
2188
+ }>, z.ZodObject<{
2189
+ type: z.ZodLiteral<"event_occurred">;
2190
+ eventName: z.ZodString;
2191
+ withinMs: z.ZodOptional<z.ZodNumber>;
2192
+ }, "strip", z.ZodTypeAny, {
2193
+ type: "event_occurred";
2194
+ eventName: string;
2195
+ withinMs?: number | undefined;
2196
+ }, {
2197
+ type: "event_occurred";
2198
+ eventName: string;
2199
+ withinMs?: number | undefined;
2200
+ }>, z.ZodObject<{
2201
+ type: z.ZodLiteral<"state_equals">;
2202
+ key: z.ZodString;
2203
+ value: z.ZodUnknown;
2204
+ }, "strip", z.ZodTypeAny, {
2205
+ type: "state_equals";
2206
+ key: string;
2207
+ value?: unknown;
2208
+ }, {
2209
+ type: "state_equals";
2210
+ key: string;
2211
+ value?: unknown;
2212
+ }>, z.ZodObject<{
2213
+ type: z.ZodLiteral<"viewport">;
2214
+ minWidth: z.ZodOptional<z.ZodNumber>;
2215
+ maxWidth: z.ZodOptional<z.ZodNumber>;
2216
+ minHeight: z.ZodOptional<z.ZodNumber>;
2217
+ maxHeight: z.ZodOptional<z.ZodNumber>;
2218
+ }, "strip", z.ZodTypeAny, {
2219
+ type: "viewport";
2220
+ minWidth?: number | undefined;
2221
+ maxWidth?: number | undefined;
2222
+ minHeight?: number | undefined;
2223
+ maxHeight?: number | undefined;
2224
+ }, {
2225
+ type: "viewport";
2226
+ minWidth?: number | undefined;
2227
+ maxWidth?: number | undefined;
2228
+ minHeight?: number | undefined;
2229
+ maxHeight?: number | undefined;
2230
+ }>, z.ZodObject<{
2231
+ type: z.ZodLiteral<"session_metric">;
2232
+ key: z.ZodString;
2233
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
2234
+ threshold: z.ZodNumber;
2235
+ }, "strip", z.ZodTypeAny, {
2236
+ type: "session_metric";
2237
+ key: string;
2238
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2239
+ threshold: number;
2240
+ }, {
2241
+ type: "session_metric";
2242
+ key: string;
2243
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2244
+ threshold: number;
2245
+ }>, z.ZodObject<{
2246
+ type: z.ZodLiteral<"dismissed">;
2247
+ key: z.ZodString;
2248
+ inverted: z.ZodOptional<z.ZodBoolean>;
2249
+ }, "strip", z.ZodTypeAny, {
2250
+ type: "dismissed";
2251
+ key: string;
2252
+ inverted?: boolean | undefined;
2253
+ }, {
2254
+ type: "dismissed";
2255
+ key: string;
2256
+ inverted?: boolean | undefined;
2257
+ }>, z.ZodObject<{
2258
+ type: z.ZodLiteral<"cooldown_active">;
2259
+ key: z.ZodString;
2260
+ inverted: z.ZodOptional<z.ZodBoolean>;
2261
+ }, "strip", z.ZodTypeAny, {
2262
+ type: "cooldown_active";
2263
+ key: string;
2264
+ inverted?: boolean | undefined;
2265
+ }, {
2266
+ type: "cooldown_active";
2267
+ key: string;
2268
+ inverted?: boolean | undefined;
2269
+ }>, z.ZodObject<{
2270
+ type: z.ZodLiteral<"frequency_limit">;
2271
+ key: z.ZodString;
2272
+ limit: z.ZodNumber;
2273
+ inverted: z.ZodOptional<z.ZodBoolean>;
2274
+ }, "strip", z.ZodTypeAny, {
2275
+ type: "frequency_limit";
2276
+ key: string;
2277
+ limit: number;
2278
+ inverted?: boolean | undefined;
2279
+ }, {
2280
+ type: "frequency_limit";
2281
+ key: string;
2282
+ limit: number;
2283
+ inverted?: boolean | undefined;
2284
+ }>, z.ZodObject<{
2285
+ type: z.ZodLiteral<"event_count">;
2286
+ key: z.ZodString;
2287
+ operator: z.ZodEnum<["gte", "lte", "eq", "gt", "lt"]>;
2288
+ count: z.ZodNumber;
2289
+ withinMs: z.ZodOptional<z.ZodNumber>;
2290
+ counter: z.ZodOptional<z.ZodObject<{
2291
+ events: z.ZodArray<z.ZodString, "many">;
2292
+ match: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
2293
+ equals: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
2294
+ contains: z.ZodOptional<z.ZodString>;
2295
+ }, "strip", z.ZodTypeAny, {
2296
+ equals?: string | number | boolean | undefined;
2297
+ contains?: string | undefined;
2298
+ }, {
2299
+ equals?: string | number | boolean | undefined;
2300
+ contains?: string | undefined;
2301
+ }>>>;
2302
+ }, "strip", z.ZodTypeAny, {
2303
+ events: string[];
2304
+ match?: Record<string, {
2305
+ equals?: string | number | boolean | undefined;
2306
+ contains?: string | undefined;
2307
+ }> | undefined;
2308
+ }, {
2309
+ events: string[];
2310
+ match?: Record<string, {
2311
+ equals?: string | number | boolean | undefined;
2312
+ contains?: string | undefined;
2313
+ }> | undefined;
2314
+ }>>;
2315
+ }, "strip", z.ZodTypeAny, {
2316
+ type: "event_count";
2317
+ key: string;
2318
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2319
+ count: number;
2320
+ withinMs?: number | undefined;
2321
+ counter?: {
2322
+ events: string[];
2323
+ match?: Record<string, {
2324
+ equals?: string | number | boolean | undefined;
2325
+ contains?: string | undefined;
2326
+ }> | undefined;
2327
+ } | undefined;
2328
+ }, {
2329
+ type: "event_count";
2330
+ key: string;
2331
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2332
+ count: number;
2333
+ withinMs?: number | undefined;
2334
+ counter?: {
2335
+ events: string[];
2336
+ match?: Record<string, {
2337
+ equals?: string | number | boolean | undefined;
2338
+ contains?: string | undefined;
2339
+ }> | undefined;
2340
+ } | undefined;
2341
+ }>]>, "many">;
434
2342
  value: z.ZodUnknown;
435
2343
  }, "strip", z.ZodTypeAny, {
436
- conditions: z.objectOutputType<{
437
- type: z.ZodString;
438
- }, z.ZodTypeAny, "passthrough">[];
2344
+ conditions: ({
2345
+ type: "page_url";
2346
+ url: string;
2347
+ } | {
2348
+ type: "route";
2349
+ routeId: string;
2350
+ } | {
2351
+ type: "anchor_visible";
2352
+ anchorId: string;
2353
+ state: "visible" | "present" | "absent";
2354
+ } | {
2355
+ type: "event_occurred";
2356
+ eventName: string;
2357
+ withinMs?: number | undefined;
2358
+ } | {
2359
+ type: "state_equals";
2360
+ key: string;
2361
+ value?: unknown;
2362
+ } | {
2363
+ type: "viewport";
2364
+ minWidth?: number | undefined;
2365
+ maxWidth?: number | undefined;
2366
+ minHeight?: number | undefined;
2367
+ maxHeight?: number | undefined;
2368
+ } | {
2369
+ type: "session_metric";
2370
+ key: string;
2371
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2372
+ threshold: number;
2373
+ } | {
2374
+ type: "dismissed";
2375
+ key: string;
2376
+ inverted?: boolean | undefined;
2377
+ } | {
2378
+ type: "cooldown_active";
2379
+ key: string;
2380
+ inverted?: boolean | undefined;
2381
+ } | {
2382
+ type: "frequency_limit";
2383
+ key: string;
2384
+ limit: number;
2385
+ inverted?: boolean | undefined;
2386
+ } | {
2387
+ type: "event_count";
2388
+ key: string;
2389
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2390
+ count: number;
2391
+ withinMs?: number | undefined;
2392
+ counter?: {
2393
+ events: string[];
2394
+ match?: Record<string, {
2395
+ equals?: string | number | boolean | undefined;
2396
+ contains?: string | undefined;
2397
+ }> | undefined;
2398
+ } | undefined;
2399
+ })[];
439
2400
  value?: unknown;
440
2401
  }, {
441
- conditions: z.objectInputType<{
442
- type: z.ZodString;
443
- }, z.ZodTypeAny, "passthrough">[];
2402
+ conditions: ({
2403
+ type: "page_url";
2404
+ url: string;
2405
+ } | {
2406
+ type: "route";
2407
+ routeId: string;
2408
+ } | {
2409
+ type: "anchor_visible";
2410
+ anchorId: string;
2411
+ state: "visible" | "present" | "absent";
2412
+ } | {
2413
+ type: "event_occurred";
2414
+ eventName: string;
2415
+ withinMs?: number | undefined;
2416
+ } | {
2417
+ type: "state_equals";
2418
+ key: string;
2419
+ value?: unknown;
2420
+ } | {
2421
+ type: "viewport";
2422
+ minWidth?: number | undefined;
2423
+ maxWidth?: number | undefined;
2424
+ minHeight?: number | undefined;
2425
+ maxHeight?: number | undefined;
2426
+ } | {
2427
+ type: "session_metric";
2428
+ key: string;
2429
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2430
+ threshold: number;
2431
+ } | {
2432
+ type: "dismissed";
2433
+ key: string;
2434
+ inverted?: boolean | undefined;
2435
+ } | {
2436
+ type: "cooldown_active";
2437
+ key: string;
2438
+ inverted?: boolean | undefined;
2439
+ } | {
2440
+ type: "frequency_limit";
2441
+ key: string;
2442
+ limit: number;
2443
+ inverted?: boolean | undefined;
2444
+ } | {
2445
+ type: "event_count";
2446
+ key: string;
2447
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2448
+ count: number;
2449
+ withinMs?: number | undefined;
2450
+ counter?: {
2451
+ events: string[];
2452
+ match?: Record<string, {
2453
+ equals?: string | number | boolean | undefined;
2454
+ contains?: string | undefined;
2455
+ }> | undefined;
2456
+ } | undefined;
2457
+ })[];
444
2458
  value?: unknown;
445
2459
  }>, "many">;
446
2460
  default: z.ZodUnknown;
447
2461
  }, "strip", z.ZodTypeAny, {
448
2462
  type: "rules";
449
2463
  rules: {
450
- conditions: z.objectOutputType<{
451
- type: z.ZodString;
452
- }, z.ZodTypeAny, "passthrough">[];
2464
+ conditions: ({
2465
+ type: "page_url";
2466
+ url: string;
2467
+ } | {
2468
+ type: "route";
2469
+ routeId: string;
2470
+ } | {
2471
+ type: "anchor_visible";
2472
+ anchorId: string;
2473
+ state: "visible" | "present" | "absent";
2474
+ } | {
2475
+ type: "event_occurred";
2476
+ eventName: string;
2477
+ withinMs?: number | undefined;
2478
+ } | {
2479
+ type: "state_equals";
2480
+ key: string;
2481
+ value?: unknown;
2482
+ } | {
2483
+ type: "viewport";
2484
+ minWidth?: number | undefined;
2485
+ maxWidth?: number | undefined;
2486
+ minHeight?: number | undefined;
2487
+ maxHeight?: number | undefined;
2488
+ } | {
2489
+ type: "session_metric";
2490
+ key: string;
2491
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2492
+ threshold: number;
2493
+ } | {
2494
+ type: "dismissed";
2495
+ key: string;
2496
+ inverted?: boolean | undefined;
2497
+ } | {
2498
+ type: "cooldown_active";
2499
+ key: string;
2500
+ inverted?: boolean | undefined;
2501
+ } | {
2502
+ type: "frequency_limit";
2503
+ key: string;
2504
+ limit: number;
2505
+ inverted?: boolean | undefined;
2506
+ } | {
2507
+ type: "event_count";
2508
+ key: string;
2509
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2510
+ count: number;
2511
+ withinMs?: number | undefined;
2512
+ counter?: {
2513
+ events: string[];
2514
+ match?: Record<string, {
2515
+ equals?: string | number | boolean | undefined;
2516
+ contains?: string | undefined;
2517
+ }> | undefined;
2518
+ } | undefined;
2519
+ })[];
453
2520
  value?: unknown;
454
2521
  }[];
455
2522
  default?: unknown;
456
2523
  }, {
457
2524
  type: "rules";
458
2525
  rules: {
459
- conditions: z.objectInputType<{
460
- type: z.ZodString;
461
- }, z.ZodTypeAny, "passthrough">[];
2526
+ conditions: ({
2527
+ type: "page_url";
2528
+ url: string;
2529
+ } | {
2530
+ type: "route";
2531
+ routeId: string;
2532
+ } | {
2533
+ type: "anchor_visible";
2534
+ anchorId: string;
2535
+ state: "visible" | "present" | "absent";
2536
+ } | {
2537
+ type: "event_occurred";
2538
+ eventName: string;
2539
+ withinMs?: number | undefined;
2540
+ } | {
2541
+ type: "state_equals";
2542
+ key: string;
2543
+ value?: unknown;
2544
+ } | {
2545
+ type: "viewport";
2546
+ minWidth?: number | undefined;
2547
+ maxWidth?: number | undefined;
2548
+ minHeight?: number | undefined;
2549
+ maxHeight?: number | undefined;
2550
+ } | {
2551
+ type: "session_metric";
2552
+ key: string;
2553
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2554
+ threshold: number;
2555
+ } | {
2556
+ type: "dismissed";
2557
+ key: string;
2558
+ inverted?: boolean | undefined;
2559
+ } | {
2560
+ type: "cooldown_active";
2561
+ key: string;
2562
+ inverted?: boolean | undefined;
2563
+ } | {
2564
+ type: "frequency_limit";
2565
+ key: string;
2566
+ limit: number;
2567
+ inverted?: boolean | undefined;
2568
+ } | {
2569
+ type: "event_count";
2570
+ key: string;
2571
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2572
+ count: number;
2573
+ withinMs?: number | undefined;
2574
+ counter?: {
2575
+ events: string[];
2576
+ match?: Record<string, {
2577
+ equals?: string | number | boolean | undefined;
2578
+ contains?: string | undefined;
2579
+ }> | undefined;
2580
+ } | undefined;
2581
+ })[];
462
2582
  value?: unknown;
463
2583
  }[];
464
2584
  default?: unknown;
@@ -470,14 +2590,14 @@ export declare const AddPointsSchema: z.ZodObject<{
470
2590
  below: z.ZodUnknown;
471
2591
  }, "strip", z.ZodTypeAny, {
472
2592
  type: "score";
473
- field: string;
474
2593
  threshold: number;
2594
+ field: string;
475
2595
  above?: unknown;
476
2596
  below?: unknown;
477
2597
  }, {
478
2598
  type: "score";
479
- field: string;
480
2599
  threshold: number;
2600
+ field: string;
481
2601
  above?: unknown;
482
2602
  below?: unknown;
483
2603
  }>, z.ZodObject<{
@@ -516,58 +2636,78 @@ export declare const AddPointsSchema: z.ZodObject<{
516
2636
  default?: unknown;
517
2637
  method?: "GET" | "POST" | undefined;
518
2638
  timeoutMs?: number | undefined;
519
- }>]>>;
2639
+ }>]>>>;
520
2640
  }, "strip", z.ZodTypeAny, {
521
- routes: {
522
- include?: string[] | undefined;
523
- exclude?: string[] | undefined;
524
- };
525
- strategy?: {
2641
+ points: number;
2642
+ kind: "gamification:addPoints";
2643
+ reason?: string | undefined;
2644
+ label?: string | undefined;
2645
+ triggerWhen?: {
526
2646
  type: "rules";
527
2647
  rules: {
528
- conditions: z.objectOutputType<{
529
- type: z.ZodString;
530
- }, z.ZodTypeAny, "passthrough">[];
2648
+ conditions: ({
2649
+ type: "page_url";
2650
+ url: string;
2651
+ } | {
2652
+ type: "route";
2653
+ routeId: string;
2654
+ } | {
2655
+ type: "anchor_visible";
2656
+ anchorId: string;
2657
+ state: "visible" | "present" | "absent";
2658
+ } | {
2659
+ type: "event_occurred";
2660
+ eventName: string;
2661
+ withinMs?: number | undefined;
2662
+ } | {
2663
+ type: "state_equals";
2664
+ key: string;
2665
+ value?: unknown;
2666
+ } | {
2667
+ type: "viewport";
2668
+ minWidth?: number | undefined;
2669
+ maxWidth?: number | undefined;
2670
+ minHeight?: number | undefined;
2671
+ maxHeight?: number | undefined;
2672
+ } | {
2673
+ type: "session_metric";
2674
+ key: string;
2675
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2676
+ threshold: number;
2677
+ } | {
2678
+ type: "dismissed";
2679
+ key: string;
2680
+ inverted?: boolean | undefined;
2681
+ } | {
2682
+ type: "cooldown_active";
2683
+ key: string;
2684
+ inverted?: boolean | undefined;
2685
+ } | {
2686
+ type: "frequency_limit";
2687
+ key: string;
2688
+ limit: number;
2689
+ inverted?: boolean | undefined;
2690
+ } | {
2691
+ type: "event_count";
2692
+ key: string;
2693
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2694
+ count: number;
2695
+ withinMs?: number | undefined;
2696
+ counter?: {
2697
+ events: string[];
2698
+ match?: Record<string, {
2699
+ equals?: string | number | boolean | undefined;
2700
+ contains?: string | undefined;
2701
+ }> | undefined;
2702
+ } | undefined;
2703
+ })[];
531
2704
  value?: unknown;
532
2705
  }[];
533
2706
  default?: unknown;
534
2707
  } | {
535
2708
  type: "score";
536
- field: string;
537
2709
  threshold: number;
538
- above?: unknown;
539
- below?: unknown;
540
- } | {
541
- type: "model";
542
- modelId: string;
543
- inputs: string[];
544
- outputMapping: Record<string, unknown>;
545
- default?: unknown;
546
- } | {
547
- type: "external";
548
- endpoint: string;
549
- default?: unknown;
550
- method?: "GET" | "POST" | undefined;
551
- timeoutMs?: number | undefined;
552
- } | undefined;
553
- }, {
554
- routes: {
555
- include?: string[] | undefined;
556
- exclude?: string[] | undefined;
557
- };
558
- strategy?: {
559
- type: "rules";
560
- rules: {
561
- conditions: z.objectInputType<{
562
- type: z.ZodString;
563
- }, z.ZodTypeAny, "passthrough">[];
564
- value?: unknown;
565
- }[];
566
- default?: unknown;
567
- } | {
568
- type: "score";
569
2710
  field: string;
570
- threshold: number;
571
2711
  above?: unknown;
572
2712
  below?: unknown;
573
2713
  } | {
@@ -582,70 +2722,78 @@ export declare const AddPointsSchema: z.ZodObject<{
582
2722
  default?: unknown;
583
2723
  method?: "GET" | "POST" | undefined;
584
2724
  timeoutMs?: number | undefined;
585
- } | undefined;
586
- }>>;
587
- }, "strip", z.ZodTypeAny, {
588
- points: number;
589
- kind: "gamification:addPoints";
590
- reason?: string | undefined;
591
- label?: string | undefined;
592
- activation?: {
593
- routes: {
594
- include?: string[] | undefined;
595
- exclude?: string[] | undefined;
596
- };
597
- strategy?: {
2725
+ } | null | undefined;
2726
+ }, {
2727
+ points: number;
2728
+ kind: "gamification:addPoints";
2729
+ reason?: string | undefined;
2730
+ label?: string | undefined;
2731
+ triggerWhen?: {
598
2732
  type: "rules";
599
2733
  rules: {
600
- conditions: z.objectOutputType<{
601
- type: z.ZodString;
602
- }, z.ZodTypeAny, "passthrough">[];
2734
+ conditions: ({
2735
+ type: "page_url";
2736
+ url: string;
2737
+ } | {
2738
+ type: "route";
2739
+ routeId: string;
2740
+ } | {
2741
+ type: "anchor_visible";
2742
+ anchorId: string;
2743
+ state: "visible" | "present" | "absent";
2744
+ } | {
2745
+ type: "event_occurred";
2746
+ eventName: string;
2747
+ withinMs?: number | undefined;
2748
+ } | {
2749
+ type: "state_equals";
2750
+ key: string;
2751
+ value?: unknown;
2752
+ } | {
2753
+ type: "viewport";
2754
+ minWidth?: number | undefined;
2755
+ maxWidth?: number | undefined;
2756
+ minHeight?: number | undefined;
2757
+ maxHeight?: number | undefined;
2758
+ } | {
2759
+ type: "session_metric";
2760
+ key: string;
2761
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2762
+ threshold: number;
2763
+ } | {
2764
+ type: "dismissed";
2765
+ key: string;
2766
+ inverted?: boolean | undefined;
2767
+ } | {
2768
+ type: "cooldown_active";
2769
+ key: string;
2770
+ inverted?: boolean | undefined;
2771
+ } | {
2772
+ type: "frequency_limit";
2773
+ key: string;
2774
+ limit: number;
2775
+ inverted?: boolean | undefined;
2776
+ } | {
2777
+ type: "event_count";
2778
+ key: string;
2779
+ operator: "gte" | "lte" | "eq" | "gt" | "lt";
2780
+ count: number;
2781
+ withinMs?: number | undefined;
2782
+ counter?: {
2783
+ events: string[];
2784
+ match?: Record<string, {
2785
+ equals?: string | number | boolean | undefined;
2786
+ contains?: string | undefined;
2787
+ }> | undefined;
2788
+ } | undefined;
2789
+ })[];
603
2790
  value?: unknown;
604
2791
  }[];
605
2792
  default?: unknown;
606
2793
  } | {
607
2794
  type: "score";
608
- field: string;
609
2795
  threshold: number;
610
- above?: unknown;
611
- below?: unknown;
612
- } | {
613
- type: "model";
614
- modelId: string;
615
- inputs: string[];
616
- outputMapping: Record<string, unknown>;
617
- default?: unknown;
618
- } | {
619
- type: "external";
620
- endpoint: string;
621
- default?: unknown;
622
- method?: "GET" | "POST" | undefined;
623
- timeoutMs?: number | undefined;
624
- } | undefined;
625
- } | undefined;
626
- }, {
627
- points: number;
628
- kind: "gamification:addPoints";
629
- reason?: string | undefined;
630
- label?: string | undefined;
631
- activation?: {
632
- routes: {
633
- include?: string[] | undefined;
634
- exclude?: string[] | undefined;
635
- };
636
- strategy?: {
637
- type: "rules";
638
- rules: {
639
- conditions: z.objectInputType<{
640
- type: z.ZodString;
641
- }, z.ZodTypeAny, "passthrough">[];
642
- value?: unknown;
643
- }[];
644
- default?: unknown;
645
- } | {
646
- type: "score";
647
2796
  field: string;
648
- threshold: number;
649
2797
  above?: unknown;
650
2798
  below?: unknown;
651
2799
  } | {
@@ -660,535 +2808,7 @@ export declare const AddPointsSchema: z.ZodObject<{
660
2808
  default?: unknown;
661
2809
  method?: "GET" | "POST" | undefined;
662
2810
  timeoutMs?: number | undefined;
663
- } | undefined;
664
- } | undefined;
665
- }>;
666
- /**
667
- * Action step schemas for unified JSON Schema generation.
668
- * The build script reads this array to merge adaptive actions into the
669
- * unified canvas-config.schema.json.
670
- */
671
- export declare const actionStepSchemas: ({
672
- defName: string;
673
- schema: z.ZodObject<{
674
- kind: z.ZodLiteral<"gamification:awardBadge">;
675
- badgeId: z.ZodString;
676
- anchorId: z.ZodOptional<z.ZodString>;
677
- label: z.ZodOptional<z.ZodString>;
678
- } & {
679
- activation: z.ZodOptional<z.ZodObject<{
680
- routes: z.ZodObject<{
681
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
682
- exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
683
- }, "strip", z.ZodTypeAny, {
684
- include?: string[] | undefined;
685
- exclude?: string[] | undefined;
686
- }, {
687
- include?: string[] | undefined;
688
- exclude?: string[] | undefined;
689
- }>;
690
- strategy: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
691
- type: z.ZodLiteral<"rules">;
692
- rules: z.ZodArray<z.ZodObject<{
693
- conditions: z.ZodArray<z.ZodObject<{
694
- type: z.ZodString;
695
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
696
- type: z.ZodString;
697
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
698
- type: z.ZodString;
699
- }, z.ZodTypeAny, "passthrough">>, "many">;
700
- value: z.ZodUnknown;
701
- }, "strip", z.ZodTypeAny, {
702
- conditions: z.objectOutputType<{
703
- type: z.ZodString;
704
- }, z.ZodTypeAny, "passthrough">[];
705
- value?: unknown;
706
- }, {
707
- conditions: z.objectInputType<{
708
- type: z.ZodString;
709
- }, z.ZodTypeAny, "passthrough">[];
710
- value?: unknown;
711
- }>, "many">;
712
- default: z.ZodUnknown;
713
- }, "strip", z.ZodTypeAny, {
714
- type: "rules";
715
- rules: {
716
- conditions: z.objectOutputType<{
717
- type: z.ZodString;
718
- }, z.ZodTypeAny, "passthrough">[];
719
- value?: unknown;
720
- }[];
721
- default?: unknown;
722
- }, {
723
- type: "rules";
724
- rules: {
725
- conditions: z.objectInputType<{
726
- type: z.ZodString;
727
- }, z.ZodTypeAny, "passthrough">[];
728
- value?: unknown;
729
- }[];
730
- default?: unknown;
731
- }>, z.ZodObject<{
732
- type: z.ZodLiteral<"score">;
733
- field: z.ZodString;
734
- threshold: z.ZodNumber;
735
- above: z.ZodUnknown;
736
- below: z.ZodUnknown;
737
- }, "strip", z.ZodTypeAny, {
738
- type: "score";
739
- field: string;
740
- threshold: number;
741
- above?: unknown;
742
- below?: unknown;
743
- }, {
744
- type: "score";
745
- field: string;
746
- threshold: number;
747
- above?: unknown;
748
- below?: unknown;
749
- }>, z.ZodObject<{
750
- type: z.ZodLiteral<"model">;
751
- modelId: z.ZodString;
752
- inputs: z.ZodArray<z.ZodString, "many">;
753
- outputMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
754
- default: z.ZodUnknown;
755
- }, "strip", z.ZodTypeAny, {
756
- type: "model";
757
- modelId: string;
758
- inputs: string[];
759
- outputMapping: Record<string, unknown>;
760
- default?: unknown;
761
- }, {
762
- type: "model";
763
- modelId: string;
764
- inputs: string[];
765
- outputMapping: Record<string, unknown>;
766
- default?: unknown;
767
- }>, z.ZodObject<{
768
- type: z.ZodLiteral<"external">;
769
- endpoint: z.ZodString;
770
- method: z.ZodOptional<z.ZodEnum<["GET", "POST"]>>;
771
- default: z.ZodUnknown;
772
- timeoutMs: z.ZodOptional<z.ZodNumber>;
773
- }, "strip", z.ZodTypeAny, {
774
- type: "external";
775
- endpoint: string;
776
- default?: unknown;
777
- method?: "GET" | "POST" | undefined;
778
- timeoutMs?: number | undefined;
779
- }, {
780
- type: "external";
781
- endpoint: string;
782
- default?: unknown;
783
- method?: "GET" | "POST" | undefined;
784
- timeoutMs?: number | undefined;
785
- }>]>>;
786
- }, "strip", z.ZodTypeAny, {
787
- routes: {
788
- include?: string[] | undefined;
789
- exclude?: string[] | undefined;
790
- };
791
- strategy?: {
792
- type: "rules";
793
- rules: {
794
- conditions: z.objectOutputType<{
795
- type: z.ZodString;
796
- }, z.ZodTypeAny, "passthrough">[];
797
- value?: unknown;
798
- }[];
799
- default?: unknown;
800
- } | {
801
- type: "score";
802
- field: string;
803
- threshold: number;
804
- above?: unknown;
805
- below?: unknown;
806
- } | {
807
- type: "model";
808
- modelId: string;
809
- inputs: string[];
810
- outputMapping: Record<string, unknown>;
811
- default?: unknown;
812
- } | {
813
- type: "external";
814
- endpoint: string;
815
- default?: unknown;
816
- method?: "GET" | "POST" | undefined;
817
- timeoutMs?: number | undefined;
818
- } | undefined;
819
- }, {
820
- routes: {
821
- include?: string[] | undefined;
822
- exclude?: string[] | undefined;
823
- };
824
- strategy?: {
825
- type: "rules";
826
- rules: {
827
- conditions: z.objectInputType<{
828
- type: z.ZodString;
829
- }, z.ZodTypeAny, "passthrough">[];
830
- value?: unknown;
831
- }[];
832
- default?: unknown;
833
- } | {
834
- type: "score";
835
- field: string;
836
- threshold: number;
837
- above?: unknown;
838
- below?: unknown;
839
- } | {
840
- type: "model";
841
- modelId: string;
842
- inputs: string[];
843
- outputMapping: Record<string, unknown>;
844
- default?: unknown;
845
- } | {
846
- type: "external";
847
- endpoint: string;
848
- default?: unknown;
849
- method?: "GET" | "POST" | undefined;
850
- timeoutMs?: number | undefined;
851
- } | undefined;
852
- }>>;
853
- }, "strip", z.ZodTypeAny, {
854
- badgeId: string;
855
- kind: "gamification:awardBadge";
856
- anchorId?: string | undefined;
857
- label?: string | undefined;
858
- activation?: {
859
- routes: {
860
- include?: string[] | undefined;
861
- exclude?: string[] | undefined;
862
- };
863
- strategy?: {
864
- type: "rules";
865
- rules: {
866
- conditions: z.objectOutputType<{
867
- type: z.ZodString;
868
- }, z.ZodTypeAny, "passthrough">[];
869
- value?: unknown;
870
- }[];
871
- default?: unknown;
872
- } | {
873
- type: "score";
874
- field: string;
875
- threshold: number;
876
- above?: unknown;
877
- below?: unknown;
878
- } | {
879
- type: "model";
880
- modelId: string;
881
- inputs: string[];
882
- outputMapping: Record<string, unknown>;
883
- default?: unknown;
884
- } | {
885
- type: "external";
886
- endpoint: string;
887
- default?: unknown;
888
- method?: "GET" | "POST" | undefined;
889
- timeoutMs?: number | undefined;
890
- } | undefined;
891
- } | undefined;
892
- }, {
893
- badgeId: string;
894
- kind: "gamification:awardBadge";
895
- anchorId?: string | undefined;
896
- label?: string | undefined;
897
- activation?: {
898
- routes: {
899
- include?: string[] | undefined;
900
- exclude?: string[] | undefined;
901
- };
902
- strategy?: {
903
- type: "rules";
904
- rules: {
905
- conditions: z.objectInputType<{
906
- type: z.ZodString;
907
- }, z.ZodTypeAny, "passthrough">[];
908
- value?: unknown;
909
- }[];
910
- default?: unknown;
911
- } | {
912
- type: "score";
913
- field: string;
914
- threshold: number;
915
- above?: unknown;
916
- below?: unknown;
917
- } | {
918
- type: "model";
919
- modelId: string;
920
- inputs: string[];
921
- outputMapping: Record<string, unknown>;
922
- default?: unknown;
923
- } | {
924
- type: "external";
925
- endpoint: string;
926
- default?: unknown;
927
- method?: "GET" | "POST" | undefined;
928
- timeoutMs?: number | undefined;
929
- } | undefined;
930
- } | undefined;
931
- }>;
932
- } | {
933
- defName: string;
934
- schema: z.ZodObject<{
935
- kind: z.ZodLiteral<"gamification:addPoints">;
936
- points: z.ZodNumber;
937
- reason: z.ZodOptional<z.ZodString>;
938
- label: z.ZodOptional<z.ZodString>;
939
- } & {
940
- activation: z.ZodOptional<z.ZodObject<{
941
- routes: z.ZodObject<{
942
- include: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
943
- exclude: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
944
- }, "strip", z.ZodTypeAny, {
945
- include?: string[] | undefined;
946
- exclude?: string[] | undefined;
947
- }, {
948
- include?: string[] | undefined;
949
- exclude?: string[] | undefined;
950
- }>;
951
- strategy: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
952
- type: z.ZodLiteral<"rules">;
953
- rules: z.ZodArray<z.ZodObject<{
954
- conditions: z.ZodArray<z.ZodObject<{
955
- type: z.ZodString;
956
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
957
- type: z.ZodString;
958
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
959
- type: z.ZodString;
960
- }, z.ZodTypeAny, "passthrough">>, "many">;
961
- value: z.ZodUnknown;
962
- }, "strip", z.ZodTypeAny, {
963
- conditions: z.objectOutputType<{
964
- type: z.ZodString;
965
- }, z.ZodTypeAny, "passthrough">[];
966
- value?: unknown;
967
- }, {
968
- conditions: z.objectInputType<{
969
- type: z.ZodString;
970
- }, z.ZodTypeAny, "passthrough">[];
971
- value?: unknown;
972
- }>, "many">;
973
- default: z.ZodUnknown;
974
- }, "strip", z.ZodTypeAny, {
975
- type: "rules";
976
- rules: {
977
- conditions: z.objectOutputType<{
978
- type: z.ZodString;
979
- }, z.ZodTypeAny, "passthrough">[];
980
- value?: unknown;
981
- }[];
982
- default?: unknown;
983
- }, {
984
- type: "rules";
985
- rules: {
986
- conditions: z.objectInputType<{
987
- type: z.ZodString;
988
- }, z.ZodTypeAny, "passthrough">[];
989
- value?: unknown;
990
- }[];
991
- default?: unknown;
992
- }>, z.ZodObject<{
993
- type: z.ZodLiteral<"score">;
994
- field: z.ZodString;
995
- threshold: z.ZodNumber;
996
- above: z.ZodUnknown;
997
- below: z.ZodUnknown;
998
- }, "strip", z.ZodTypeAny, {
999
- type: "score";
1000
- field: string;
1001
- threshold: number;
1002
- above?: unknown;
1003
- below?: unknown;
1004
- }, {
1005
- type: "score";
1006
- field: string;
1007
- threshold: number;
1008
- above?: unknown;
1009
- below?: unknown;
1010
- }>, z.ZodObject<{
1011
- type: z.ZodLiteral<"model">;
1012
- modelId: z.ZodString;
1013
- inputs: z.ZodArray<z.ZodString, "many">;
1014
- outputMapping: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1015
- default: z.ZodUnknown;
1016
- }, "strip", z.ZodTypeAny, {
1017
- type: "model";
1018
- modelId: string;
1019
- inputs: string[];
1020
- outputMapping: Record<string, unknown>;
1021
- default?: unknown;
1022
- }, {
1023
- type: "model";
1024
- modelId: string;
1025
- inputs: string[];
1026
- outputMapping: Record<string, unknown>;
1027
- default?: unknown;
1028
- }>, z.ZodObject<{
1029
- type: z.ZodLiteral<"external">;
1030
- endpoint: z.ZodString;
1031
- method: z.ZodOptional<z.ZodEnum<["GET", "POST"]>>;
1032
- default: z.ZodUnknown;
1033
- timeoutMs: z.ZodOptional<z.ZodNumber>;
1034
- }, "strip", z.ZodTypeAny, {
1035
- type: "external";
1036
- endpoint: string;
1037
- default?: unknown;
1038
- method?: "GET" | "POST" | undefined;
1039
- timeoutMs?: number | undefined;
1040
- }, {
1041
- type: "external";
1042
- endpoint: string;
1043
- default?: unknown;
1044
- method?: "GET" | "POST" | undefined;
1045
- timeoutMs?: number | undefined;
1046
- }>]>>;
1047
- }, "strip", z.ZodTypeAny, {
1048
- routes: {
1049
- include?: string[] | undefined;
1050
- exclude?: string[] | undefined;
1051
- };
1052
- strategy?: {
1053
- type: "rules";
1054
- rules: {
1055
- conditions: z.objectOutputType<{
1056
- type: z.ZodString;
1057
- }, z.ZodTypeAny, "passthrough">[];
1058
- value?: unknown;
1059
- }[];
1060
- default?: unknown;
1061
- } | {
1062
- type: "score";
1063
- field: string;
1064
- threshold: number;
1065
- above?: unknown;
1066
- below?: unknown;
1067
- } | {
1068
- type: "model";
1069
- modelId: string;
1070
- inputs: string[];
1071
- outputMapping: Record<string, unknown>;
1072
- default?: unknown;
1073
- } | {
1074
- type: "external";
1075
- endpoint: string;
1076
- default?: unknown;
1077
- method?: "GET" | "POST" | undefined;
1078
- timeoutMs?: number | undefined;
1079
- } | undefined;
1080
- }, {
1081
- routes: {
1082
- include?: string[] | undefined;
1083
- exclude?: string[] | undefined;
1084
- };
1085
- strategy?: {
1086
- type: "rules";
1087
- rules: {
1088
- conditions: z.objectInputType<{
1089
- type: z.ZodString;
1090
- }, z.ZodTypeAny, "passthrough">[];
1091
- value?: unknown;
1092
- }[];
1093
- default?: unknown;
1094
- } | {
1095
- type: "score";
1096
- field: string;
1097
- threshold: number;
1098
- above?: unknown;
1099
- below?: unknown;
1100
- } | {
1101
- type: "model";
1102
- modelId: string;
1103
- inputs: string[];
1104
- outputMapping: Record<string, unknown>;
1105
- default?: unknown;
1106
- } | {
1107
- type: "external";
1108
- endpoint: string;
1109
- default?: unknown;
1110
- method?: "GET" | "POST" | undefined;
1111
- timeoutMs?: number | undefined;
1112
- } | undefined;
1113
- }>>;
1114
- }, "strip", z.ZodTypeAny, {
1115
- points: number;
1116
- kind: "gamification:addPoints";
1117
- reason?: string | undefined;
1118
- label?: string | undefined;
1119
- activation?: {
1120
- routes: {
1121
- include?: string[] | undefined;
1122
- exclude?: string[] | undefined;
1123
- };
1124
- strategy?: {
1125
- type: "rules";
1126
- rules: {
1127
- conditions: z.objectOutputType<{
1128
- type: z.ZodString;
1129
- }, z.ZodTypeAny, "passthrough">[];
1130
- value?: unknown;
1131
- }[];
1132
- default?: unknown;
1133
- } | {
1134
- type: "score";
1135
- field: string;
1136
- threshold: number;
1137
- above?: unknown;
1138
- below?: unknown;
1139
- } | {
1140
- type: "model";
1141
- modelId: string;
1142
- inputs: string[];
1143
- outputMapping: Record<string, unknown>;
1144
- default?: unknown;
1145
- } | {
1146
- type: "external";
1147
- endpoint: string;
1148
- default?: unknown;
1149
- method?: "GET" | "POST" | undefined;
1150
- timeoutMs?: number | undefined;
1151
- } | undefined;
1152
- } | undefined;
1153
- }, {
1154
- points: number;
1155
- kind: "gamification:addPoints";
1156
- reason?: string | undefined;
1157
- label?: string | undefined;
1158
- activation?: {
1159
- routes: {
1160
- include?: string[] | undefined;
1161
- exclude?: string[] | undefined;
1162
- };
1163
- strategy?: {
1164
- type: "rules";
1165
- rules: {
1166
- conditions: z.objectInputType<{
1167
- type: z.ZodString;
1168
- }, z.ZodTypeAny, "passthrough">[];
1169
- value?: unknown;
1170
- }[];
1171
- default?: unknown;
1172
- } | {
1173
- type: "score";
1174
- field: string;
1175
- threshold: number;
1176
- above?: unknown;
1177
- below?: unknown;
1178
- } | {
1179
- type: "model";
1180
- modelId: string;
1181
- inputs: string[];
1182
- outputMapping: Record<string, unknown>;
1183
- default?: unknown;
1184
- } | {
1185
- type: "external";
1186
- endpoint: string;
1187
- default?: unknown;
1188
- method?: "GET" | "POST" | undefined;
1189
- timeoutMs?: number | undefined;
1190
- } | undefined;
1191
- } | undefined;
2811
+ } | null | undefined;
1192
2812
  }>;
1193
2813
  })[];
1194
2814
  //# sourceMappingURL=schema.d.ts.map