@usertour/helpers 0.0.37 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,781 @@
1
+ import { ContentEditorRoot, ContentEditorRootColumn, ContentEditorRootElement, ContentEditorElementType, ContentEditorElement, ContentEditorClickableElement, ContentEditorQuestionElement, StepTrigger, Step } from '@usertour/types';
2
+
3
+ declare const EmptyGroup: ContentEditorRoot;
4
+ declare const EmptyColumn: ContentEditorRootColumn;
5
+ declare const EmptyButton: ContentEditorRootElement;
6
+ declare const EmptyImage: ContentEditorRootElement;
7
+ declare const EmptyEmbed: ContentEditorRootElement;
8
+ declare const EmptyText: ContentEditorRootElement;
9
+ declare const createNewGroup: (children: ContentEditorRootElement[]) => ContentEditorRoot;
10
+ declare const createNewColumn: (children: ContentEditorRootElement[]) => ContentEditorRootColumn;
11
+ declare const defaultInitialValue: ContentEditorRoot[];
12
+ declare const groupData: {
13
+ type: string;
14
+ isFirst: boolean;
15
+ isLast: boolean;
16
+ children: {
17
+ type: string;
18
+ width: {
19
+ type: string;
20
+ value: number;
21
+ };
22
+ justifyContent: string;
23
+ style: {
24
+ marginRight: string;
25
+ };
26
+ children: {
27
+ type: string;
28
+ children: {
29
+ text: string;
30
+ }[];
31
+ }[];
32
+ }[];
33
+ }[];
34
+ declare const createValue1: {
35
+ element: {
36
+ type: string;
37
+ };
38
+ children: {
39
+ element: {
40
+ type: string;
41
+ justifyContent: string;
42
+ width: {
43
+ type: string;
44
+ };
45
+ style: {};
46
+ };
47
+ children: {
48
+ element: {
49
+ type: string;
50
+ data: {
51
+ type: string;
52
+ children: {
53
+ text: string;
54
+ }[];
55
+ }[];
56
+ };
57
+ }[];
58
+ }[];
59
+ }[];
60
+ declare const createValue2: ({
61
+ element: {
62
+ type: string;
63
+ };
64
+ children: {
65
+ element: {
66
+ type: string;
67
+ justifyContent: string;
68
+ width: {
69
+ type: string;
70
+ };
71
+ style: {};
72
+ };
73
+ children: {
74
+ element: {
75
+ type: string;
76
+ data: ({
77
+ type: string;
78
+ children: {
79
+ text: string;
80
+ }[];
81
+ align: string;
82
+ } | {
83
+ type: string;
84
+ children: {
85
+ text: string;
86
+ }[];
87
+ align?: undefined;
88
+ })[];
89
+ };
90
+ }[];
91
+ }[];
92
+ } | {
93
+ element: {
94
+ type: string;
95
+ };
96
+ children: {
97
+ element: {
98
+ type: string;
99
+ width: {
100
+ type: string;
101
+ };
102
+ justifyContent: string;
103
+ style: {};
104
+ };
105
+ children: ({
106
+ element: {
107
+ type: string;
108
+ data: {
109
+ action: string;
110
+ text: string;
111
+ type: string;
112
+ };
113
+ margin?: undefined;
114
+ };
115
+ children: null;
116
+ } | {
117
+ element: {
118
+ type: string;
119
+ data: {
120
+ action: string;
121
+ text: string;
122
+ type: string;
123
+ };
124
+ margin: {
125
+ top: number;
126
+ left: string;
127
+ bottom: number;
128
+ right: number;
129
+ enabled: boolean;
130
+ };
131
+ };
132
+ children: null;
133
+ })[];
134
+ }[];
135
+ })[];
136
+ declare const createValue3: ({
137
+ element: {
138
+ type: string;
139
+ };
140
+ children: {
141
+ element: {
142
+ type: string;
143
+ style: {};
144
+ width: {
145
+ type: string;
146
+ };
147
+ justifyContent: string;
148
+ };
149
+ children: {
150
+ element: {
151
+ url: string;
152
+ type: string;
153
+ };
154
+ children: null;
155
+ }[];
156
+ }[];
157
+ } | {
158
+ element: {
159
+ type: string;
160
+ };
161
+ children: {
162
+ element: {
163
+ type: string;
164
+ style: {};
165
+ width: {
166
+ type: string;
167
+ };
168
+ justifyContent: string;
169
+ };
170
+ children: {
171
+ element: {
172
+ data: ({
173
+ type: string;
174
+ children: {
175
+ text: string;
176
+ }[];
177
+ align?: undefined;
178
+ } | {
179
+ type: string;
180
+ align: string;
181
+ children: {
182
+ bold: boolean;
183
+ text: string;
184
+ }[];
185
+ } | {
186
+ type: string;
187
+ align: string;
188
+ children: {
189
+ text: string;
190
+ }[];
191
+ })[];
192
+ type: string;
193
+ };
194
+ children: null;
195
+ }[];
196
+ }[];
197
+ } | {
198
+ element: {
199
+ type: string;
200
+ };
201
+ children: {
202
+ element: {
203
+ type: string;
204
+ style: {};
205
+ width: {
206
+ type: string;
207
+ };
208
+ justifyContent: string;
209
+ };
210
+ children: {
211
+ element: {
212
+ data: {
213
+ text: string;
214
+ type: string;
215
+ action: string;
216
+ actions: {
217
+ data: {
218
+ stepCvid: string;
219
+ };
220
+ type: string;
221
+ operators: string;
222
+ }[];
223
+ };
224
+ type: string;
225
+ };
226
+ children: null;
227
+ }[];
228
+ }[];
229
+ })[];
230
+ declare const createValue4: ({
231
+ element: {
232
+ type: string;
233
+ };
234
+ children: {
235
+ element: {
236
+ type: string;
237
+ style: {};
238
+ width: {
239
+ type: string;
240
+ };
241
+ justifyContent: string;
242
+ };
243
+ children: {
244
+ element: {
245
+ url: string;
246
+ type: string;
247
+ };
248
+ children: null;
249
+ }[];
250
+ }[];
251
+ } | {
252
+ element: {
253
+ type: string;
254
+ };
255
+ children: {
256
+ element: {
257
+ type: string;
258
+ style: {};
259
+ width: {
260
+ type: string;
261
+ };
262
+ justifyContent: string;
263
+ };
264
+ children: {
265
+ element: {
266
+ data: ({
267
+ type: string;
268
+ children: {
269
+ text: string;
270
+ }[];
271
+ align?: undefined;
272
+ } | {
273
+ type: string;
274
+ align: string;
275
+ children: {
276
+ bold: boolean;
277
+ text: string;
278
+ }[];
279
+ } | {
280
+ type: string;
281
+ align: string;
282
+ children: {
283
+ text: string;
284
+ }[];
285
+ })[];
286
+ type: string;
287
+ };
288
+ children: null;
289
+ }[];
290
+ }[];
291
+ } | {
292
+ element: {
293
+ type: string;
294
+ };
295
+ children: {
296
+ element: {
297
+ type: string;
298
+ style: {};
299
+ width: {
300
+ type: string;
301
+ };
302
+ justifyContent: string;
303
+ };
304
+ children: {
305
+ element: {
306
+ data: {
307
+ text: string;
308
+ type: string;
309
+ action: string;
310
+ actions: {
311
+ data: {
312
+ stepCvid: string;
313
+ };
314
+ type: string;
315
+ operators: string;
316
+ }[];
317
+ };
318
+ type: string;
319
+ };
320
+ children: null;
321
+ }[];
322
+ }[];
323
+ })[];
324
+ declare const createValue5: ({
325
+ element: {
326
+ type: string;
327
+ };
328
+ children: {
329
+ element: {
330
+ type: string;
331
+ justifyContent: string;
332
+ width: {
333
+ type: string;
334
+ };
335
+ style: {};
336
+ };
337
+ children: {
338
+ element: {
339
+ type: string;
340
+ data: ({
341
+ type: string;
342
+ children: {
343
+ text: string;
344
+ }[];
345
+ align: string;
346
+ } | {
347
+ type: string;
348
+ children: {
349
+ text: string;
350
+ }[];
351
+ align?: undefined;
352
+ })[];
353
+ };
354
+ }[];
355
+ }[];
356
+ } | {
357
+ element: {
358
+ type: string;
359
+ };
360
+ children: {
361
+ element: {
362
+ type: string;
363
+ width: {
364
+ type: string;
365
+ };
366
+ justifyContent: string;
367
+ style: {};
368
+ };
369
+ children: ({
370
+ element: {
371
+ type: string;
372
+ data: {
373
+ action: string;
374
+ text: string;
375
+ type: string;
376
+ };
377
+ margin?: undefined;
378
+ };
379
+ children: null;
380
+ } | {
381
+ element: {
382
+ type: string;
383
+ data: {
384
+ action: string;
385
+ text: string;
386
+ type: string;
387
+ };
388
+ margin: {
389
+ top: number;
390
+ left: string;
391
+ bottom: number;
392
+ right: number;
393
+ enabled: boolean;
394
+ };
395
+ };
396
+ children: null;
397
+ })[];
398
+ }[];
399
+ })[];
400
+ declare const createValue6: ({
401
+ element: {
402
+ type: string;
403
+ };
404
+ children: {
405
+ element: {
406
+ type: string;
407
+ justifyContent: string;
408
+ width: {
409
+ type: string;
410
+ };
411
+ style: {};
412
+ };
413
+ children: {
414
+ element: {
415
+ type: string;
416
+ url: string;
417
+ };
418
+ children: null;
419
+ }[];
420
+ }[];
421
+ } | {
422
+ element: {
423
+ type: string;
424
+ };
425
+ children: {
426
+ element: {
427
+ type: string;
428
+ width: {
429
+ type: string;
430
+ };
431
+ justifyContent: string;
432
+ style: {};
433
+ };
434
+ children: {
435
+ element: {
436
+ type: string;
437
+ data: {
438
+ type: string;
439
+ children: {
440
+ text: string;
441
+ }[];
442
+ }[];
443
+ };
444
+ children: null;
445
+ }[];
446
+ }[];
447
+ } | {
448
+ element: {
449
+ type: string;
450
+ };
451
+ children: {
452
+ element: {
453
+ type: string;
454
+ justifyContent: string;
455
+ width: {
456
+ type: string;
457
+ };
458
+ style: {};
459
+ };
460
+ children: ({
461
+ element: {
462
+ type: string;
463
+ data: {
464
+ text: string;
465
+ type: string;
466
+ action: string;
467
+ };
468
+ margin?: undefined;
469
+ };
470
+ children: null;
471
+ } | {
472
+ element: {
473
+ type: string;
474
+ data: {
475
+ text: string;
476
+ type: string;
477
+ action: string;
478
+ };
479
+ margin: {
480
+ top: string;
481
+ left: string;
482
+ bottom: number;
483
+ right: number;
484
+ enabled: boolean;
485
+ };
486
+ };
487
+ children: null;
488
+ })[];
489
+ }[];
490
+ })[];
491
+ declare const surveysValue: ({
492
+ element: {
493
+ type: string;
494
+ };
495
+ children: {
496
+ element: {
497
+ type: string;
498
+ style: {};
499
+ width: {
500
+ type: string;
501
+ };
502
+ justifyContent: string;
503
+ };
504
+ children: {
505
+ element: {
506
+ data: ({
507
+ type: string;
508
+ children: {
509
+ text: string;
510
+ }[];
511
+ align?: undefined;
512
+ } | {
513
+ type: string;
514
+ align: string;
515
+ children: {
516
+ bold: boolean;
517
+ text: string;
518
+ }[];
519
+ })[];
520
+ type: string;
521
+ };
522
+ }[];
523
+ }[];
524
+ } | {
525
+ element: {
526
+ type: string;
527
+ };
528
+ children: {
529
+ element: {
530
+ type: string;
531
+ style: {};
532
+ width: {
533
+ type: string;
534
+ };
535
+ justifyContent: string;
536
+ };
537
+ children: {
538
+ element: {
539
+ data: {
540
+ cvid: string;
541
+ name: string;
542
+ actions: {
543
+ data: {};
544
+ type: string;
545
+ operators: string;
546
+ }[];
547
+ lowLabel: string;
548
+ highLabel: string;
549
+ bindToAttribute: boolean;
550
+ selectedAttribute: string;
551
+ };
552
+ type: string;
553
+ };
554
+ children: null;
555
+ }[];
556
+ }[];
557
+ })[];
558
+ declare const isRestrictedType: (type: ContentEditorElementType) => boolean;
559
+ declare const isMissingRequiredData: (element: ContentEditorElement) => boolean;
560
+ declare const hasMissingRequiredData: (contents: ContentEditorRoot[]) => boolean;
561
+ declare const isQuestionElement: (element: ContentEditorElement) => boolean;
562
+ declare const isClickableElement: (element: ContentEditorClickableElement) => boolean;
563
+ declare const extractQuestionData: (data: ContentEditorRoot[]) => ContentEditorQuestionElement[];
564
+ declare const getDefaultDataForType: (type: string) => {
565
+ element: {
566
+ type: string;
567
+ };
568
+ children: {
569
+ element: {
570
+ type: string;
571
+ justifyContent: string;
572
+ width: {
573
+ type: string;
574
+ };
575
+ style: {};
576
+ };
577
+ children: {
578
+ element: {
579
+ type: string;
580
+ data: {
581
+ type: string;
582
+ children: {
583
+ text: string;
584
+ }[];
585
+ }[];
586
+ };
587
+ }[];
588
+ }[];
589
+ }[] | ({
590
+ element: {
591
+ type: string;
592
+ };
593
+ children: {
594
+ element: {
595
+ type: string;
596
+ justifyContent: string;
597
+ width: {
598
+ type: string;
599
+ };
600
+ style: {};
601
+ };
602
+ children: {
603
+ element: {
604
+ type: string;
605
+ data: ({
606
+ type: string;
607
+ children: {
608
+ text: string;
609
+ }[];
610
+ align: string;
611
+ } | {
612
+ type: string;
613
+ children: {
614
+ text: string;
615
+ }[];
616
+ align?: undefined;
617
+ })[];
618
+ };
619
+ }[];
620
+ }[];
621
+ } | {
622
+ element: {
623
+ type: string;
624
+ };
625
+ children: {
626
+ element: {
627
+ type: string;
628
+ width: {
629
+ type: string;
630
+ };
631
+ justifyContent: string;
632
+ style: {};
633
+ };
634
+ children: ({
635
+ element: {
636
+ type: string;
637
+ data: {
638
+ action: string;
639
+ text: string;
640
+ type: string;
641
+ };
642
+ margin?: undefined;
643
+ };
644
+ children: null;
645
+ } | {
646
+ element: {
647
+ type: string;
648
+ data: {
649
+ action: string;
650
+ text: string;
651
+ type: string;
652
+ };
653
+ margin: {
654
+ top: number;
655
+ left: string;
656
+ bottom: number;
657
+ right: number;
658
+ enabled: boolean;
659
+ };
660
+ };
661
+ children: null;
662
+ })[];
663
+ }[];
664
+ })[] | ({
665
+ element: {
666
+ type: string;
667
+ };
668
+ children: {
669
+ element: {
670
+ type: string;
671
+ style: {};
672
+ width: {
673
+ type: string;
674
+ };
675
+ justifyContent: string;
676
+ };
677
+ children: {
678
+ element: {
679
+ url: string;
680
+ type: string;
681
+ };
682
+ children: null;
683
+ }[];
684
+ }[];
685
+ } | {
686
+ element: {
687
+ type: string;
688
+ };
689
+ children: {
690
+ element: {
691
+ type: string;
692
+ style: {};
693
+ width: {
694
+ type: string;
695
+ };
696
+ justifyContent: string;
697
+ };
698
+ children: {
699
+ element: {
700
+ data: ({
701
+ type: string;
702
+ children: {
703
+ text: string;
704
+ }[];
705
+ align?: undefined;
706
+ } | {
707
+ type: string;
708
+ align: string;
709
+ children: {
710
+ bold: boolean;
711
+ text: string;
712
+ }[];
713
+ } | {
714
+ type: string;
715
+ align: string;
716
+ children: {
717
+ text: string;
718
+ }[];
719
+ })[];
720
+ type: string;
721
+ };
722
+ children: null;
723
+ }[];
724
+ }[];
725
+ } | {
726
+ element: {
727
+ type: string;
728
+ };
729
+ children: {
730
+ element: {
731
+ type: string;
732
+ style: {};
733
+ width: {
734
+ type: string;
735
+ };
736
+ justifyContent: string;
737
+ };
738
+ children: {
739
+ element: {
740
+ data: {
741
+ text: string;
742
+ type: string;
743
+ action: string;
744
+ actions: {
745
+ data: {
746
+ stepCvid: string;
747
+ };
748
+ type: string;
749
+ operators: string;
750
+ }[];
751
+ };
752
+ type: string;
753
+ };
754
+ children: null;
755
+ }[];
756
+ }[];
757
+ })[];
758
+ /**
759
+ * Process question elements in content editor data to replace cvid with new cuid
760
+ * Also process actions field in all elements (button and question elements) to regenerate condition IDs
761
+ * @param contents - The content editor root array to process
762
+ * @returns A new array with question element cvids replaced by new cuids and actions regenerated
763
+ */
764
+ declare const processQuestionElements: (contents: ContentEditorRoot[] | undefined) => ContentEditorRoot[];
765
+ declare const regenerateTrigger: (trigger: StepTrigger[]) => StepTrigger[];
766
+ /**
767
+ * Process target to regenerate condition IDs in actions field
768
+ * @param target - The target object to process
769
+ * @returns A new target object with regenerated action condition IDs, or undefined if target is undefined
770
+ */
771
+ declare const regenerateTarget: (target: Step['target']) => Step['target'];
772
+ /**
773
+ * Generate a unique copy name based on the original name and existing names
774
+ * @param originalName - The original name to base the copy name on
775
+ * @param existingNames - Optional array of existing names to check against
776
+ * @returns A unique name in the format "Name (copy)", "Name (copy 2)", etc.
777
+ */
778
+ declare const generateUniqueCopyName: (originalName: string, existingNames?: string[]) => string;
779
+ declare const createStepCopy: (originalStep: Step, sequence: number, existingStepNames?: string[]) => Step;
780
+
781
+ export { EmptyButton, EmptyColumn, EmptyEmbed, EmptyGroup, EmptyImage, EmptyText, createNewColumn, createNewGroup, createStepCopy, createValue1, createValue2, createValue3, createValue4, createValue5, createValue6, defaultInitialValue, extractQuestionData, generateUniqueCopyName, getDefaultDataForType, groupData, hasMissingRequiredData, isClickableElement, isMissingRequiredData, isQuestionElement, isRestrictedType, processQuestionElements, regenerateTarget, regenerateTrigger, surveysValue };