@saasquatch/squatch-js 2.6.0-4 → 2.6.0-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.
Files changed (37) hide show
  1. package/coverage/clover.xml +849 -64
  2. package/coverage/coverage-final.json +19 -1
  3. package/coverage/lcov-report/DeclarativeWidget.ts.html +298 -118
  4. package/coverage/lcov-report/Widgets.ts.html +70 -22
  5. package/coverage/lcov-report/api/AnalyticsApi.ts.html +38 -38
  6. package/coverage/lcov-report/api/EventsApi.ts.html +352 -0
  7. package/coverage/lcov-report/api/WidgetApi.ts.html +57 -30
  8. package/coverage/lcov-report/api/graphql.ts.html +1 -1
  9. package/coverage/lcov-report/squatch.ts.html +721 -0
  10. package/coverage/lcov-report/utils/cookieUtils.ts.html +10 -10
  11. package/coverage/lcov-report/utils/decodeUserJwt.ts.html +19 -19
  12. package/coverage/lcov-report/utils/domready.ts.html +1 -1
  13. package/coverage/lcov-report/utils/io.ts.html +7 -7
  14. package/coverage/lcov-report/utils/utmUtils.ts.html +1 -1
  15. package/coverage/lcov-report/utils/validate.ts.html +37 -37
  16. package/coverage/lcov-report/validate.ts.html +1 -1
  17. package/coverage/lcov-report/widgets/EmbedWidget.ts.html +67 -19
  18. package/coverage/lcov-report/widgets/PopupWidget.ts.html +23 -8
  19. package/coverage/lcov-report/widgets/Widget.ts.html +7 -16
  20. package/coverage/lcov-report/widgets/Widgets.ts.html +61 -16
  21. package/coverage/lcov-report/widgets/declarative/DeclarativeWidget.ts.html +373 -82
  22. package/coverage/lcov-report/widgets/declarative/DeclarativeWidgets.ts.html +388 -0
  23. package/coverage/lcov.info +1559 -125
  24. package/dist/api/WidgetApi.d.ts +2 -2
  25. package/dist/squatch.d.ts +28 -1
  26. package/dist/squatch.esm.js +274 -121
  27. package/dist/squatch.esm.js.map +1 -1
  28. package/dist/squatch.js +274 -121
  29. package/dist/squatch.js.map +1 -1
  30. package/dist/squatch.min.js +1 -1
  31. package/dist/types.d.ts +8 -6
  32. package/dist/widgets/EmbedWidget.d.ts +6 -0
  33. package/dist/widgets/PopupWidget.d.ts +6 -1
  34. package/dist/widgets/Widgets.d.ts +15 -2
  35. package/dist/widgets/declarative/DeclarativeWidget.d.ts +57 -1
  36. package/dist/widgets/declarative/DeclarativeWidgets.d.ts +22 -0
  37. package/package.json +1 -1
@@ -26,7 +26,7 @@ export default class WidgetApi {
26
26
  */
27
27
  constructor(config?: ConfigOptions);
28
28
  /**
29
- * Creates/upserts user.
29
+ * Creates/upserts user, requests widget template.
30
30
  *
31
31
  * @param {Object} params Parameters for request
32
32
  * @param {Object?} params.user The user details
@@ -41,7 +41,7 @@ export default class WidgetApi {
41
41
  */
42
42
  upsertUser(params: WithRequired<WidgetConfig, "user">): Promise<any>;
43
43
  /**
44
- * Description here.
44
+ * Requests widget template
45
45
  *
46
46
  * @param {Object} params Parameters for request
47
47
  * @param {Object} params.user The user details
package/dist/squatch.d.ts CHANGED
@@ -14,6 +14,10 @@ export { Widgets, EmbedWidget, PopupWidget, DeclarativeEmbedWidget, DeclarativeP
14
14
  * Read the {@link WidgetApi} docs.
15
15
  *
16
16
  * @returns WidgetApi static instance
17
+ * @example
18
+ * squatch.api().render({ ... })
19
+ * squatch.api().upsertUser({ ... })
20
+ * squatch.api().squatchReferralCookie()
17
21
  */
18
22
  export declare function api(): WidgetApi | null;
19
23
  /**
@@ -22,6 +26,10 @@ export declare function api(): WidgetApi | null;
22
26
  * Read the {@link Widgets} docs.
23
27
  *
24
28
  * @returns static instance
29
+ * @example
30
+ * squatch.widgets().render({ widgetType: "w/widget-type" })
31
+ * squatch.widgets().upsertUser({ user: { ... }, widgetType: "w/widget-type" })
32
+ * squatch.widgets().autofill(".referral-code")
25
33
  */
26
34
  export declare function widgets(): Widgets | null;
27
35
  /**
@@ -30,14 +38,27 @@ export declare function widgets(): Widgets | null;
30
38
  * Read the {@link EventsApi} docs.
31
39
  *
32
40
  * @returns EventsApi static instance
41
+ *
42
+ * @example
43
+ * squatch.events().track({ ... })
33
44
  */
34
45
  export declare function events(): EventsApi | null;
35
46
  /**
36
47
  * Entry-point for high level API to render a widget using the instance of {@link Widgets} created when you call {@link #init init}.
48
+ *
49
+ * Read the {@link Widgets.render} docs.
50
+ *
51
+ * @example
52
+ * squatch.widget().then(res => {
53
+ * const widget = res.widget
54
+ * }).catch(e => console.error("Did not render widget:", e))
37
55
  */
38
56
  export declare function widget(widgetConfig: WidgetConfig): Promise<WidgetResult | undefined> | undefined;
39
57
  /**
40
58
  * Extracts widget configuration from `_saasquatchExtra` UTM parameter. Initialises `squatch` and renders the widget as a {@link PopupWidget} via static instanct of {@link Widgets}.
59
+ *
60
+ * Called by default on startup via the loader script.
61
+ * @private
41
62
  */
42
63
  export declare function _auto(configIn: ConfigOptions): Promise<WidgetResult | undefined> | undefined;
43
64
  /**
@@ -50,7 +71,9 @@ export declare function _auto(configIn: ConfigOptions): Promise<WidgetResult | u
50
71
  * @param config Configuration details
51
72
  *
52
73
  * @example
53
- * squatch.init({tenantAlias:'test_basbtabstq51v'});
74
+ * squatch.init({
75
+ * tenantAlias:'test_basbtabstq51v',
76
+ * });
54
77
  */
55
78
  export declare function init(configIn: ConfigOptions): void;
56
79
  /**
@@ -72,6 +95,10 @@ export declare function ready(fn: () => any): void;
72
95
  *
73
96
  * @param {string} selector Element class/id
74
97
  * @returns {void}
98
+ *
99
+ * @example
100
+ * squatch.autofill("input.referral-code")
101
+ * squatch.autofill("input#referral-code")
75
102
  */
76
103
  export declare function autofill(selector: string): void;
77
104
  /**