@saasquatch/squatch-js 2.6.0-1 → 2.6.0-2
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/coverage/clover.xml +2 -2
- package/coverage/lcov-report/api/AnalyticsApi.ts.html +1 -1
- package/coverage/lcov-report/api/WidgetApi.ts.html +6 -6
- package/coverage/lcov-report/api/graphql.ts.html +1 -1
- package/coverage/lcov-report/utils/domready.ts.html +1 -1
- package/coverage/lcov-report/utils/io.ts.html +1 -1
- package/coverage/lcov-report/utils/validate.ts.html +9 -9
- package/coverage/lcov-report/widgets/EmbedWidget.ts.html +1 -1
- package/coverage/lcov-report/widgets/PopupWidget.ts.html +1 -1
- package/coverage/lcov-report/widgets/Widget.ts.html +1 -1
- package/coverage/lcov-report/widgets/Widgets.ts.html +65 -65
- package/dist/squatch.d.ts +0 -15
- package/dist/squatch.esm.js +13 -25
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +12 -25
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/jest.config.ts +1 -3
- package/package.json +1 -1
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1689713563033" clover="3.2.0">
|
|
3
|
+
<project timestamp="1689713563033" name="All files">
|
|
4
4
|
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
|
|
5
5
|
</project>
|
|
6
6
|
</coverage>
|
|
@@ -289,7 +289,7 @@ export type SQHDetails = {
|
|
|
289
289
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
290
290
|
Code coverage generated by
|
|
291
291
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
292
|
-
at 2023-07-18T18:
|
|
292
|
+
at 2023-07-18T18:59:28.021Z
|
|
293
293
|
</div>
|
|
294
294
|
<script src="../prettify.js"></script>
|
|
295
295
|
<script>
|
|
@@ -290,12 +290,12 @@
|
|
|
290
290
|
<span class="cline-any cline-neutral"> </span>
|
|
291
291
|
<span class="cline-any cline-neutral"> </span>
|
|
292
292
|
<span class="cline-any cline-neutral"> </span>
|
|
293
|
-
<span class="cline-any cline-yes">
|
|
294
|
-
<span class="cline-any cline-yes">
|
|
293
|
+
<span class="cline-any cline-yes">29x</span>
|
|
294
|
+
<span class="cline-any cline-yes">29x</span>
|
|
295
295
|
<span class="cline-any cline-neutral"> </span>
|
|
296
|
-
<span class="cline-any cline-yes">
|
|
297
|
-
<span class="cline-any cline-yes">
|
|
298
|
-
<span class="cline-any cline-yes">
|
|
296
|
+
<span class="cline-any cline-yes">29x</span>
|
|
297
|
+
<span class="cline-any cline-yes">29x</span>
|
|
298
|
+
<span class="cline-any cline-yes">29x</span>
|
|
299
299
|
<span class="cline-any cline-neutral"> </span>
|
|
300
300
|
<span class="cline-any cline-neutral"> </span>
|
|
301
301
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -616,7 +616,7 @@ function <span class="fstat-no" title="function not covered" >_buildParams(</spa
|
|
|
616
616
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
617
617
|
Code coverage generated by
|
|
618
618
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
619
|
-
at 2023-07-18T18:
|
|
619
|
+
at 2023-07-18T18:59:28.021Z
|
|
620
620
|
</div>
|
|
621
621
|
<script src="../prettify.js"></script>
|
|
622
622
|
<script>
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
116
116
|
Code coverage generated by
|
|
117
117
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
118
|
-
at 2023-07-18T18:
|
|
118
|
+
at 2023-07-18T18:59:28.021Z
|
|
119
119
|
</div>
|
|
120
120
|
<script src="../prettify.js"></script>
|
|
121
121
|
<script>
|
|
@@ -145,7 +145,7 @@ export function <span class="fstat-no" title="function not covered" >domready(</
|
|
|
145
145
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
146
146
|
Code coverage generated by
|
|
147
147
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
148
|
-
at 2023-07-18T18:
|
|
148
|
+
at 2023-07-18T18:59:28.021Z
|
|
149
149
|
</div>
|
|
150
150
|
<script src="../prettify.js"></script>
|
|
151
151
|
<script>
|
|
@@ -385,7 +385,7 @@ export async function <span class="fstat-no" title="function not covered" >doPut
|
|
|
385
385
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
386
386
|
Code coverage generated by
|
|
387
387
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
388
|
-
at 2023-07-18T18:
|
|
388
|
+
at 2023-07-18T18:59:28.021Z
|
|
389
389
|
</div>
|
|
390
390
|
<script src="../prettify.js"></script>
|
|
391
391
|
<script>
|
|
@@ -136,24 +136,24 @@
|
|
|
136
136
|
<span class="cline-any cline-yes">3x</span>
|
|
137
137
|
<span class="cline-any cline-neutral"> </span>
|
|
138
138
|
<span class="cline-any cline-neutral"> </span>
|
|
139
|
-
<span class="cline-any cline-yes">
|
|
139
|
+
<span class="cline-any cline-yes">58x</span>
|
|
140
140
|
<span class="cline-any cline-neutral"> </span>
|
|
141
|
-
<span class="cline-any cline-yes">
|
|
141
|
+
<span class="cline-any cline-yes">58x</span>
|
|
142
142
|
<span class="cline-any cline-neutral"> </span>
|
|
143
143
|
<span class="cline-any cline-neutral"> </span>
|
|
144
144
|
<span class="cline-any cline-neutral"> </span>
|
|
145
145
|
<span class="cline-any cline-neutral"> </span>
|
|
146
146
|
<span class="cline-any cline-neutral"> </span>
|
|
147
147
|
<span class="cline-any cline-neutral"> </span>
|
|
148
|
-
<span class="cline-any cline-yes">
|
|
148
|
+
<span class="cline-any cline-yes">58x</span>
|
|
149
149
|
<span class="cline-any cline-no"> </span>
|
|
150
|
-
<span class="cline-any cline-yes">
|
|
150
|
+
<span class="cline-any cline-yes">58x</span>
|
|
151
151
|
<span class="cline-any cline-neutral"> </span>
|
|
152
|
-
<span class="cline-any cline-yes">
|
|
153
|
-
<span class="cline-any cline-yes">
|
|
152
|
+
<span class="cline-any cline-yes">58x</span>
|
|
153
|
+
<span class="cline-any cline-yes">58x</span>
|
|
154
154
|
<span class="cline-any cline-neutral"> </span>
|
|
155
|
-
<span class="cline-any cline-yes">
|
|
156
|
-
<span class="cline-any cline-yes">
|
|
155
|
+
<span class="cline-any cline-yes">58x</span>
|
|
156
|
+
<span class="cline-any cline-yes">58x</span>
|
|
157
157
|
<span class="cline-any cline-neutral"> </span>
|
|
158
158
|
<span class="cline-any cline-neutral"> </span>
|
|
159
159
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -253,7 +253,7 @@ export function validatePasswordlessConfig(
|
|
|
253
253
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
254
254
|
Code coverage generated by
|
|
255
255
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
256
|
-
at 2023-07-18T18:
|
|
256
|
+
at 2023-07-18T18:59:28.021Z
|
|
257
257
|
</div>
|
|
258
258
|
<script src="../prettify.js"></script>
|
|
259
259
|
<script>
|
|
@@ -418,7 +418,7 @@ export default class EmbedWidget extends Widget {
|
|
|
418
418
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
419
419
|
Code coverage generated by
|
|
420
420
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
421
|
-
at 2023-07-18T18:
|
|
421
|
+
at 2023-07-18T18:59:28.021Z
|
|
422
422
|
</div>
|
|
423
423
|
<script src="../prettify.js"></script>
|
|
424
424
|
<script>
|
|
@@ -655,7 +655,7 @@ export default class PopupWidget extends Widget {
|
|
|
655
655
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
656
656
|
Code coverage generated by
|
|
657
657
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
658
|
-
at 2023-07-18T18:
|
|
658
|
+
at 2023-07-18T18:59:28.021Z
|
|
659
659
|
</div>
|
|
660
660
|
<script src="../prettify.js"></script>
|
|
661
661
|
<script>
|
|
@@ -1150,7 +1150,7 @@ function <span class="fstat-no" title="function not covered" >delay(</span>durat
|
|
|
1150
1150
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1151
1151
|
Code coverage generated by
|
|
1152
1152
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1153
|
-
at 2023-07-18T18:
|
|
1153
|
+
at 2023-07-18T18:59:28.021Z
|
|
1154
1154
|
</div>
|
|
1155
1155
|
<script src="../prettify.js"></script>
|
|
1156
1156
|
<script>
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">
|
|
26
|
+
<span class="strong">86.13% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>87/101</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">68.29% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>28/41</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">
|
|
40
|
+
<span class="strong">90.9% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>10/11</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">
|
|
47
|
+
<span class="strong">85.71% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>84/98</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</template>
|
|
63
63
|
</div>
|
|
64
|
-
<div class='status-line
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
65
|
<pre><table class="coverage">
|
|
66
66
|
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
67
|
<a name='L2'></a><a href='#L2'>2</a>
|
|
@@ -438,11 +438,11 @@
|
|
|
438
438
|
<span class="cline-any cline-neutral"> </span>
|
|
439
439
|
<span class="cline-any cline-neutral"> </span>
|
|
440
440
|
<span class="cline-any cline-neutral"> </span>
|
|
441
|
-
<span class="cline-any cline-yes">
|
|
442
|
-
<span class="cline-any cline-yes">
|
|
443
|
-
<span class="cline-any cline-yes">
|
|
444
|
-
<span class="cline-any cline-yes">
|
|
445
|
-
<span class="cline-any cline-yes">
|
|
441
|
+
<span class="cline-any cline-yes">29x</span>
|
|
442
|
+
<span class="cline-any cline-yes">29x</span>
|
|
443
|
+
<span class="cline-any cline-yes">29x</span>
|
|
444
|
+
<span class="cline-any cline-yes">29x</span>
|
|
445
|
+
<span class="cline-any cline-yes">29x</span>
|
|
446
446
|
<span class="cline-any cline-neutral"> </span>
|
|
447
447
|
<span class="cline-any cline-neutral"> </span>
|
|
448
448
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -580,15 +580,15 @@
|
|
|
580
580
|
<span class="cline-any cline-neutral"> </span>
|
|
581
581
|
<span class="cline-any cline-neutral"> </span>
|
|
582
582
|
<span class="cline-any cline-neutral"> </span>
|
|
583
|
-
<span class="cline-any cline-yes">
|
|
584
|
-
<span class="cline-any cline-yes">
|
|
583
|
+
<span class="cline-any cline-yes">13x</span>
|
|
584
|
+
<span class="cline-any cline-yes">13x</span>
|
|
585
585
|
<span class="cline-any cline-neutral"> </span>
|
|
586
586
|
<span class="cline-any cline-neutral"> </span>
|
|
587
|
-
<span class="cline-any cline-yes">
|
|
588
|
-
<span class="cline-any cline-yes">
|
|
589
|
-
<span class="cline-any cline-yes">
|
|
587
|
+
<span class="cline-any cline-yes">12x</span>
|
|
588
|
+
<span class="cline-any cline-yes">12x</span>
|
|
589
|
+
<span class="cline-any cline-yes">12x</span>
|
|
590
590
|
<span class="cline-any cline-neutral"> </span>
|
|
591
|
-
<span class="cline-any cline-yes">
|
|
591
|
+
<span class="cline-any cline-yes">12x</span>
|
|
592
592
|
<span class="cline-any cline-neutral"> </span>
|
|
593
593
|
<span class="cline-any cline-neutral"> </span>
|
|
594
594
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -597,16 +597,16 @@
|
|
|
597
597
|
<span class="cline-any cline-neutral"> </span>
|
|
598
598
|
<span class="cline-any cline-neutral"> </span>
|
|
599
599
|
<span class="cline-any cline-neutral"> </span>
|
|
600
|
-
<span class="cline-any cline-yes">
|
|
601
|
-
<span class="cline-any cline-
|
|
602
|
-
<span class="cline-any cline-
|
|
603
|
-
<span class="cline-any cline-
|
|
600
|
+
<span class="cline-any cline-yes">12x</span>
|
|
601
|
+
<span class="cline-any cline-yes">1x</span>
|
|
602
|
+
<span class="cline-any cline-yes">2x</span>
|
|
603
|
+
<span class="cline-any cline-yes">2x</span>
|
|
604
604
|
<span class="cline-any cline-neutral"> </span>
|
|
605
605
|
<span class="cline-any cline-neutral"> </span>
|
|
606
606
|
<span class="cline-any cline-neutral"> </span>
|
|
607
|
-
<span class="cline-any cline-
|
|
608
|
-
<span class="cline-any cline-
|
|
609
|
-
<span class="cline-any cline-
|
|
607
|
+
<span class="cline-any cline-yes">2x</span>
|
|
608
|
+
<span class="cline-any cline-yes">2x</span>
|
|
609
|
+
<span class="cline-any cline-yes">2x</span>
|
|
610
610
|
<span class="cline-any cline-neutral"> </span>
|
|
611
611
|
<span class="cline-any cline-no"> </span>
|
|
612
612
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -616,13 +616,13 @@
|
|
|
616
616
|
<span class="cline-any cline-neutral"> </span>
|
|
617
617
|
<span class="cline-any cline-neutral"> </span>
|
|
618
618
|
<span class="cline-any cline-neutral"> </span>
|
|
619
|
-
<span class="cline-any cline-yes">
|
|
620
|
-
<span class="cline-any cline-
|
|
619
|
+
<span class="cline-any cline-yes">12x</span>
|
|
620
|
+
<span class="cline-any cline-yes">1x</span>
|
|
621
621
|
<span class="cline-any cline-neutral"> </span>
|
|
622
|
-
<span class="cline-any cline-
|
|
623
|
-
<span class="cline-any cline-
|
|
624
|
-
<span class="cline-any cline-
|
|
625
|
-
<span class="cline-any cline-
|
|
622
|
+
<span class="cline-any cline-yes">1x</span>
|
|
623
|
+
<span class="cline-any cline-yes">1x</span>
|
|
624
|
+
<span class="cline-any cline-yes">1x</span>
|
|
625
|
+
<span class="cline-any cline-yes">1x</span>
|
|
626
626
|
<span class="cline-any cline-no"> </span>
|
|
627
627
|
<span class="cline-any cline-neutral"> </span>
|
|
628
628
|
<span class="cline-any cline-no"> </span>
|
|
@@ -640,19 +640,19 @@
|
|
|
640
640
|
<span class="cline-any cline-neutral"> </span>
|
|
641
641
|
<span class="cline-any cline-neutral"> </span>
|
|
642
642
|
<span class="cline-any cline-neutral"> </span>
|
|
643
|
-
<span class="cline-any cline-yes">
|
|
644
|
-
<span class="cline-any cline-yes">2x</span>
|
|
643
|
+
<span class="cline-any cline-yes">12x</span>
|
|
645
644
|
<span class="cline-any cline-yes">3x</span>
|
|
645
|
+
<span class="cline-any cline-yes">9x</span>
|
|
646
646
|
<span class="cline-any cline-yes">2x</span>
|
|
647
647
|
<span class="cline-any cline-yes">2x</span>
|
|
648
648
|
<span class="cline-any cline-neutral"> </span>
|
|
649
|
-
<span class="cline-any cline-yes">
|
|
650
|
-
<span class="cline-any cline-yes">
|
|
651
|
-
<span class="cline-any cline-yes">
|
|
652
|
-
<span class="cline-any cline-yes">
|
|
649
|
+
<span class="cline-any cline-yes">7x</span>
|
|
650
|
+
<span class="cline-any cline-yes">7x</span>
|
|
651
|
+
<span class="cline-any cline-yes">7x</span>
|
|
652
|
+
<span class="cline-any cline-yes">7x</span>
|
|
653
653
|
<span class="cline-any cline-neutral"> </span>
|
|
654
654
|
<span class="cline-any cline-neutral"> </span>
|
|
655
|
-
<span class="cline-any cline-yes">
|
|
655
|
+
<span class="cline-any cline-yes">12x</span>
|
|
656
656
|
<span class="cline-any cline-neutral"> </span>
|
|
657
657
|
<span class="cline-any cline-neutral"> </span>
|
|
658
658
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -663,10 +663,10 @@
|
|
|
663
663
|
<span class="cline-any cline-neutral"> </span>
|
|
664
664
|
<span class="cline-any cline-neutral"> </span>
|
|
665
665
|
<span class="cline-any cline-neutral"> </span>
|
|
666
|
-
<span class="cline-any cline-yes">
|
|
667
|
-
<span class="cline-any cline-yes">
|
|
666
|
+
<span class="cline-any cline-yes">3x</span>
|
|
667
|
+
<span class="cline-any cline-yes">3x</span>
|
|
668
668
|
<span class="cline-any cline-neutral"> </span>
|
|
669
|
-
<span class="cline-any cline-yes">
|
|
669
|
+
<span class="cline-any cline-yes">3x</span>
|
|
670
670
|
<span class="cline-any cline-neutral"> </span>
|
|
671
671
|
<span class="cline-any cline-neutral"> </span>
|
|
672
672
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -710,7 +710,7 @@
|
|
|
710
710
|
<span class="cline-any cline-neutral"> </span>
|
|
711
711
|
<span class="cline-any cline-neutral"> </span>
|
|
712
712
|
<span class="cline-any cline-neutral"> </span>
|
|
713
|
-
<span class="cline-any cline-
|
|
713
|
+
<span class="cline-any cline-yes">3x</span>
|
|
714
714
|
<span class="cline-any cline-neutral"> </span>
|
|
715
715
|
<span class="cline-any cline-neutral"> </span>
|
|
716
716
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { debug } from "debug";
|
|
@@ -911,28 +911,28 @@ export default class Widgets {
|
|
|
911
911
|
let widget;
|
|
912
912
|
let displayOnLoad = !!config.displayOnLoad;
|
|
913
913
|
let displayCTA = false;
|
|
914
|
-
const opts = response.jsOptions ||
|
|
914
|
+
const opts = response.jsOptions || {};
|
|
915
915
|
|
|
916
916
|
const params = {
|
|
917
917
|
content: response.template,
|
|
918
|
-
type: config.widgetType ||
|
|
918
|
+
type: config.widgetType || opts.widget?.defaultWidgetType,
|
|
919
919
|
api: this.api,
|
|
920
920
|
domain: this.domain,
|
|
921
921
|
npmCdn: this.npmCdn,
|
|
922
922
|
context: context,
|
|
923
923
|
};
|
|
924
924
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
925
|
+
if (opts.widgetUrlMappings) {
|
|
926
|
+
opts.widgetUrlMappings.forEach((rule) => {
|
|
927
|
+
if (Widgets._matchesUrl(rule.url)) {
|
|
928
|
+
if (
|
|
929
929
|
rule.widgetType !== "CONVERSION_WIDGET" ||
|
|
930
|
-
(response.user
|
|
930
|
+
(response.user?.referredBy && response.user?.referredBy?.code)
|
|
931
931
|
) {
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
} else {
|
|
932
|
+
displayOnLoad = rule.displayOnLoad;
|
|
933
|
+
displayCTA = rule.showAsCTA;
|
|
934
|
+
_log(`Display ${rule.widgetType} on ${rule.url}`);
|
|
935
|
+
} else <span class="missing-if-branch" title="else path not taken" >E</span>{
|
|
936
936
|
<span class="cstat-no" title="statement not covered" > _log(</span>
|
|
937
937
|
`Don't display ${rule.widgetType} when no referral on widget rule match ${rule.url}`
|
|
938
938
|
);
|
|
@@ -941,13 +941,13 @@ export default class Widgets {
|
|
|
941
941
|
});
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
|
|
945
|
-
|
|
944
|
+
if (opts.fuelTankAutofillUrls) {
|
|
945
|
+
_log("We found a fuel tank autofill!");
|
|
946
946
|
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
947
|
+
opts.fuelTankAutofillUrls.forEach(({ url, formSelector }) => {
|
|
948
|
+
if (Widgets._matchesUrl(url)) {
|
|
949
|
+
_log("Fuel Tank URL matches");
|
|
950
|
+
<span class="missing-if-branch" title="if path not taken" >I</span>if (response.user?.referredBy && <span class="branch-1 cbranch-no" title="branch not covered" >response.user?.referredBy?.code)</span> {
|
|
951
951
|
const formAutofill = <span class="cstat-no" title="statement not covered" >document.querySelector(formSelector);</span>
|
|
952
952
|
|
|
953
953
|
<span class="cstat-no" title="statement not covered" > if (formAutofill) {</span>
|
|
@@ -974,7 +974,7 @@ export default class Widgets {
|
|
|
974
974
|
_log("display popup on load");
|
|
975
975
|
widget = new PopupWidget(params);
|
|
976
976
|
widget.load();
|
|
977
|
-
|
|
977
|
+
if (displayOnLoad) widget.open();
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
return widget;
|
|
@@ -1033,9 +1033,9 @@ export default class Widgets {
|
|
|
1033
1033
|
* @param {string} rule A regular expression
|
|
1034
1034
|
* @returns {boolean} true if rule matches Url, false otherwise
|
|
1035
1035
|
*/
|
|
1036
|
-
private
|
|
1036
|
+
private static _matchesUrl(rule) {
|
|
1037
1037
|
// If there were no matches, null is returned.
|
|
1038
|
-
|
|
1038
|
+
return window.location.href.match(new RegExp(rule)) ? true : <span class="branch-1 cbranch-no" title="branch not covered" >false;</span>
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
</pre></td></tr></table></pre>
|
|
@@ -1045,7 +1045,7 @@ export default class Widgets {
|
|
|
1045
1045
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
1046
1046
|
Code coverage generated by
|
|
1047
1047
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
1048
|
-
at 2023-07-18T18:
|
|
1048
|
+
at 2023-07-18T18:59:28.021Z
|
|
1049
1049
|
</div>
|
|
1050
1050
|
<script src="../prettify.js"></script>
|
|
1051
1051
|
<script>
|
package/dist/squatch.d.ts
CHANGED
|
@@ -74,21 +74,6 @@ export declare function ready(fn: () => any): void;
|
|
|
74
74
|
* @returns {void}
|
|
75
75
|
*/
|
|
76
76
|
export declare function autofill(selector: string): void;
|
|
77
|
-
/**
|
|
78
|
-
* Overrides the default function that submits the user email. If you have
|
|
79
|
-
* Security enabled, the email needs to be signed before it's submitted.
|
|
80
|
-
*
|
|
81
|
-
* @param {function} fn Callback function for the 'submit_email' event.
|
|
82
|
-
* @returns {void}
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* squatch.submitEmail(function(target, widget, email) {
|
|
86
|
-
* // Sign email and generate jwt token
|
|
87
|
-
* var jwt = 'token';
|
|
88
|
-
* widget.reload(email, jwt);
|
|
89
|
-
* });
|
|
90
|
-
*/
|
|
91
|
-
export declare function submitEmail(fn: (target: any, widget: any, email: any) => any): void;
|
|
92
77
|
/**
|
|
93
78
|
* Manually set the _saasquatch cookie as a 1st party cookie if available as a URL parameter on the current page.
|
|
94
79
|
* This runs automatically immediately when squatch-js is loaded, except when window.SaaSquatchDoNotAutoDrop is true.
|
package/dist/squatch.esm.js
CHANGED
|
@@ -678,6 +678,7 @@ class Widget {
|
|
|
678
678
|
function delay(duration) {
|
|
679
679
|
return new Promise(function (resolve, reject) {
|
|
680
680
|
setTimeout(function () {
|
|
681
|
+
/* istanbul ignore next */
|
|
681
682
|
resolve(() => {});
|
|
682
683
|
}, duration);
|
|
683
684
|
});
|
|
@@ -1221,15 +1222,17 @@ class Widgets {
|
|
|
1221
1222
|
|
|
1222
1223
|
|
|
1223
1224
|
_renderWidget(response, config, context) {
|
|
1225
|
+
var _opts$widget;
|
|
1226
|
+
|
|
1224
1227
|
_log$4("Rendering Widget...");
|
|
1225
1228
|
|
|
1226
1229
|
if (!response) throw new Error("Unable to get a response");
|
|
1227
1230
|
var widget;
|
|
1228
1231
|
var displayOnLoad = !!config.displayOnLoad;
|
|
1229
|
-
var opts = response.jsOptions ||
|
|
1232
|
+
var opts = response.jsOptions || {};
|
|
1230
1233
|
var params = {
|
|
1231
1234
|
content: response.template,
|
|
1232
|
-
type: config.widgetType || opts.widget.defaultWidgetType,
|
|
1235
|
+
type: config.widgetType || ((_opts$widget = opts.widget) == null ? void 0 : _opts$widget.defaultWidgetType),
|
|
1233
1236
|
api: this.api,
|
|
1234
1237
|
domain: this.domain,
|
|
1235
1238
|
npmCdn: this.npmCdn,
|
|
@@ -1239,7 +1242,9 @@ class Widgets {
|
|
|
1239
1242
|
if (opts.widgetUrlMappings) {
|
|
1240
1243
|
opts.widgetUrlMappings.forEach(rule => {
|
|
1241
1244
|
if (Widgets._matchesUrl(rule.url)) {
|
|
1242
|
-
|
|
1245
|
+
var _response$user, _response$user2, _response$user2$refer;
|
|
1246
|
+
|
|
1247
|
+
if (rule.widgetType !== "CONVERSION_WIDGET" || (_response$user = response.user) != null && _response$user.referredBy && (_response$user2 = response.user) != null && (_response$user2$refer = _response$user2.referredBy) != null && _response$user2$refer.code) {
|
|
1243
1248
|
displayOnLoad = rule.displayOnLoad;
|
|
1244
1249
|
|
|
1245
1250
|
_log$4("Display " + rule.widgetType + " on " + rule.url);
|
|
@@ -1260,9 +1265,11 @@ class Widgets {
|
|
|
1260
1265
|
} = _ref;
|
|
1261
1266
|
|
|
1262
1267
|
if (Widgets._matchesUrl(url)) {
|
|
1268
|
+
var _response$user3, _response$user4, _response$user4$refer;
|
|
1269
|
+
|
|
1263
1270
|
_log$4("Fuel Tank URL matches");
|
|
1264
1271
|
|
|
1265
|
-
if (response.user.referredBy && response.user.referredBy.code) {
|
|
1272
|
+
if ((_response$user3 = response.user) != null && _response$user3.referredBy && (_response$user4 = response.user) != null && (_response$user4$refer = _response$user4.referredBy) != null && _response$user4$refer.code) {
|
|
1266
1273
|
var formAutofill = document.querySelector(formSelector);
|
|
1267
1274
|
|
|
1268
1275
|
if (formAutofill) {
|
|
@@ -1276,7 +1283,7 @@ class Widgets {
|
|
|
1276
1283
|
}
|
|
1277
1284
|
|
|
1278
1285
|
if (config.engagementMedium === "EMBED") {
|
|
1279
|
-
this._renderEmbedWidget(params, params.context.container);
|
|
1286
|
+
widget = this._renderEmbedWidget(params, params.context.container);
|
|
1280
1287
|
} else if (config.engagementMedium === "POPUP") {
|
|
1281
1288
|
widget = this._renderPopupWidget(params);
|
|
1282
1289
|
if (displayOnLoad) widget.open();
|
|
@@ -2009,25 +2016,6 @@ function autofill(selector) {
|
|
|
2009
2016
|
// @ts-ignore -- will throw occasionally throw a null pointer exception at runtime
|
|
2010
2017
|
widgets().autofill(selector);
|
|
2011
2018
|
}
|
|
2012
|
-
/**
|
|
2013
|
-
* Overrides the default function that submits the user email. If you have
|
|
2014
|
-
* Security enabled, the email needs to be signed before it's submitted.
|
|
2015
|
-
*
|
|
2016
|
-
* @param {function} fn Callback function for the 'submit_email' event.
|
|
2017
|
-
* @returns {void}
|
|
2018
|
-
*
|
|
2019
|
-
* @example
|
|
2020
|
-
* squatch.submitEmail(function(target, widget, email) {
|
|
2021
|
-
* // Sign email and generate jwt token
|
|
2022
|
-
* var jwt = 'token';
|
|
2023
|
-
* widget.reload(email, jwt);
|
|
2024
|
-
* });
|
|
2025
|
-
*/
|
|
2026
|
-
|
|
2027
|
-
function submitEmail(fn) {
|
|
2028
|
-
// @ts-ignore -- will throw occasionally throw a null pointer exception at runtime
|
|
2029
|
-
widgets().submitEmail(fn);
|
|
2030
|
-
}
|
|
2031
2019
|
/**
|
|
2032
2020
|
* Manually set the _saasquatch cookie as a 1st party cookie if available as a URL parameter on the current page.
|
|
2033
2021
|
* This runs automatically immediately when squatch-js is loaded, except when window.SaaSquatchDoNotAutoDrop is true.
|
|
@@ -2052,5 +2040,5 @@ if (typeof document !== "undefined" && !window.SaaSquatchDoNotAutoDrop) {
|
|
|
2052
2040
|
|
|
2053
2041
|
if (typeof document !== "undefined") asyncLoad();
|
|
2054
2042
|
|
|
2055
|
-
export { DeclarativeEmbedWidget, DeclarativePopupWidget, EmbedWidget, PopupWidget, WidgetApi, Widgets, _auto, api, autofill, events, help, init, pushCookie, ready,
|
|
2043
|
+
export { DeclarativeEmbedWidget, DeclarativePopupWidget, EmbedWidget, PopupWidget, WidgetApi, Widgets, _auto, api, autofill, events, help, init, pushCookie, ready, widget, widgets };
|
|
2056
2044
|
//# sourceMappingURL=squatch.esm.js.map
|