@saasquatch/squatch-js 2.6.0-7 → 2.6.0-8
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/README.md +14 -5
- package/coverage/clover.xml +65 -64
- package/coverage/coverage-final.json +5 -5
- package/coverage/lcov.info +125 -119
- package/dist/async.d.ts +2 -2
- package/dist/squatch.esm.js +18 -22
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +18 -22
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/widgets/Widgets.d.ts +8 -8
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Include either of the squatchjs generated web-components in your page's HTML to
|
|
|
43
43
|
<!-- POPUP WIDGET -->
|
|
44
44
|
<squatch-popup widget="WIDGET_TYPE"><!-- Widget is rendered here --></squatch-popup>
|
|
45
45
|
```
|
|
46
|
-
For rendering widgets and API calls,
|
|
46
|
+
For rendering widgets and API calls, squatchjs respects configurations set on the following:
|
|
47
47
|
- `window.squatchToken`: Signed JWT for calls to the SaaSquatch API -- [How to generate valid JWT Tokens](https://docs.saasquatch.com/topics/json-web-tokens#example-building-the-jwt)
|
|
48
48
|
- `window.squatchTenant`: SaaSquatch tenant alias
|
|
49
49
|
- `window.squatchConfig`: Additional configuration overrides (Optional)
|
|
@@ -140,7 +140,7 @@ squatch.api().upsertUser({...});
|
|
|
140
140
|
|
|
141
141
|
### `squatch-embed`
|
|
142
142
|
```html
|
|
143
|
-
<squatch-embed widget="WIDGET_TYPE" [ container="#selector" ]>
|
|
143
|
+
<squatch-embed widget="WIDGET_TYPE" [ container="#selector" | locale="en_US" ]>
|
|
144
144
|
<!-- Children of squatch-embed act as a loading state -->
|
|
145
145
|
Loading...
|
|
146
146
|
</squatch-embed>
|
|
@@ -148,14 +148,17 @@ squatch.api().upsertUser({...});
|
|
|
148
148
|
|
|
149
149
|
- `widget`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
|
|
150
150
|
- Required
|
|
151
|
+
- Changing this attribute's value causes the widget to reload.
|
|
151
152
|
- `container`: A CSS selector for a container element to use as the parent of the widget's iframe.
|
|
152
153
|
- Default: `null`
|
|
153
154
|
- Note, if no container is specified, the widget iframe will attach to the shadow DOM of `squatch-embed`.
|
|
154
|
-
|
|
155
|
+
- `locale`: Locale that determines the widget translation displayed. Should be of the form "xx_XX".
|
|
156
|
+
- Default: Browser's current locale
|
|
157
|
+
- Changing this attribute's value causes the widget to reload.
|
|
155
158
|
|
|
156
159
|
### `squatch-popup`
|
|
157
160
|
```html
|
|
158
|
-
<squatch-embed widget="WIDGET_TYPE" [ open ]>
|
|
161
|
+
<squatch-embed widget="WIDGET_TYPE" [ open | container="#selector" | locale="en_US" ]>
|
|
159
162
|
<!-- Clicking a child of squatch-popup opens the popup -->
|
|
160
163
|
<button>Click me to open</button>
|
|
161
164
|
</squatch-embed>
|
|
@@ -165,11 +168,17 @@ squatch.api().upsertUser({...});
|
|
|
165
168
|
- Required
|
|
166
169
|
- `open: boolean`: Whether to the popup is open when loaded into the page
|
|
167
170
|
- Default: `false`
|
|
171
|
+
- `container`: A CSS selector for a container element to use as the parent of the widget's iframe.
|
|
172
|
+
- Default: `null`
|
|
173
|
+
- Note, if no container is specified, the widget iframe will attach to the shadow DOM of `squatch-embed`.
|
|
174
|
+
- `locale`: Locale that determines the widget translation displayed. Should be of the form "xx_XX".
|
|
175
|
+
- Default: Browser's current locale
|
|
176
|
+
- Changing this attribute's value causes the widget to reload.
|
|
168
177
|
|
|
169
178
|
## Legacy
|
|
170
179
|
|
|
171
180
|
### Rendering a widget via Widgets API
|
|
172
|
-
Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise,
|
|
181
|
+
Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise, squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
|
|
173
182
|
|
|
174
183
|
```html
|
|
175
184
|
<script type="text/javascript">
|
package/coverage/clover.xml
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
4
|
-
<metrics statements="
|
|
2
|
+
<coverage generated="1690993599382" clover="3.2.0">
|
|
3
|
+
<project timestamp="1690993599383" name="All files">
|
|
4
|
+
<metrics statements="787" coveredstatements="663" conditionals="373" coveredconditionals="283" methods="131" coveredmethods="106" elements="1291" coveredelements="1052" complexity="0" loc="787" ncloc="787" packages="5" files="19" classes="19"/>
|
|
5
5
|
<package name="src">
|
|
6
|
-
<metrics statements="
|
|
6
|
+
<metrics statements="79" coveredstatements="61" conditionals="23" coveredconditionals="14" methods="17" coveredmethods="8"/>
|
|
7
7
|
<file name="async.ts" path="/Users/Coleton/saasquatch/squatch-js/src/async.ts">
|
|
8
|
-
<metrics statements="
|
|
8
|
+
<metrics statements="15" coveredstatements="6" conditionals="11" coveredconditionals="6" methods="5" coveredmethods="1"/>
|
|
9
9
|
<line num="22" count="3" type="stmt"/>
|
|
10
10
|
<line num="23" count="3" type="stmt"/>
|
|
11
|
-
<line num="
|
|
11
|
+
<line num="24" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
12
12
|
<line num="26" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
13
|
-
<line num="
|
|
14
|
-
<line num="29" count="
|
|
15
|
-
<line num="
|
|
13
|
+
<line num="27" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
14
|
+
<line num="29" count="3" type="cond" truecount="1" falsecount="2"/>
|
|
15
|
+
<line num="30" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
16
16
|
<line num="32" count="0" type="stmt"/>
|
|
17
17
|
<line num="33" count="0" type="stmt"/>
|
|
18
18
|
<line num="34" count="0" type="stmt"/>
|
|
19
|
-
<line num="
|
|
19
|
+
<line num="35" count="0" type="stmt"/>
|
|
20
20
|
<line num="39" count="0" type="stmt"/>
|
|
21
21
|
<line num="40" count="0" type="stmt"/>
|
|
22
|
-
<line num="
|
|
22
|
+
<line num="41" count="0" type="stmt"/>
|
|
23
|
+
<line num="43" count="0" type="stmt"/>
|
|
23
24
|
</file>
|
|
24
25
|
<file name="docs.ts" path="/Users/Coleton/saasquatch/squatch-js/src/docs.ts">
|
|
25
26
|
<metrics statements="2" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="1" coveredmethods="0"/>
|
|
@@ -400,9 +401,9 @@
|
|
|
400
401
|
</file>
|
|
401
402
|
</package>
|
|
402
403
|
<package name="src.widgets">
|
|
403
|
-
<metrics statements="348" coveredstatements="333" conditionals="
|
|
404
|
+
<metrics statements="348" coveredstatements="333" conditionals="159" coveredconditionals="139" methods="52" coveredmethods="49"/>
|
|
404
405
|
<file name="EmbedWidget.ts" path="/Users/Coleton/saasquatch/squatch-js/src/widgets/EmbedWidget.ts">
|
|
405
|
-
<metrics statements="60" coveredstatements="57" conditionals="
|
|
406
|
+
<metrics statements="60" coveredstatements="57" conditionals="29" coveredconditionals="25" methods="7" coveredmethods="7"/>
|
|
406
407
|
<line num="3" count="5" type="stmt"/>
|
|
407
408
|
<line num="4" count="5" type="stmt"/>
|
|
408
409
|
<line num="5" count="5" type="stmt"/>
|
|
@@ -431,9 +432,9 @@
|
|
|
431
432
|
<line num="59" count="38" type="stmt"/>
|
|
432
433
|
<line num="62" count="38" type="stmt"/>
|
|
433
434
|
<line num="63" count="38" type="stmt"/>
|
|
434
|
-
<line num="64" count="
|
|
435
|
-
<line num="67" count="
|
|
436
|
-
<line num="79" count="
|
|
435
|
+
<line num="64" count="37" type="cond" truecount="2" falsecount="0"/>
|
|
436
|
+
<line num="67" count="37" type="stmt"/>
|
|
437
|
+
<line num="79" count="37" type="stmt"/>
|
|
437
438
|
<line num="80" count="34" type="stmt"/>
|
|
438
439
|
<line num="82" count="34" type="cond" truecount="1" falsecount="0"/>
|
|
439
440
|
<line num="83" count="2" type="stmt"/>
|
|
@@ -458,7 +459,7 @@
|
|
|
458
459
|
<line num="121" count="2" type="stmt"/>
|
|
459
460
|
<line num="125" count="3" type="stmt"/>
|
|
460
461
|
<line num="129" count="34" type="stmt"/>
|
|
461
|
-
<line num="131" count="34" type="cond" truecount="
|
|
462
|
+
<line num="131" count="34" type="cond" truecount="3" falsecount="0"/>
|
|
462
463
|
<line num="133" count="34" type="stmt"/>
|
|
463
464
|
<line num="135" count="34" type="cond" truecount="3" falsecount="0"/>
|
|
464
465
|
<line num="138" count="40" type="stmt"/>
|
|
@@ -612,60 +613,60 @@
|
|
|
612
613
|
<line num="165" count="3" type="stmt"/>
|
|
613
614
|
<line num="174" count="1" type="stmt"/>
|
|
614
615
|
<line num="179" count="1" type="stmt"/>
|
|
615
|
-
<line num="
|
|
616
|
-
<line num="
|
|
617
|
-
<line num="
|
|
618
|
-
<line num="
|
|
619
|
-
<line num="
|
|
620
|
-
<line num="
|
|
621
|
-
<line num="
|
|
622
|
-
<line num="
|
|
623
|
-
<line num="
|
|
624
|
-
<line num="
|
|
625
|
-
<line num="
|
|
626
|
-
<line num="
|
|
627
|
-
<line num="
|
|
628
|
-
<line num="
|
|
629
|
-
<line num="
|
|
630
|
-
<line num="
|
|
631
|
-
<line num="
|
|
632
|
-
<line num="
|
|
633
|
-
<line num="
|
|
634
|
-
<line num="
|
|
635
|
-
<line num="
|
|
636
|
-
<line num="
|
|
637
|
-
<line num="
|
|
638
|
-
<line num="
|
|
639
|
-
<line num="
|
|
640
|
-
<line num="
|
|
641
|
-
<line num="
|
|
642
|
-
<line num="
|
|
643
|
-
<line num="
|
|
644
|
-
<line num="
|
|
645
|
-
<line num="
|
|
646
|
-
<line num="
|
|
647
|
-
<line num="
|
|
648
|
-
<line num="
|
|
649
|
-
<line num="
|
|
650
|
-
<line num="
|
|
651
|
-
<line num="
|
|
652
|
-
<line num="
|
|
616
|
+
<line num="185" count="6" type="stmt"/>
|
|
617
|
+
<line num="217" count="6" type="stmt"/>
|
|
618
|
+
<line num="223" count="68" type="stmt"/>
|
|
619
|
+
<line num="224" count="68" type="cond" truecount="1" falsecount="0"/>
|
|
620
|
+
<line num="225" count="1" type="stmt"/>
|
|
621
|
+
<line num="226" count="67" type="stmt"/>
|
|
622
|
+
<line num="229" count="285" type="stmt"/>
|
|
623
|
+
<line num="231" count="285" type="stmt"/>
|
|
624
|
+
<line num="233" count="285" type="cond" truecount="2" falsecount="0"/>
|
|
625
|
+
<line num="238" count="285" type="stmt"/>
|
|
626
|
+
<line num="241" count="67" type="stmt"/>
|
|
627
|
+
<line num="242" count="67" type="stmt"/>
|
|
628
|
+
<line num="243" count="285" type="stmt"/>
|
|
629
|
+
<line num="244" count="285" type="cond" truecount="1" falsecount="0"/>
|
|
630
|
+
<line num="245" count="275" type="stmt"/>
|
|
631
|
+
<line num="247" count="62" type="cond" truecount="1" falsecount="0"/>
|
|
632
|
+
<line num="248" count="52" type="stmt"/>
|
|
633
|
+
<line num="250" count="10" type="stmt"/>
|
|
634
|
+
<line num="260" count="10" type="stmt"/>
|
|
635
|
+
<line num="261" count="10" type="cond" truecount="1" falsecount="0"/>
|
|
636
|
+
<line num="262" count="9" type="stmt"/>
|
|
637
|
+
<line num="264" count="9" type="cond" truecount="2" falsecount="0"/>
|
|
638
|
+
<line num="266" count="9" type="cond" truecount="1" falsecount="0"/>
|
|
639
|
+
<line num="267" count="1" type="stmt"/>
|
|
640
|
+
<line num="272" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
641
|
+
<line num="273" count="3" type="cond" truecount="1" falsecount="0"/>
|
|
642
|
+
<line num="275" count="2" type="stmt"/>
|
|
643
|
+
<line num="284" count="2" type="stmt"/>
|
|
644
|
+
<line num="290" count="5" type="cond" truecount="2" falsecount="0"/>
|
|
645
|
+
<line num="291" count="4" type="stmt"/>
|
|
646
|
+
<line num="298" count="1" type="stmt"/>
|
|
647
|
+
<line num="301" count="6" type="stmt"/>
|
|
648
|
+
<line num="303" count="5" type="cond" truecount="1" falsecount="0"/>
|
|
649
|
+
<line num="304" count="5" type="stmt"/>
|
|
650
|
+
<line num="307" count="5" type="stmt"/>
|
|
651
|
+
<line num="311" count="2" type="stmt"/>
|
|
652
|
+
<line num="314" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
653
|
+
<line num="320" count="1" type="stmt"/>
|
|
654
|
+
<line num="325" count="5" type="stmt"/>
|
|
653
655
|
<line num="326" count="5" type="stmt"/>
|
|
654
656
|
<line num="327" count="5" type="stmt"/>
|
|
655
657
|
<line num="328" count="5" type="stmt"/>
|
|
656
|
-
<line num="
|
|
657
|
-
<line num="331" count="
|
|
658
|
+
<line num="330" count="5" type="cond" truecount="1" falsecount="0"/>
|
|
659
|
+
<line num="331" count="2" type="stmt"/>
|
|
658
660
|
<line num="332" count="2" type="stmt"/>
|
|
659
|
-
<line num="
|
|
660
|
-
<line num="
|
|
661
|
-
<line num="
|
|
661
|
+
<line num="334" count="2" type="stmt"/>
|
|
662
|
+
<line num="338" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
663
|
+
<line num="342" count="2" type="stmt"/>
|
|
662
664
|
<line num="343" count="2" type="stmt"/>
|
|
663
|
-
<line num="
|
|
665
|
+
<line num="346" count="2" type="stmt"/>
|
|
664
666
|
<line num="347" count="2" type="stmt"/>
|
|
665
667
|
<line num="348" count="2" type="stmt"/>
|
|
666
|
-
<line num="
|
|
667
|
-
<line num="355" count="
|
|
668
|
-
<line num="356" count="276" type="stmt"/>
|
|
668
|
+
<line num="354" count="275" type="stmt"/>
|
|
669
|
+
<line num="355" count="275" type="stmt"/>
|
|
669
670
|
</file>
|
|
670
671
|
<file name="Widgets.ts" path="/Users/Coleton/saasquatch/squatch-js/src/widgets/Widgets.ts">
|
|
671
672
|
<metrics statements="91" coveredstatements="91" conditionals="33" coveredconditionals="33" methods="11" coveredmethods="11"/>
|