@saasquatch/squatch-js 2.6.0-8 → 2.6.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/.github/workflows/size-limit.yml +14 -14
- package/.github/workflows/static.yml +89 -89
- package/CHANGELOG.md +388 -326
- package/LICENSE +20 -20
- package/README.md +259 -208
- package/babel.config.js +7 -7
- package/cucumber.js +45 -45
- package/demo/sandbox.ts +124 -124
- package/demo/toolbar.tsx +526 -526
- package/dist/api/WidgetApi.d.ts +1 -0
- package/dist/async.d.ts +2 -0
- package/dist/globals.d.ts +4 -0
- package/dist/squatch.esm.js +80 -49
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +80 -49
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/squatch.min.js.br +0 -0
- package/dist/squatch.min.js.map +1 -1
- package/dist/squatch.modern.js +1 -1
- package/dist/squatch.modern.js.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/utils/decodeJwt.d.ts +1 -0
- package/dist/utils/validate.d.ts +0 -2
- package/dist/widgets/PopupWidget.d.ts +2 -2
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +5 -0
- package/jest.config.ts +200 -200
- package/package.json +123 -123
- package/tsconfig.json +23 -23
- package/coverage/clover.xml +0 -865
- package/coverage/coverage-final.json +0 -20
- package/coverage/lcov-report/DeclarativeWidget.ts.html +0 -790
- package/coverage/lcov-report/WidgetApi.ts.html +0 -631
- package/coverage/lcov-report/Widgets.ts.html +0 -1105
- package/coverage/lcov-report/api/AnalyticsApi.ts.html +0 -304
- package/coverage/lcov-report/api/EventsApi.ts.html +0 -352
- package/coverage/lcov-report/api/WidgetApi.ts.html +0 -658
- package/coverage/lcov-report/api/graphql.ts.html +0 -130
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/squatch.ts.html +0 -721
- package/coverage/lcov-report/utils/cookieUtils.ts.html +0 -415
- package/coverage/lcov-report/utils/decodeUserJwt.ts.html +0 -133
- package/coverage/lcov-report/utils/domready.ts.html +0 -160
- package/coverage/lcov-report/utils/io.ts.html +0 -400
- package/coverage/lcov-report/utils/utmUtils.ts.html +0 -277
- package/coverage/lcov-report/utils/validate.ts.html +0 -268
- package/coverage/lcov-report/validate.ts.html +0 -268
- package/coverage/lcov-report/widgets/EmbedWidget.ts.html +0 -481
- package/coverage/lcov-report/widgets/PopupWidget.ts.html +0 -685
- package/coverage/lcov-report/widgets/Widget.ts.html +0 -1159
- package/coverage/lcov-report/widgets/Widgets.ts.html +0 -1102
- package/coverage/lcov-report/widgets/declarative/DeclarativeWidget.ts.html +0 -790
- package/coverage/lcov-report/widgets/declarative/DeclarativeWidgets.ts.html +0 -388
- package/coverage/lcov.info +0 -1593
- package/stats.json +0 -1
package/demo/sandbox.ts
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { getQueryStringParams } from "./util";
|
|
2
|
-
|
|
3
|
-
export const tenantAlias = "test_aojsrf4r06zi0";
|
|
4
|
-
export const domain = "https://staging.referralsaasquatch.com";
|
|
5
|
-
export const script = "https://fast.ssqt.io/squatch-js@2";
|
|
6
|
-
|
|
7
|
-
export const user = {
|
|
8
|
-
id: "5b980d34e4b0cabee07f2cb0",
|
|
9
|
-
accountId: "AZJZSVG0LS1LB19R",
|
|
10
|
-
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
11
|
-
};
|
|
12
|
-
export const badJwtUser = {
|
|
13
|
-
...user,
|
|
14
|
-
firstName: "Bad JWT",
|
|
15
|
-
};
|
|
16
|
-
export const noIds = {
|
|
17
|
-
firstName: "No IDs",
|
|
18
|
-
};
|
|
19
|
-
export const noUserId = {
|
|
20
|
-
accountId: "abc_123",
|
|
21
|
-
firstName: "No UserID",
|
|
22
|
-
};
|
|
23
|
-
export const noAccountId = {
|
|
24
|
-
id: "abc_123",
|
|
25
|
-
firstName: "No AccountID",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const users = [user, badJwtUser, noIds, noUserId, noAccountId, {}];
|
|
29
|
-
|
|
30
|
-
export const popup: Sandbox = {
|
|
31
|
-
script,
|
|
32
|
-
domain,
|
|
33
|
-
tenantAlias,
|
|
34
|
-
debug: true,
|
|
35
|
-
initObj: {
|
|
36
|
-
widgetType: "REFERRER_WIDGET",
|
|
37
|
-
engagementMedium: "POPUP",
|
|
38
|
-
user: user,
|
|
39
|
-
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export const embed: Sandbox = {
|
|
44
|
-
script,
|
|
45
|
-
domain,
|
|
46
|
-
tenantAlias,
|
|
47
|
-
initObj: {
|
|
48
|
-
widgetType: "REFERRER_WIDGET",
|
|
49
|
-
engagementMedium: "EMBED",
|
|
50
|
-
user: {
|
|
51
|
-
id: "5b980d34e4b0cabee07f2cb0",
|
|
52
|
-
accountId: "AZJZSVG0LS1LB19R",
|
|
53
|
-
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
54
|
-
},
|
|
55
|
-
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const embedNew: Sandbox = {
|
|
60
|
-
...embed,
|
|
61
|
-
initObj: {
|
|
62
|
-
...embed.initObj,
|
|
63
|
-
widgetType: "p/tuesday-text/w/referrerWidget",
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export const embedReferred: Sandbox = {
|
|
68
|
-
...embed,
|
|
69
|
-
initObj: {
|
|
70
|
-
...embed.initObj,
|
|
71
|
-
widgetType: "CONVERSION_WIDGET",
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export const popupReferred: Sandbox = {
|
|
76
|
-
...popup,
|
|
77
|
-
initObj: {
|
|
78
|
-
...popup.initObj,
|
|
79
|
-
widgetType: "CONVERSION_WIDGET",
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const popupNew: Sandbox = {
|
|
84
|
-
...popup,
|
|
85
|
-
initObj: {
|
|
86
|
-
...popup.initObj,
|
|
87
|
-
widgetType: "p/tuesday-test/w/referrerWidget",
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export function fromURL() {
|
|
92
|
-
let urlSandbox;
|
|
93
|
-
try {
|
|
94
|
-
urlSandbox = JSON.parse(
|
|
95
|
-
window.atob(getQueryStringParams(window.location.search).sandbox)
|
|
96
|
-
);
|
|
97
|
-
} catch (e) {
|
|
98
|
-
urlSandbox = {};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const sandbox = {
|
|
102
|
-
...popup,
|
|
103
|
-
...urlSandbox,
|
|
104
|
-
};
|
|
105
|
-
return sandbox;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function toURL(sandbox: Sandbox) {
|
|
109
|
-
window.location.href = href(sandbox);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function href(sandbox: Sandbox) {
|
|
113
|
-
const urlParams = new URLSearchParams(window.location.search);
|
|
114
|
-
const param = window.btoa(JSON.stringify(sandbox));
|
|
115
|
-
var url = window.location.href;
|
|
116
|
-
if (url.indexOf("?") > 0) {
|
|
117
|
-
url = url.substring(0, url.indexOf("?"));
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
urlParams.delete("sandbox");
|
|
121
|
-
|
|
122
|
-
url += `?sandbox=${encodeURIComponent(param)}&${urlParams.toString()}`;
|
|
123
|
-
return url;
|
|
124
|
-
}
|
|
1
|
+
import { getQueryStringParams } from "./util";
|
|
2
|
+
|
|
3
|
+
export const tenantAlias = "test_aojsrf4r06zi0";
|
|
4
|
+
export const domain = "https://staging.referralsaasquatch.com";
|
|
5
|
+
export const script = "https://fast.ssqt.io/squatch-js@2";
|
|
6
|
+
|
|
7
|
+
export const user = {
|
|
8
|
+
id: "5b980d34e4b0cabee07f2cb0",
|
|
9
|
+
accountId: "AZJZSVG0LS1LB19R",
|
|
10
|
+
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
11
|
+
};
|
|
12
|
+
export const badJwtUser = {
|
|
13
|
+
...user,
|
|
14
|
+
firstName: "Bad JWT",
|
|
15
|
+
};
|
|
16
|
+
export const noIds = {
|
|
17
|
+
firstName: "No IDs",
|
|
18
|
+
};
|
|
19
|
+
export const noUserId = {
|
|
20
|
+
accountId: "abc_123",
|
|
21
|
+
firstName: "No UserID",
|
|
22
|
+
};
|
|
23
|
+
export const noAccountId = {
|
|
24
|
+
id: "abc_123",
|
|
25
|
+
firstName: "No AccountID",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const users = [user, badJwtUser, noIds, noUserId, noAccountId, {}];
|
|
29
|
+
|
|
30
|
+
export const popup: Sandbox = {
|
|
31
|
+
script,
|
|
32
|
+
domain,
|
|
33
|
+
tenantAlias,
|
|
34
|
+
debug: true,
|
|
35
|
+
initObj: {
|
|
36
|
+
widgetType: "REFERRER_WIDGET",
|
|
37
|
+
engagementMedium: "POPUP",
|
|
38
|
+
user: user,
|
|
39
|
+
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const embed: Sandbox = {
|
|
44
|
+
script,
|
|
45
|
+
domain,
|
|
46
|
+
tenantAlias,
|
|
47
|
+
initObj: {
|
|
48
|
+
widgetType: "REFERRER_WIDGET",
|
|
49
|
+
engagementMedium: "EMBED",
|
|
50
|
+
user: {
|
|
51
|
+
id: "5b980d34e4b0cabee07f2cb0",
|
|
52
|
+
accountId: "AZJZSVG0LS1LB19R",
|
|
53
|
+
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
54
|
+
},
|
|
55
|
+
jwt: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const embedNew: Sandbox = {
|
|
60
|
+
...embed,
|
|
61
|
+
initObj: {
|
|
62
|
+
...embed.initObj,
|
|
63
|
+
widgetType: "p/tuesday-text/w/referrerWidget",
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const embedReferred: Sandbox = {
|
|
68
|
+
...embed,
|
|
69
|
+
initObj: {
|
|
70
|
+
...embed.initObj,
|
|
71
|
+
widgetType: "CONVERSION_WIDGET",
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const popupReferred: Sandbox = {
|
|
76
|
+
...popup,
|
|
77
|
+
initObj: {
|
|
78
|
+
...popup.initObj,
|
|
79
|
+
widgetType: "CONVERSION_WIDGET",
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const popupNew: Sandbox = {
|
|
84
|
+
...popup,
|
|
85
|
+
initObj: {
|
|
86
|
+
...popup.initObj,
|
|
87
|
+
widgetType: "p/tuesday-test/w/referrerWidget",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export function fromURL() {
|
|
92
|
+
let urlSandbox;
|
|
93
|
+
try {
|
|
94
|
+
urlSandbox = JSON.parse(
|
|
95
|
+
window.atob(getQueryStringParams(window.location.search).sandbox)
|
|
96
|
+
);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
urlSandbox = {};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const sandbox = {
|
|
102
|
+
...popup,
|
|
103
|
+
...urlSandbox,
|
|
104
|
+
};
|
|
105
|
+
return sandbox;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function toURL(sandbox: Sandbox) {
|
|
109
|
+
window.location.href = href(sandbox);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function href(sandbox: Sandbox) {
|
|
113
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
114
|
+
const param = window.btoa(JSON.stringify(sandbox));
|
|
115
|
+
var url = window.location.href;
|
|
116
|
+
if (url.indexOf("?") > 0) {
|
|
117
|
+
url = url.substring(0, url.indexOf("?"));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
urlParams.delete("sandbox");
|
|
121
|
+
|
|
122
|
+
url += `?sandbox=${encodeURIComponent(param)}&${urlParams.toString()}`;
|
|
123
|
+
return url;
|
|
124
|
+
}
|