@saasquatch/squatch-js 2.5.0-0 → 2.5.1-0
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 +326 -278
- package/LICENSE +20 -20
- package/README.md +145 -144
- package/demo/sandbox.ts +124 -122
- package/demo/toolbar.tsx +526 -526
- package/dist/api/AnalyticsApi.d.ts +1 -1
- package/dist/api/WidgetApi.d.ts +4 -4
- package/dist/api/graphql.d.ts +1 -0
- package/dist/squatch.d.ts +10 -2
- package/dist/squatch.esm.js +292 -98
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +294 -98
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +3 -3
- package/dist/squatch.min.js.map +1 -0
- package/dist/squatch.modern.js +2 -0
- package/dist/squatch.modern.js.map +1 -0
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +14 -4
- package/dist/utils/cookieUtils.d.ts +1 -0
- package/dist/utils/io.d.ts +2 -1
- package/dist/utils/utmUtils.d.ts +14 -0
- package/dist/utils/validate.d.ts +2 -0
- package/dist/widgets/Widgets.d.ts +3 -3
- package/package.json +105 -104
|
@@ -18,7 +18,7 @@ export default class AnalyticsApi {
|
|
|
18
18
|
constructor(config: {
|
|
19
19
|
domain: string;
|
|
20
20
|
});
|
|
21
|
-
pushAnalyticsLoadEvent(params: SQHDetails): Promise<any
|
|
21
|
+
pushAnalyticsLoadEvent(params: SQHDetails): Promise<any> | undefined;
|
|
22
22
|
pushAnalyticsShareClickedEvent(params: SQHDetails & {
|
|
23
23
|
shareMedium: string;
|
|
24
24
|
}): Promise<any>;
|
package/dist/api/WidgetApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigOptions, WidgetConfig } from "../types";
|
|
1
|
+
import { ConfigOptions, ReferralCookie, WidgetConfig, WithRequired } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* The WidgetApi class is a wrapper around the Widget Endpoints of the SaaSquatch REST API.
|
|
@@ -39,7 +39,7 @@ export default class WidgetApi {
|
|
|
39
39
|
*
|
|
40
40
|
* @return {Promise} string if true, with the widget template, jsOptions and user details.
|
|
41
41
|
*/
|
|
42
|
-
upsertUser(params: WidgetConfig): Promise<any>;
|
|
42
|
+
upsertUser(params: WithRequired<WidgetConfig, "user">): Promise<any>;
|
|
43
43
|
/**
|
|
44
44
|
* Description here.
|
|
45
45
|
*
|
|
@@ -74,7 +74,7 @@ export default class WidgetApi {
|
|
|
74
74
|
/**
|
|
75
75
|
* Looks up the referral code of the current user, if there is any.
|
|
76
76
|
*
|
|
77
|
-
* @return {Promise<
|
|
77
|
+
* @return {Promise<ReferralCookie>} code referral code if true.
|
|
78
78
|
*/
|
|
79
|
-
squatchReferralCookie(): Promise<
|
|
79
|
+
squatchReferralCookie(): Promise<ReferralCookie>;
|
|
80
80
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RENDER_WIDGET_QUERY = "\n query renderWidget ($user: UserIdInput, $engagementMedium: UserEngagementMedium, $widgetType: WidgetType, $locale: RSLocale) {\n renderWidget(user: $user, engagementMedium: $engagementMedium, widgetType: $widgetType, locale: $locale) {\n template\n user {\n id\n accountId\n }\n jsOptions\n widgetConfig {\n values\n }\n }\n }\n";
|
package/dist/squatch.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import PopupWidget from "./widgets/PopupWidget";
|
|
|
4
4
|
import CtaWidget from "./widgets/CtaWidget";
|
|
5
5
|
import WidgetApi from "./api/WidgetApi";
|
|
6
6
|
import EventsApi from "./api/EventsApi";
|
|
7
|
-
import { ConfigOptions } from "./types";
|
|
7
|
+
import { ConfigOptions, WidgetConfig, WidgetResult } from "./types";
|
|
8
8
|
export * from "./types";
|
|
9
9
|
export * from "./docs";
|
|
10
10
|
export { Widgets, EmbedWidget, PopupWidget, CtaWidget, WidgetApi };
|
|
@@ -32,6 +32,14 @@ export declare function widgets(): Widgets | null;
|
|
|
32
32
|
* @returns EventsApi static instance
|
|
33
33
|
*/
|
|
34
34
|
export declare function events(): EventsApi | null;
|
|
35
|
+
/**
|
|
36
|
+
* Entry-point for high level API to render a widget using the instance of {@link Widgets} created when you call {@link #init init}.
|
|
37
|
+
*/
|
|
38
|
+
export declare function widget(widgetConfig: WidgetConfig): Promise<WidgetResult | undefined> | undefined;
|
|
39
|
+
/**
|
|
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
|
+
*/
|
|
42
|
+
export declare function _auto(configIn: ConfigOptions): Promise<WidgetResult | undefined> | undefined;
|
|
35
43
|
/**
|
|
36
44
|
* Initializes the static `squatch` global. This sets up:
|
|
37
45
|
*
|
|
@@ -54,7 +62,7 @@ export declare function init(configIn: ConfigOptions): void;
|
|
|
54
62
|
* @example
|
|
55
63
|
* squatch.ready(function() {
|
|
56
64
|
* console.log("ready!");
|
|
57
|
-
* squatch.api().
|
|
65
|
+
* squatch.api().upsertUser();
|
|
58
66
|
* });
|
|
59
67
|
*/
|
|
60
68
|
export declare function ready(fn: () => any): void;
|