@saasquatch/squatch-js 2.6.0 → 2.6.1
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 +390 -388
- package/LICENSE +20 -20
- package/README.md +259 -259
- 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/squatch.esm.js +8 -7
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +8 -7
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/jest.config.ts +200 -200
- package/package.json +123 -123
- package/tsconfig.json +23 -23
- package/dist/squatch.min.js.br +0 -0
- package/dist/squatch.min.js.map +0 -1
- package/dist/squatch.modern.js +0 -2
- package/dist/squatch.modern.js.map +0 -1
- package/dist/stats.html +0 -208
- package/dist/utils/decodeJwt.d.ts +0 -1
- package/dist/utils/domUtils.d.ts +0 -1
- package/dist/utils/loadEvent.d.ts +0 -2
- package/dist/widgets/CtaWidget.d.ts +0 -24
- package/dist/widgets/IREmbedWidget.d.ts +0 -29
- package/dist/widgets/IRPopupWidget.d.ts +0 -32
- package/dist/widgets/declarative/DeclarativeEmbedWidget.d.ts +0 -12
package/cucumber.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
// cucumber.js
|
|
2
|
-
// const dotenv = require('dotenv');
|
|
3
|
-
const os = require("os");
|
|
4
|
-
// dotenv.config();
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* Configures Cucumber
|
|
9
|
-
*
|
|
10
|
-
* Sets up the required stuff to make React code operate nicely in a Node environment
|
|
11
|
-
*
|
|
12
|
-
* Source: https://medium.com/@Charles_Stover/behavior-driven-react-development-with-cucumber-faf596d9d71b
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
const CPU_COUNT = os.cpus().length;
|
|
16
|
-
const IS_DEV = process.env.NODE_ENV === "development";
|
|
17
|
-
const FAIL_FAST = IS_DEV ? ["--fail-fast"] : [];
|
|
18
|
-
const FORMAT =
|
|
19
|
-
process.env.CI || !process.stdout.isTTY ? "progress" : "progress-bar";
|
|
20
|
-
|
|
21
|
-
exports.default = [
|
|
22
|
-
...FAIL_FAST,
|
|
23
|
-
`--format ${FORMAT}`,
|
|
24
|
-
`--parallel ${CPU_COUNT}`,
|
|
25
|
-
|
|
26
|
-
// "test/**/*.feature",
|
|
27
|
-
"test/specs/**/*.feature",
|
|
28
|
-
|
|
29
|
-
`--tags "@testsuite:squatch-js and not @skip"`,
|
|
30
|
-
|
|
31
|
-
// Babel and jsDom make our code work as if it's in the browser
|
|
32
|
-
// "--require-module jsdom-global/register",
|
|
33
|
-
// "--require-module ts-node/register",
|
|
34
|
-
"--require-module " + __dirname + "/babelregister.js",
|
|
35
|
-
// '--require-module source-map-support/register',
|
|
36
|
-
|
|
37
|
-
// Order matters -- these setups need to happen first
|
|
38
|
-
// "--require tests/cucumber-setup/loaders.ts",
|
|
39
|
-
|
|
40
|
-
// Step definitions go last
|
|
41
|
-
"--require test/step_definitions/**/steps.ts",
|
|
42
|
-
// "--require test/step_definitions/**/*.tsx",
|
|
43
|
-
|
|
44
|
-
// '--format usage',
|
|
45
|
-
].join(" ");
|
|
1
|
+
// cucumber.js
|
|
2
|
+
// const dotenv = require('dotenv');
|
|
3
|
+
const os = require("os");
|
|
4
|
+
// dotenv.config();
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* Configures Cucumber
|
|
9
|
+
*
|
|
10
|
+
* Sets up the required stuff to make React code operate nicely in a Node environment
|
|
11
|
+
*
|
|
12
|
+
* Source: https://medium.com/@Charles_Stover/behavior-driven-react-development-with-cucumber-faf596d9d71b
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
const CPU_COUNT = os.cpus().length;
|
|
16
|
+
const IS_DEV = process.env.NODE_ENV === "development";
|
|
17
|
+
const FAIL_FAST = IS_DEV ? ["--fail-fast"] : [];
|
|
18
|
+
const FORMAT =
|
|
19
|
+
process.env.CI || !process.stdout.isTTY ? "progress" : "progress-bar";
|
|
20
|
+
|
|
21
|
+
exports.default = [
|
|
22
|
+
...FAIL_FAST,
|
|
23
|
+
`--format ${FORMAT}`,
|
|
24
|
+
`--parallel ${CPU_COUNT}`,
|
|
25
|
+
|
|
26
|
+
// "test/**/*.feature",
|
|
27
|
+
"test/specs/**/*.feature",
|
|
28
|
+
|
|
29
|
+
`--tags "@testsuite:squatch-js and not @skip"`,
|
|
30
|
+
|
|
31
|
+
// Babel and jsDom make our code work as if it's in the browser
|
|
32
|
+
// "--require-module jsdom-global/register",
|
|
33
|
+
// "--require-module ts-node/register",
|
|
34
|
+
"--require-module " + __dirname + "/babelregister.js",
|
|
35
|
+
// '--require-module source-map-support/register',
|
|
36
|
+
|
|
37
|
+
// Order matters -- these setups need to happen first
|
|
38
|
+
// "--require tests/cucumber-setup/loaders.ts",
|
|
39
|
+
|
|
40
|
+
// Step definitions go last
|
|
41
|
+
"--require test/step_definitions/**/steps.ts",
|
|
42
|
+
// "--require test/step_definitions/**/*.tsx",
|
|
43
|
+
|
|
44
|
+
// '--format usage',
|
|
45
|
+
].join(" ");
|
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
|
+
}
|