@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 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, Squatchjs respects configurations set on the following:
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, Squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
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">
@@ -1,25 +1,26 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1690821320463" clover="3.2.0">
3
- <project timestamp="1690821320463" name="All files">
4
- <metrics statements="786" coveredstatements="662" conditionals="370" coveredconditionals="281" methods="130" coveredmethods="106" elements="1286" coveredelements="1049" complexity="0" loc="786" ncloc="786" packages="5" files="19" classes="19"/>
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="78" coveredstatements="60" conditionals="21" coveredconditionals="13" methods="16" coveredmethods="8"/>
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="14" coveredstatements="5" conditionals="9" coveredconditionals="5" methods="4" coveredmethods="1"/>
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="25" count="3" type="cond" truecount="2" falsecount="0"/>
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="28" count="3" type="cond" truecount="1" falsecount="2"/>
14
- <line num="29" count="0" type="cond" truecount="0" falsecount="2"/>
15
- <line num="31" count="0" type="stmt"/>
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="38" count="0" type="stmt"/>
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="42" count="0" type="stmt"/>
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="158" coveredconditionals="138" methods="52" coveredmethods="49"/>
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="28" coveredconditionals="24" methods="7" coveredmethods="7"/>
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="38" type="cond" truecount="2" falsecount="0"/>
435
- <line num="67" count="38" type="stmt"/>
436
- <line num="79" count="38" type="stmt"/>
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="2" falsecount="0"/>
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="186" count="6" type="stmt"/>
616
- <line num="218" count="6" type="stmt"/>
617
- <line num="224" count="69" type="stmt"/>
618
- <line num="225" count="69" type="cond" truecount="1" falsecount="0"/>
619
- <line num="226" count="1" type="stmt"/>
620
- <line num="227" count="68" type="stmt"/>
621
- <line num="230" count="286" type="stmt"/>
622
- <line num="232" count="286" type="stmt"/>
623
- <line num="234" count="286" type="cond" truecount="2" falsecount="0"/>
624
- <line num="239" count="286" type="stmt"/>
625
- <line num="242" count="68" type="stmt"/>
626
- <line num="243" count="68" type="stmt"/>
627
- <line num="244" count="286" type="stmt"/>
628
- <line num="245" count="286" type="cond" truecount="1" falsecount="0"/>
629
- <line num="246" count="276" type="stmt"/>
630
- <line num="248" count="62" type="cond" truecount="1" falsecount="0"/>
631
- <line num="249" count="52" type="stmt"/>
632
- <line num="251" count="10" type="stmt"/>
633
- <line num="261" count="10" type="stmt"/>
634
- <line num="262" count="10" type="cond" truecount="1" falsecount="0"/>
635
- <line num="263" count="9" type="stmt"/>
636
- <line num="265" count="9" type="cond" truecount="2" falsecount="0"/>
637
- <line num="267" count="9" type="cond" truecount="1" falsecount="0"/>
638
- <line num="268" count="1" type="stmt"/>
639
- <line num="273" count="8" type="cond" truecount="2" falsecount="0"/>
640
- <line num="274" count="3" type="cond" truecount="1" falsecount="0"/>
641
- <line num="276" count="2" type="stmt"/>
642
- <line num="285" count="2" type="stmt"/>
643
- <line num="291" count="5" type="cond" truecount="2" falsecount="0"/>
644
- <line num="292" count="4" type="stmt"/>
645
- <line num="299" count="1" type="stmt"/>
646
- <line num="302" count="6" type="stmt"/>
647
- <line num="304" count="5" type="cond" truecount="1" falsecount="0"/>
648
- <line num="305" count="5" type="stmt"/>
649
- <line num="308" count="5" type="stmt"/>
650
- <line num="312" count="2" type="stmt"/>
651
- <line num="315" count="2" type="cond" truecount="2" falsecount="0"/>
652
- <line num="321" count="1" type="stmt"/>
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="329" count="5" type="stmt"/>
657
- <line num="331" count="5" type="cond" truecount="1" falsecount="0"/>
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="333" count="2" type="stmt"/>
660
- <line num="335" count="2" type="stmt"/>
661
- <line num="339" count="2" type="cond" truecount="2" falsecount="0"/>
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="344" count="2" type="stmt"/>
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="349" count="2" type="stmt"/>
667
- <line num="355" count="276" type="stmt"/>
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"/>