guidewhale 1.0.7 → 1.0.9

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
@@ -39,7 +39,7 @@ import gwhale from 'guidewhale';
39
39
 
40
40
  gwhale.init("<guidewhale_environment_code>", { // REQUIRED - string - make sure to use the correct environment code for desired application environment (e.g. 'prod-1234abcd')
41
41
  gdpr: true, // OPTIONAL - true | false - enable GDPR mode to require user consent before tracking data under their user_id
42
- gdprConsent: true, // OPTIONAL - true | false - Whether user has given consent to track their data
42
+ gdpr_consent: true, // OPTIONAL - true | false - Whether user has given consent to track their data
43
43
  user: {
44
44
  user_id: <user_id>, // REQUIRED - string | null - unique user identifier (e.g. null for anonymous users, '100000356', '6099047b-660b-4f2e-a878-fb66a12c1840', 'john.smith@example.com')
45
45
  signature: <user_signature>, // REQUIRED IF USER_ID IS SET - string - user signature hash (not the secret!) to prevent unathorized initialization
@@ -29,28 +29,14 @@ type MembershipProperties = DisallowKeys<Record<string, any> & {
29
29
  is_primary?: boolean;
30
30
  role?: string;
31
31
  }, ''>;
32
- interface GuideWhaleClient {
33
- location: string;
34
- contentUrl: string;
35
- t: Date;
36
- d_init?: string[][];
37
- d_reset?: string[][];
38
- d_track?: string[][];
39
- d_on?: string[][];
40
- d_off?: string[][];
41
- d_onRedirect?: string[][];
42
- init: (appEnvironmentCode: AppEnvironmentCode, data: {
43
- gdpr?: boolean;
44
- consent?: boolean;
45
- user: UserProperties;
46
- company?: CompanyProperties;
47
- membership?: MembershipProperties;
48
- }) => Promise<boolean>;
49
- reset: () => void;
50
- on: (eventName: string, callback: (data?: any) => void) => void;
51
- off: (eventName: string, callback: (data?: any) => void) => void;
52
- onRedirect: (handler: (url: string) => void) => void;
53
- track: (event: string, properties?: Record<string, any>) => boolean;
54
- }
55
- declare var gwhale: GuideWhaleClient | undefined;
32
+ type InitOptions = {
33
+ gdpr?: boolean;
34
+ consent?: boolean;
35
+ user: UserProperties;
36
+ company?: CompanyProperties;
37
+ membership?: MembershipProperties;
38
+ };
39
+ declare const gwhale: {
40
+ init: (appEnvironmentCode: AppEnvironmentCode, options?: InitOptions) => void;
41
+ };
56
42
  export default gwhale;
@@ -1,4 +1,4 @@
1
- var r = [
1
+ var c = [
2
2
  "init",
3
3
  /*'identify', 'group',*/
4
4
  "reset",
@@ -6,23 +6,28 @@ var r = [
6
6
  "on",
7
7
  "off",
8
8
  "onRedirect"
9
- ], t = typeof window < "u" ? window : {}, o = t.document, e = t.gwhale;
10
- if (!e) {
11
- e = t.gwhale = {
12
- location: t.location.href.toString(),
13
- contentUrl: "https://cdn.guidewhale.com/",
14
- t: /* @__PURE__ */ new Date()
15
- };
16
- for (var a = 0; a < r.length; a++) {
17
- var c = r[a], l = e[`d_${c}`] = [];
18
- e[c] = function() {
19
- l.push(Array.prototype.slice.call(arguments));
20
- };
9
+ ];
10
+ const h = {
11
+ init: (l, i) => {
12
+ var t = typeof window < "u" ? window : {}, r = t.document, e = t.gwhale;
13
+ if (!e) {
14
+ e = t.gwhale = {
15
+ location: t.location.href.toString(),
16
+ contentUrl: "https://cdn.guidewhale.com/",
17
+ t: /* @__PURE__ */ new Date()
18
+ };
19
+ for (var n = 0; n < c.length; n++) {
20
+ var o = c[n], d = e[`d_${o}`] = [];
21
+ e[o] = function() {
22
+ d.push(Array.prototype.slice.call(arguments));
23
+ };
24
+ }
25
+ e.init(l, i);
26
+ var a = r.createElement("script");
27
+ a.src = e.contentUrl + "script/launcher.js", a.async = !0, r.head.appendChild(a);
28
+ }
21
29
  }
22
- var n = o.createElement("script");
23
- n.src = e.contentUrl + "script/launcher.js", n.async = !0, o.head.appendChild(n);
24
- }
25
- const d = e;
30
+ };
26
31
  export {
27
- d as default
32
+ h as default
28
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guidewhale",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "GuideWhale SDK client script loader",
5
5
  "type": "module",
6
6
  "main": "dist/guidewhale.js",