@saasquatch/squatch-js 2.5.1-4 → 2.5.1-6

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.5.1] - 2023-06-07
11
+
12
+ ### Fixed
13
+
14
+ - Race condition with auto-popup fixed when using the squatch-js package from NPM or on Safari
15
+
10
16
  ## [2.5.0] - 2023-05-16
11
17
 
12
18
  ### Removed
@@ -30,7 +36,7 @@ var initObj = {
30
36
  squatch
31
37
  .widget(initObj)
32
38
  .then(function (response) {
33
- const widget = response.widget
39
+ const widget = response.widget;
34
40
  })
35
41
  .catch(function (error) {
36
42
  console.log(error);
@@ -44,6 +50,7 @@ squatch
44
50
  ## [2.4.3] - 2023-04-20
45
51
 
46
52
  ### Changed
53
+
47
54
  - Updated license copyright to be in line with SaaSquatch open-source policy.
48
55
 
49
56
  ## [2.4.2] - 2023-04-10
@@ -287,8 +294,9 @@ No release notes.
287
294
 
288
295
  No release notes.
289
296
 
290
- [unreleased]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.5.0...HEAD
291
- [2.5.0]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.1...@saasquatch%2Fsquatch-js@2.5.0
297
+ [unreleased]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.5.1...HEAD
298
+ [2.5.1]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.5.0...@saasquatch%2Fsquatch-js@2.5.1
299
+ [2.5.0]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.3...@saasquatch%2Fsquatch-js@2.5.0
292
300
  [2.4.3]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.2...@saasquatch%2Fsquatch-js@2.4.3
293
301
  [2.4.2]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.1...@saasquatch%2Fsquatch-js@2.4.2
294
302
  [2.4.1]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.0...@saasquatch%2Fsquatch-js@2.4.1
package/dist/squatch.d.ts CHANGED
@@ -39,7 +39,7 @@ export declare function widget(widgetConfig: WidgetConfig): Promise<WidgetResult
39
39
  /**
40
40
  * Extracts widget configuration from `_saasquatchExtra` UTM parameter. Initialises `squatch` and renders the widget as a {@link PopupWidget} via static instanct of {@link Widgets}.
41
41
  */
42
- export declare function _auto(configIn: ConfigOptions): Promise<WidgetResult | undefined> | undefined;
42
+ export declare function auto(configIn: ConfigOptions): Promise<WidgetResult | undefined> | undefined;
43
43
  /**
44
44
  * Initializes the static `squatch` global. This sets up:
45
45
  *
@@ -1599,21 +1599,21 @@ function _validateTrackOptions(raw) {
1599
1599
 
1600
1600
  /** @hidden */
1601
1601
  function asyncLoad() {
1602
+ var _window$squatch;
1603
+
1602
1604
  const loaded = window.squatch || null;
1603
1605
  const cached = window._squatch || null;
1606
+ const auto = (_window$squatch = window.squatch) == null ? void 0 : _window$squatch.auto;
1607
+ console.log({
1608
+ loaded,
1609
+ cached,
1610
+ auto
1611
+ });
1604
1612
 
1605
- function auto() {
1606
- setTimeout(() => {
1607
- if (typeof window.squatch._auto !== "function") return auto();
1608
-
1609
- window.squatch._auto();
1610
- }, 0);
1611
- }
1612
-
1613
- if (loaded && cached) {
1613
+ if (loaded && cached && auto) {
1614
1614
  const ready = cached.ready || [];
1615
1615
  ready.forEach(cb => setTimeout(() => cb(), 0));
1616
- auto(); // @ts-ignore -- intetionally deletes `_squatch` to cleanup initialization
1616
+ setTimeout(() => auto(), 0); // @ts-ignore -- intetionally deletes `_squatch` to cleanup initialization
1617
1617
 
1618
1618
  window._squatch = undefined;
1619
1619
 
@@ -2241,7 +2241,7 @@ function widget(widgetConfig) {
2241
2241
  * Extracts widget configuration from `_saasquatchExtra` UTM parameter. Initialises `squatch` and renders the widget as a {@link PopupWidget} via static instanct of {@link Widgets}.
2242
2242
  */
2243
2243
 
2244
- function _auto(configIn) {
2244
+ function auto(configIn) {
2245
2245
  const configs = _getAutoConfig(configIn);
2246
2246
 
2247
2247
  if (configs) {
@@ -2359,5 +2359,5 @@ if (typeof document !== "undefined" && !window.SaaSquatchDoNotAutoDrop) {
2359
2359
 
2360
2360
  if (typeof document !== "undefined") asyncLoad();
2361
2361
 
2362
- export { CtaWidget, EmbedWidget, PopupWidget, WidgetApi, Widgets, _auto, api, autofill, events, help, init, pushCookie, ready, submitEmail, widget, widgets };
2362
+ export { CtaWidget, EmbedWidget, PopupWidget, WidgetApi, Widgets, api, auto, autofill, events, help, init, pushCookie, ready, submitEmail, widget, widgets };
2363
2363
  //# sourceMappingURL=squatch.esm.js.map
package/dist/squatch.js CHANGED
@@ -1626,21 +1626,21 @@ function _validateTrackOptions(raw) {
1626
1626
 
1627
1627
  /** @hidden */
1628
1628
  function asyncLoad() {
1629
+ var _window$squatch;
1630
+
1629
1631
  const loaded = window.squatch || null;
1630
1632
  const cached = window._squatch || null;
1633
+ const auto = (_window$squatch = window.squatch) == null ? void 0 : _window$squatch.auto;
1634
+ console.log({
1635
+ loaded,
1636
+ cached,
1637
+ auto
1638
+ });
1631
1639
 
1632
- function auto() {
1633
- setTimeout(() => {
1634
- if (typeof window.squatch._auto !== "function") return auto();
1635
-
1636
- window.squatch._auto();
1637
- }, 0);
1638
- }
1639
-
1640
- if (loaded && cached) {
1640
+ if (loaded && cached && auto) {
1641
1641
  const ready = cached.ready || [];
1642
1642
  ready.forEach(cb => setTimeout(() => cb(), 0));
1643
- auto(); // @ts-ignore -- intetionally deletes `_squatch` to cleanup initialization
1643
+ setTimeout(() => auto(), 0); // @ts-ignore -- intetionally deletes `_squatch` to cleanup initialization
1644
1644
 
1645
1645
  window._squatch = undefined;
1646
1646
 
@@ -2268,7 +2268,7 @@ function widget(widgetConfig) {
2268
2268
  * Extracts widget configuration from `_saasquatchExtra` UTM parameter. Initialises `squatch` and renders the widget as a {@link PopupWidget} via static instanct of {@link Widgets}.
2269
2269
  */
2270
2270
 
2271
- function _auto(configIn) {
2271
+ function auto(configIn) {
2272
2272
  const configs = _getAutoConfig(configIn);
2273
2273
 
2274
2274
  if (configs) {
@@ -2391,8 +2391,8 @@ exports.EmbedWidget = EmbedWidget;
2391
2391
  exports.PopupWidget = PopupWidget;
2392
2392
  exports.WidgetApi = WidgetApi;
2393
2393
  exports.Widgets = Widgets;
2394
- exports._auto = _auto;
2395
2394
  exports.api = api;
2395
+ exports.auto = auto;
2396
2396
  exports.autofill = autofill;
2397
2397
  exports.events = events;
2398
2398
  exports.help = help;