@saasquatch/squatch-js 2.6.0-10 → 2.6.0-12
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 +329 -329
- package/LICENSE +20 -20
- package/README.md +208 -208
- package/babel.config.js +7 -7
- package/coverage/clover.xml +47 -51
- package/coverage/coverage-final.json +20 -20
- package/coverage/lcov.info +45 -60
- package/cucumber.js +45 -45
- package/demo/sandbox.ts +124 -124
- package/demo/toolbar.tsx +526 -526
- package/dist/squatch.esm.js +16 -16
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +16 -16
- 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 -0
- package/dist/squatch.modern.js +2 -0
- package/dist/squatch.modern.js.map +1 -0
- package/dist/stats.html +208 -0
- package/dist/utils/decodeJwt.d.ts +1 -0
- package/dist/utils/domUtils.d.ts +1 -0
- package/dist/utils/loadEvent.d.ts +2 -0
- package/dist/widgets/CtaWidget.d.ts +24 -0
- package/dist/widgets/IREmbedWidget.d.ts +29 -0
- package/dist/widgets/IRPopupWidget.d.ts +32 -0
- package/dist/widgets/declarative/DeclarativeEmbedWidget.d.ts +12 -0
- package/jest.config.ts +200 -200
- package/package.json +123 -123
- package/tsconfig.json +23 -23
package/coverage/lcov.info
CHANGED
|
@@ -1,52 +1,37 @@
|
|
|
1
1
|
TN:
|
|
2
2
|
SF:src/async.ts
|
|
3
3
|
FN:25,asyncLoad
|
|
4
|
-
FN:
|
|
5
|
-
FN:
|
|
6
|
-
FN:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
FNF:6
|
|
10
|
-
FNH:2
|
|
4
|
+
FN:31,(anonymous_1)
|
|
5
|
+
FN:34,(anonymous_2)
|
|
6
|
+
FN:39,(anonymous_3)
|
|
7
|
+
FNF:4
|
|
8
|
+
FNH:3
|
|
11
9
|
FNDA:4,asyncLoad
|
|
12
|
-
FNDA:
|
|
13
|
-
FNDA:
|
|
10
|
+
FNDA:4,(anonymous_1)
|
|
11
|
+
FNDA:1,(anonymous_2)
|
|
14
12
|
FNDA:0,(anonymous_3)
|
|
15
|
-
FNDA:0,(anonymous_4)
|
|
16
|
-
FNDA:0,(anonymous_5)
|
|
17
13
|
DA:1,4
|
|
18
14
|
DA:25,4
|
|
19
15
|
DA:26,4
|
|
16
|
+
DA:29,4
|
|
20
17
|
DA:30,4
|
|
21
18
|
DA:31,4
|
|
22
|
-
DA:32,4
|
|
23
19
|
DA:34,4
|
|
24
|
-
DA:
|
|
25
|
-
DA:
|
|
26
|
-
DA:
|
|
27
|
-
DA:39,0
|
|
28
|
-
DA:40,0
|
|
29
|
-
DA:44,0
|
|
20
|
+
DA:36,1
|
|
21
|
+
DA:39,1
|
|
22
|
+
DA:42,1
|
|
30
23
|
DA:45,0
|
|
31
24
|
DA:46,0
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
LH:9
|
|
25
|
+
LF:12
|
|
26
|
+
LH:10
|
|
35
27
|
BRDA:26,0,0,0
|
|
36
28
|
BRDA:26,0,1,4
|
|
37
|
-
BRDA:
|
|
38
|
-
BRDA:
|
|
39
|
-
BRDA:
|
|
40
|
-
BRDA:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
BRDA:35,4,0,0
|
|
44
|
-
BRDA:37,5,0,0
|
|
45
|
-
BRDA:38,6,0,0
|
|
46
|
-
BRDA:38,7,0,0
|
|
47
|
-
BRDA:38,7,1,0
|
|
48
|
-
BRF:13
|
|
49
|
-
BRH:7
|
|
29
|
+
BRDA:29,1,0,4
|
|
30
|
+
BRDA:29,1,1,4
|
|
31
|
+
BRDA:30,2,0,4
|
|
32
|
+
BRDA:30,2,1,4
|
|
33
|
+
BRF:6
|
|
34
|
+
BRH:5
|
|
50
35
|
end_of_record
|
|
51
36
|
TN:
|
|
52
37
|
SF:src/docs.ts
|
|
@@ -767,7 +752,7 @@ FNF:7
|
|
|
767
752
|
FNH:7
|
|
768
753
|
FNDA:69,(anonymous_0)
|
|
769
754
|
FNDA:56,(anonymous_1)
|
|
770
|
-
FNDA:
|
|
755
|
+
FNDA:52,(anonymous_2)
|
|
771
756
|
FNDA:6,(anonymous_3)
|
|
772
757
|
FNDA:4,(anonymous_4)
|
|
773
758
|
FNDA:5,(anonymous_5)
|
|
@@ -804,9 +789,9 @@ DA:65,53
|
|
|
804
789
|
DA:66,53
|
|
805
790
|
DA:69,53
|
|
806
791
|
DA:70,53
|
|
807
|
-
DA:71,
|
|
808
|
-
DA:74,
|
|
809
|
-
DA:87,
|
|
792
|
+
DA:71,52
|
|
793
|
+
DA:74,52
|
|
794
|
+
DA:87,52
|
|
810
795
|
DA:88,49
|
|
811
796
|
DA:90,49
|
|
812
797
|
DA:91,2
|
|
@@ -853,8 +838,8 @@ BRDA:54,6,0,3
|
|
|
853
838
|
BRDA:54,7,0,3
|
|
854
839
|
BRDA:54,7,1,1
|
|
855
840
|
BRDA:59,8,0,1
|
|
856
|
-
BRDA:71,9,0,
|
|
857
|
-
BRDA:71,9,1,
|
|
841
|
+
BRDA:71,9,0,52
|
|
842
|
+
BRDA:71,9,1,52
|
|
858
843
|
BRDA:90,10,0,2
|
|
859
844
|
BRDA:102,11,0,1
|
|
860
845
|
BRDA:103,12,0,1
|
|
@@ -1074,15 +1059,15 @@ FNDA:4,(anonymous_7)
|
|
|
1074
1059
|
FNDA:1,(anonymous_8)
|
|
1075
1060
|
FNDA:1,(anonymous_9)
|
|
1076
1061
|
FNDA:8,(anonymous_10)
|
|
1077
|
-
FNDA:
|
|
1078
|
-
FNDA:
|
|
1062
|
+
FNDA:94,(anonymous_11)
|
|
1063
|
+
FNDA:403,search
|
|
1079
1064
|
FNDA:10,(anonymous_13)
|
|
1080
1065
|
FNDA:5,(anonymous_14)
|
|
1081
1066
|
FNDA:2,(anonymous_15)
|
|
1082
1067
|
FNDA:1,(anonymous_16)
|
|
1083
1068
|
FNDA:5,(anonymous_17)
|
|
1084
|
-
FNDA:
|
|
1085
|
-
FNDA:
|
|
1069
|
+
FNDA:390,delay
|
|
1070
|
+
FNDA:390,(anonymous_19)
|
|
1086
1071
|
DA:2,9
|
|
1087
1072
|
DA:3,9
|
|
1088
1073
|
DA:6,9
|
|
@@ -1139,19 +1124,19 @@ DA:178,1
|
|
|
1139
1124
|
DA:183,1
|
|
1140
1125
|
DA:189,8
|
|
1141
1126
|
DA:221,8
|
|
1142
|
-
DA:227,
|
|
1143
|
-
DA:228,
|
|
1127
|
+
DA:227,94
|
|
1128
|
+
DA:228,94
|
|
1144
1129
|
DA:229,1
|
|
1145
|
-
DA:230,
|
|
1146
|
-
DA:233,
|
|
1147
|
-
DA:235,
|
|
1148
|
-
DA:237,
|
|
1149
|
-
DA:242,
|
|
1150
|
-
DA:245,
|
|
1151
|
-
DA:246,
|
|
1152
|
-
DA:247,
|
|
1153
|
-
DA:248,
|
|
1154
|
-
DA:249,
|
|
1130
|
+
DA:230,93
|
|
1131
|
+
DA:233,403
|
|
1132
|
+
DA:235,403
|
|
1133
|
+
DA:237,403
|
|
1134
|
+
DA:242,403
|
|
1135
|
+
DA:245,93
|
|
1136
|
+
DA:246,93
|
|
1137
|
+
DA:247,403
|
|
1138
|
+
DA:248,403
|
|
1139
|
+
DA:249,390
|
|
1155
1140
|
DA:251,88
|
|
1156
1141
|
DA:252,75
|
|
1157
1142
|
DA:254,13
|
|
@@ -1189,8 +1174,8 @@ DA:347,2
|
|
|
1189
1174
|
DA:350,2
|
|
1190
1175
|
DA:351,2
|
|
1191
1176
|
DA:352,2
|
|
1192
|
-
DA:358,
|
|
1193
|
-
DA:359,
|
|
1177
|
+
DA:358,390
|
|
1178
|
+
DA:359,390
|
|
1194
1179
|
LF:108
|
|
1195
1180
|
LH:108
|
|
1196
1181
|
BRDA:54,0,0,5
|
|
@@ -1228,9 +1213,9 @@ BRDA:188,16,0,1
|
|
|
1228
1213
|
BRDA:188,17,0,1
|
|
1229
1214
|
BRDA:228,18,0,1
|
|
1230
1215
|
BRDA:237,19,0,8
|
|
1231
|
-
BRDA:237,19,1,
|
|
1216
|
+
BRDA:237,19,1,395
|
|
1232
1217
|
BRDA:239,20,0,5
|
|
1233
|
-
BRDA:239,20,1,
|
|
1218
|
+
BRDA:239,20,1,390
|
|
1234
1219
|
BRDA:248,21,0,13
|
|
1235
1220
|
BRDA:251,22,0,75
|
|
1236
1221
|
BRDA:265,23,0,1
|
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
|
+
}
|