@saasquatch/squatch-js 2.4.3-3 → 2.4.3

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/demo/toolbar.tsx CHANGED
@@ -245,7 +245,7 @@ function ModeList(props) {
245
245
  function UserList(props) {
246
246
  return (
247
247
  <details
248
- title={"User: " + window["sandbox"].initObj.user?.firstName}
248
+ title={"User: " + window["sandbox"].initObj.user.firstName}
249
249
  key={0}
250
250
  id={`dropdown-basic-1`}
251
251
  >
@@ -18,7 +18,7 @@ export default class AnalyticsApi {
18
18
  constructor(config: {
19
19
  domain: string;
20
20
  });
21
- pushAnalyticsLoadEvent(params: SQHDetails): Promise<any> | undefined;
21
+ pushAnalyticsLoadEvent(params: SQHDetails): Promise<any>;
22
22
  pushAnalyticsShareClickedEvent(params: SQHDetails & {
23
23
  shareMedium: string;
24
24
  }): Promise<any>;
@@ -1,4 +1,4 @@
1
- import { ConfigOptions, WidgetConfig, WithRequired } from "../types";
1
+ import { ConfigOptions, CookieUser, WidgetConfig, ReferralCookie } from "../types";
2
2
  /**
3
3
  *
4
4
  * The WidgetApi class is a wrapper around the Widget Endpoints of the SaaSquatch REST API.
@@ -25,6 +25,19 @@ export default class WidgetApi {
25
25
  * let squatchApi = new WidgetApi({tenantAlias:'test_12b5bo1b25125'});
26
26
  */
27
27
  constructor(config: ConfigOptions);
28
+ /**
29
+ * Creates/upserts an anonymous user.
30
+ *
31
+ * @param {Object} params Parameters for request
32
+ * @param {WidgetType} params.widgetType The content of the widget.
33
+ * @param {EngagementMedium} params.engagementMedium How to display the widget.
34
+ * @param {CookieUser} params.user An optional user object
35
+ * @param {string} params.jwt the JSON Web Token (JWT) that is used to
36
+ * validate the data (can be disabled)
37
+ *
38
+ * @return {Promise} json object if true, with the widget template, jsOptions and user details.
39
+ */
40
+ cookieUser(params: CookieUser): Promise<any>;
28
41
  /**
29
42
  * Creates/upserts user.
30
43
  *
@@ -39,7 +52,7 @@ export default class WidgetApi {
39
52
  *
40
53
  * @return {Promise} string if true, with the widget template, jsOptions and user details.
41
54
  */
42
- upsertUser(params: WithRequired<WidgetConfig, "user">): Promise<any>;
55
+ upsertUser(params: WidgetConfig): Promise<any>;
43
56
  /**
44
57
  * Description here.
45
58
  *
@@ -74,7 +87,7 @@ export default class WidgetApi {
74
87
  /**
75
88
  * Looks up the referral code of the current user, if there is any.
76
89
  *
77
- * @return {Promise<Object>} code referral code if true.
90
+ * @return {Promise<ReferralCookie>} code referral code if true.
78
91
  */
79
- squatchReferralCookie(): Promise<object>;
92
+ squatchReferralCookie(): Promise<ReferralCookie>;
80
93
  }
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, WidgetConfig, WidgetResult } from "./types";
7
+ import { ConfigOptions } from "./types";
8
8
  export * from "./types";
9
9
  export * from "./docs";
10
10
  export { Widgets, EmbedWidget, PopupWidget, CtaWidget, WidgetApi };
@@ -32,16 +32,6 @@ 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
- * Initial concept for automatic widget rendering
41
- *
42
- * - `saasquatchExtra` utm param carries widgetIdent
43
- */
44
- export declare function auto(configIn: ConfigOptions): Promise<WidgetResult | undefined> | undefined;
45
35
  /**
46
36
  * Initializes the static `squatch` global. This sets up:
47
37
  *