@saasquatch/squatch-js 2.3.1-1 → 2.3.1-5
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/CHANGELOG.md +162 -162
- package/LICENSE +20 -20
- package/README.md +144 -144
- package/SECURITY.md +10 -10
- package/babelregister.js +16 -16
- package/cucumber.js +45 -45
- package/demo/generate.tsx +43 -3
- package/demo/index.d.ts +15 -15
- package/demo/sandbox.ts +122 -122
- package/demo/styles.css +24 -24
- package/demo/templates/MintGA.ts +45 -0
- package/demo/templates/MintGAContainer.ts +45 -0
- package/demo/templates/MintGAContainerDisplayBlock.ts +45 -0
- package/demo/templates/QuirksMintGA.ts +45 -0
- package/demo/templates/QuirksMintGAContainer.ts +45 -0
- package/demo/templates/QuirksMintGAContainerDisplayBlock.ts +45 -0
- package/demo/templates/QuirksVanillaGA.ts +308 -0
- package/demo/templates/VanillaGA.ts +308 -0
- package/demo/templates/VanillaGANoContainer.ts +308 -0
- package/demo/templates/classic.ts +134 -0
- package/demo/toolbar.tsx +411 -249
- package/demo/tsconfig.json +14 -14
- package/demo/util.ts +21 -21
- package/demo/versions.ts +14 -14
- package/dist/api/EventsApi.d.ts +1 -1
- package/dist/squatch.WidgetApi.js +1395 -0
- package/dist/squatch.WidgetApi.min.js +8 -0
- package/dist/squatch.d.ts +2 -2
- package/dist/squatch.esm.js +12 -26
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +12 -26
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +103 -98
- package/tsconfig.json +22 -22
package/SECURITY.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Reporting Security Issues
|
|
2
|
-
The SaaSquatch team takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings.
|
|
3
|
-
|
|
4
|
-
To report a security issue, email security@referralsaasquatch.com and provide as much information as you can about the discovered issue.
|
|
5
|
-
|
|
6
|
-
The SaaSquatch team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix, and may ask for additional information or guidance.
|
|
7
|
-
|
|
8
|
-
Report security bugs in third-party modules to the person or team maintaining the module.
|
|
9
|
-
|
|
10
|
-
For more information, please see SaaSquatch's Responsible Disclosure Policy at https://www.saasquatch.com/disclosure/.
|
|
1
|
+
# Reporting Security Issues
|
|
2
|
+
The SaaSquatch team takes security bugs seriously. We appreciate your efforts to responsibly disclose your findings.
|
|
3
|
+
|
|
4
|
+
To report a security issue, email security@referralsaasquatch.com and provide as much information as you can about the discovered issue.
|
|
5
|
+
|
|
6
|
+
The SaaSquatch team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix, and may ask for additional information or guidance.
|
|
7
|
+
|
|
8
|
+
Report security bugs in third-party modules to the person or team maintaining the module.
|
|
9
|
+
|
|
10
|
+
For more information, please see SaaSquatch's Responsible Disclosure Policy at https://www.saasquatch.com/disclosure/.
|
package/babelregister.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
// Cucumber babel config file
|
|
2
|
-
// overrides node's require and runs through babel/typescript
|
|
3
|
-
// based on https://github.com/microsoft/TypeScript-Babel-Starter/blob/master/.babelrc
|
|
4
|
-
require("@babel/register")({
|
|
5
|
-
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
6
|
-
presets: ["@babel/preset-env", "@babel/preset-typescript"],
|
|
7
|
-
plugins: [
|
|
8
|
-
[
|
|
9
|
-
"@babel/plugin-transform-runtime",
|
|
10
|
-
{
|
|
11
|
-
corejs: 2,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
"@babel/plugin-proposal-class-properties",
|
|
15
|
-
],
|
|
16
|
-
});
|
|
1
|
+
// Cucumber babel config file
|
|
2
|
+
// overrides node's require and runs through babel/typescript
|
|
3
|
+
// based on https://github.com/microsoft/TypeScript-Babel-Starter/blob/master/.babelrc
|
|
4
|
+
require("@babel/register")({
|
|
5
|
+
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
6
|
+
presets: ["@babel/preset-env", "@babel/preset-typescript"],
|
|
7
|
+
plugins: [
|
|
8
|
+
[
|
|
9
|
+
"@babel/plugin-transform-runtime",
|
|
10
|
+
{
|
|
11
|
+
corejs: 2,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
"@babel/plugin-proposal-class-properties",
|
|
15
|
+
],
|
|
16
|
+
});
|
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
|
-
"../blackbox-testing/features/**/*.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/**/*.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
|
+
"../blackbox-testing/features/**/*.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/**/*.ts",
|
|
42
|
+
"--require test/step_definitions/**/*.tsx",
|
|
43
|
+
|
|
44
|
+
// '--format usage',
|
|
45
|
+
].join(" ");
|
package/demo/generate.tsx
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
import { fromURL, popup } from "./sandbox";
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { fromURL, popup } from "./sandbox";
|
|
2
|
+
import { rest, setupWorker } from "msw";
|
|
3
|
+
import classic from "./templates/classic";
|
|
4
|
+
import MintGA from "./templates/MintGA";
|
|
5
|
+
import VanillaGA from "./templates/VanillaGA";
|
|
6
|
+
import { getQueryStringParams } from "./util";
|
|
7
|
+
import QuirksVanillaGA from "./templates/QuirksVanillaGA";
|
|
8
|
+
import QuirksMintGA from "./templates/QuirksMintGA";
|
|
9
|
+
import MintGAContainer from "./templates/MintGAContainer";
|
|
10
|
+
import VanillaGANoContainer from "./templates/VanillaGANoContainer";
|
|
11
|
+
import MintGAContainerDisplayBlock from "./templates/MintGAContainerDisplayBlock";
|
|
12
|
+
import QuirksMintGAContainerDisplayBlock from "./templates/QuirksMintGAContainerDisplayBlock";
|
|
13
|
+
import QuirksMintGAContainer from "./templates/QuirksMintGAContainer";
|
|
14
|
+
|
|
15
|
+
// const params = getQueryStringParams(window.location.search);
|
|
16
|
+
export const widgets = {
|
|
17
|
+
classic,
|
|
18
|
+
MintGA,
|
|
19
|
+
VanillaGA,
|
|
20
|
+
QuirksVanillaGA,
|
|
21
|
+
QuirksMintGA,
|
|
22
|
+
MintGAContainer,
|
|
23
|
+
MintGAContainerDisplayBlock,
|
|
24
|
+
QuirksMintGAContainerDisplayBlock,
|
|
25
|
+
QuirksMintGAContainer,
|
|
26
|
+
VanillaGANoContainer
|
|
27
|
+
};
|
|
28
|
+
// console.log(params, window.location.search)
|
|
29
|
+
export const handlers = window["mockWidget"] && [
|
|
30
|
+
rest.put("https://staging.referralsaasquatch.com/api/*", (req, res, ctx) => {
|
|
31
|
+
return res(
|
|
32
|
+
// ctx.delay(500),
|
|
33
|
+
ctx.status(202, "Mocked status"),
|
|
34
|
+
ctx.json(widgets[window["mockWidget"]])
|
|
35
|
+
);
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
// Setup requests interception using the given handlers.
|
|
39
|
+
|
|
40
|
+
export const worker = setupWorker(...handlers);
|
|
41
|
+
// worker.start();
|
|
42
|
+
|
|
43
|
+
window["sandbox"] = fromURL();
|
package/demo/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
declare interface Sandbox {
|
|
2
|
-
script: string;
|
|
3
|
-
version?: string;
|
|
4
|
-
domain: string;
|
|
5
|
-
tenantAlias: string;
|
|
6
|
-
debug?: boolean;
|
|
7
|
-
initObj: {
|
|
8
|
-
widgetType: string;
|
|
9
|
-
engagementMedium: string;
|
|
10
|
-
user: {
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
};
|
|
13
|
-
jwt: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
1
|
+
declare interface Sandbox {
|
|
2
|
+
script: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
domain: string;
|
|
5
|
+
tenantAlias: string;
|
|
6
|
+
debug?: boolean;
|
|
7
|
+
initObj: {
|
|
8
|
+
widgetType: string;
|
|
9
|
+
engagementMedium: string;
|
|
10
|
+
user: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
jwt: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
package/demo/sandbox.ts
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
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:
|
|
40
|
-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const embed: Sandbox = {
|
|
45
|
-
script,
|
|
46
|
-
domain,
|
|
47
|
-
tenantAlias,
|
|
48
|
-
initObj: {
|
|
49
|
-
widgetType: "REFERRER_WIDGET",
|
|
50
|
-
engagementMedium: "EMBED",
|
|
51
|
-
user: {
|
|
52
|
-
id: "5b980d34e4b0cabee07f2cb0",
|
|
53
|
-
accountId: "AZJZSVG0LS1LB19R",
|
|
54
|
-
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
55
|
-
},
|
|
56
|
-
jwt:
|
|
57
|
-
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export const embedNew: Sandbox = {
|
|
62
|
-
...embed,
|
|
63
|
-
initObj: {
|
|
64
|
-
...embed.initObj,
|
|
65
|
-
widgetType: "p/tuesday-text/w/referrerWidget",
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const embedReferred: Sandbox = {
|
|
70
|
-
...embed,
|
|
71
|
-
initObj: {
|
|
72
|
-
...embed.initObj,
|
|
73
|
-
widgetType: "CONVERSION_WIDGET",
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const popupReferred: Sandbox = {
|
|
78
|
-
...popup,
|
|
79
|
-
initObj: {
|
|
80
|
-
...popup.initObj,
|
|
81
|
-
widgetType: "CONVERSION_WIDGET",
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const popupNew: Sandbox = {
|
|
86
|
-
...popup,
|
|
87
|
-
initObj: {
|
|
88
|
-
...popup.initObj,
|
|
89
|
-
widgetType: "p/tuesday-test/w/referrerWidget",
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export function fromURL() {
|
|
94
|
-
let urlSandbox;
|
|
95
|
-
try {
|
|
96
|
-
urlSandbox = JSON.parse(
|
|
97
|
-
window.atob(getQueryStringParams(window.location.search).sandbox)
|
|
98
|
-
);
|
|
99
|
-
} catch (e) {
|
|
100
|
-
urlSandbox = {};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const sandbox = {
|
|
104
|
-
...popup,
|
|
105
|
-
...urlSandbox,
|
|
106
|
-
};
|
|
107
|
-
return sandbox;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export function toURL(sandbox: Sandbox) {
|
|
111
|
-
window.location.href = href(sandbox);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function href(sandbox: Sandbox) {
|
|
115
|
-
const param = window.btoa(JSON.stringify(sandbox));
|
|
116
|
-
var url = window.location.href;
|
|
117
|
-
if (url.indexOf("?") > 0) {
|
|
118
|
-
url = url.substring(0, url.indexOf("?"));
|
|
119
|
-
}
|
|
120
|
-
url += `?sandbox=${encodeURIComponent(param)}`;
|
|
121
|
-
return url;
|
|
122
|
-
}
|
|
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:
|
|
40
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const embed: Sandbox = {
|
|
45
|
+
script,
|
|
46
|
+
domain,
|
|
47
|
+
tenantAlias,
|
|
48
|
+
initObj: {
|
|
49
|
+
widgetType: "REFERRER_WIDGET",
|
|
50
|
+
engagementMedium: "EMBED",
|
|
51
|
+
user: {
|
|
52
|
+
id: "5b980d34e4b0cabee07f2cb0",
|
|
53
|
+
accountId: "AZJZSVG0LS1LB19R",
|
|
54
|
+
email: "chesterscott.uexwltgh@mailosaur.io",
|
|
55
|
+
},
|
|
56
|
+
jwt:
|
|
57
|
+
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImlkIjoiNWI5ODBkMzRlNGIwY2FiZWUwN2YyY2IwIiwiYWNjb3VudElkIjoiQVpKWlNWRzBMUzFMQjE5UiIsImVtYWlsIjoiY2hlc3RlcnNjb3R0LnVleHdsdGdoQG1haWxvc2F1ci5pbyJ9fQ.MkrO7-980M7NRJcOUcdqCO1JftqmynLMK8bTEB3WObo",
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const embedNew: Sandbox = {
|
|
62
|
+
...embed,
|
|
63
|
+
initObj: {
|
|
64
|
+
...embed.initObj,
|
|
65
|
+
widgetType: "p/tuesday-text/w/referrerWidget",
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const embedReferred: Sandbox = {
|
|
70
|
+
...embed,
|
|
71
|
+
initObj: {
|
|
72
|
+
...embed.initObj,
|
|
73
|
+
widgetType: "CONVERSION_WIDGET",
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const popupReferred: Sandbox = {
|
|
78
|
+
...popup,
|
|
79
|
+
initObj: {
|
|
80
|
+
...popup.initObj,
|
|
81
|
+
widgetType: "CONVERSION_WIDGET",
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const popupNew: Sandbox = {
|
|
86
|
+
...popup,
|
|
87
|
+
initObj: {
|
|
88
|
+
...popup.initObj,
|
|
89
|
+
widgetType: "p/tuesday-test/w/referrerWidget",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export function fromURL() {
|
|
94
|
+
let urlSandbox;
|
|
95
|
+
try {
|
|
96
|
+
urlSandbox = JSON.parse(
|
|
97
|
+
window.atob(getQueryStringParams(window.location.search).sandbox)
|
|
98
|
+
);
|
|
99
|
+
} catch (e) {
|
|
100
|
+
urlSandbox = {};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const sandbox = {
|
|
104
|
+
...popup,
|
|
105
|
+
...urlSandbox,
|
|
106
|
+
};
|
|
107
|
+
return sandbox;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function toURL(sandbox: Sandbox) {
|
|
111
|
+
window.location.href = href(sandbox);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function href(sandbox: Sandbox) {
|
|
115
|
+
const param = window.btoa(JSON.stringify(sandbox));
|
|
116
|
+
var url = window.location.href;
|
|
117
|
+
if (url.indexOf("?") > 0) {
|
|
118
|
+
url = url.substring(0, url.indexOf("?"));
|
|
119
|
+
}
|
|
120
|
+
url += `?sandbox=${encodeURIComponent(param)}`;
|
|
121
|
+
return url;
|
|
122
|
+
}
|
package/demo/styles.css
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
.lds-dual-ring {
|
|
2
|
-
display: inline-block;
|
|
3
|
-
width: 32px;
|
|
4
|
-
height: 32px;
|
|
5
|
-
}
|
|
6
|
-
.lds-dual-ring:after {
|
|
7
|
-
content: " ";
|
|
8
|
-
display: block;
|
|
9
|
-
width: 23px;
|
|
10
|
-
height: 23px;
|
|
11
|
-
margin: 1px;
|
|
12
|
-
border-radius: 50%;
|
|
13
|
-
border: 3px solid #000;
|
|
14
|
-
border-color: #000 transparent #000 transparent;
|
|
15
|
-
animation: lds-dual-ring 1.2s linear infinite;
|
|
16
|
-
}
|
|
17
|
-
@keyframes lds-dual-ring {
|
|
18
|
-
0% {
|
|
19
|
-
transform: rotate(0deg);
|
|
20
|
-
}
|
|
21
|
-
100% {
|
|
22
|
-
transform: rotate(360deg);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
.lds-dual-ring {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
width: 32px;
|
|
4
|
+
height: 32px;
|
|
5
|
+
}
|
|
6
|
+
.lds-dual-ring:after {
|
|
7
|
+
content: " ";
|
|
8
|
+
display: block;
|
|
9
|
+
width: 23px;
|
|
10
|
+
height: 23px;
|
|
11
|
+
margin: 1px;
|
|
12
|
+
border-radius: 50%;
|
|
13
|
+
border: 3px solid #000;
|
|
14
|
+
border-color: #000 transparent #000 transparent;
|
|
15
|
+
animation: lds-dual-ring 1.2s linear infinite;
|
|
16
|
+
}
|
|
17
|
+
@keyframes lds-dual-ring {
|
|
18
|
+
0% {
|
|
19
|
+
transform: rotate(0deg);
|
|
20
|
+
}
|
|
21
|
+
100% {
|
|
22
|
+
transform: rotate(360deg);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
template:
|
|
3
|
+
'<!DOCTYPE html><html> <head> <script type="text/javascript"> window.widgetIdent = {"programId":"klip-referral-program","userId":"sam+klip@saasquat.ch","accountId":"sam+klip@saasquat.ch","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbStrbGlwQHNhYXNxdWF0LmNoIiwiaWQiOiJzYW0ra2xpcEBzYWFzcXVhdC5jaCIsImVtYWlsIjoic2FtK2tsaXBAc2Fhc3F1YXQuY2gifX0.GiaY8wwQdpUoVRnp_AV7uys3MsYsMzKUkdnZgUb0wYU","tenantAlias":"test_a74miwdpofztj","engagementMedium":"EMBED","appDomain":"https://staging.referralsaasquatch.com"}; </script> <link rel="stylesheet" type="text/css" href="https://fast-staging.ssqt.io/npm/@saasquatch/mint-components@1.3.2-17/dist/mint-components/mint-components.css"> <script src="https://fast-staging.ssqt.io/npm/@saasquatch/bedrock-components@1.2.0/dist/bedrock-components/bedrock-components.js"></script> <script src="https://fast-staging.ssqt.io/npm/@saasquatch/mint-components@1.3.2-17/dist/mint-components/mint-components.js"></script> <script src="https://fast-staging.ssqt.io/npm/@elastic/apm-rum@4.0.1/dist/bundles/elastic-apm-rum.umd.min.js" crossorigin></script> <script> window.apm = elasticApm.init({ serviceName: \'programwidget-staging\', serverUrl: \'https://1c9081d2ac2d43548254f581dca2dbee.apm.us-central1.gcp.cloud.es.io:443\', active: Math.random() < 0.1 }) </script> </head> <body> <sqm-portal-container direction="column" padding="small" gap="xxxx-large"><sqm-portal-container direction="column" padding="none" gap="xxx-large"><sqm-titled-section padding="none" label-margin="x-large"><sqm-text slot="label"><h2>Partner and Profit</h2></sqm-text><sqm-text slot="content"><p> Get rewarded for referring potential customers to Klip and for completing loyalty objectives! </p></sqm-text></sqm-titled-section><sqm-titled-section label-margin="small" padding="none"><sqm-text slot="label"><h3>Share your referral link</h3></sqm-text><sqm-share-link slot="content"> </sqm-share-link></sqm-titled-section><sqm-titled-section label-margin="small" padding="none"><sqm-text slot="label"><h3>Share via social media</h3></sqm-text><sqm-portal-container slot="content" direction="row" padding="none" gap="xxx-large" min-width="160px"><sqm-share-button icon="envelope" medium="email" size="medium" pill="true">Email a friend </sqm-share-button><sqm-share-button medium="twitter" size="medium" pill="true">Tweet about us </sqm-share-button><sqm-share-button medium="facebook" size="medium" pill="true">Share on Facebook </sqm-share-button></sqm-portal-container></sqm-titled-section></sqm-portal-container><sqm-portal-container direction="column" padding="none" gap="xx-large"><sqm-titled-section padding="none" label-margin="none"><sqm-text slot="label"><h2>Referrals And Rewards</h2></sqm-text></sqm-titled-section><sqm-stat-container space="xxxx-large"><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/referralsCount"><sqm-text><p>Referrals</p></sqm-text></sqm-big-stat><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/integrationRewardsCountFiltered/AVAILABLE"><sqm-text><p>Giftcards Earned</p></sqm-text></sqm-big-stat><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/rewardBalance/CREDIT/POINT/global"><sqm-text><p>Points Balance</p></sqm-text></sqm-big-stat></sqm-stat-container><div id="i5i16c"><sqm-task-card reward-amount="50" card-title="Refer a friends" description="Invite your friends to klip and get rewarded when they signup for a free trial or contact our sales team for an enterprise license" button-text="Start Referring" button-link="https://klip-staging.vercel.app/app/invite-friends" goal="1"> </sqm-task-card><sqm-task-card reward-amount="50" goal="10" repeatable="" show-progress-bar="true" steps="true" card-title="Record 10 Hours of Video" description="Get rewarded for recording and uploading 10 hours of video on Klip each time you do it. Let us reward you for being a super user!" button-text="Record" button-link="https://klip-staging.vercel.app/app" stat-type="/customFields/videoHoursCount"> </sqm-task-card><sqb-program-section program-id="klip-loyalty"><sqm-task-card reward-amount="10" goal="1" repeatable="true" card-title="Upload a Video" description="Upload a video and get rewarded for exploring the functionality of Klip!" button-text="Upload" button-link="https://klip-staging.vercel.app/app" stat-type="/programGoals/count/Upload-Video"> </sqm-task-card></sqb-program-section><sqm-task-card reward-amount="50" goal="500" show-progress-bar="true" card-title="Spend 500$ on Klip Products" description="Let us reward you for being a loyal Klip customer! Spend 500$ on seats or licenses and get rewarded." button-text="See Plans" button-link="https://klip-staging.vercel.app/app/plans" stat-type="/customFields/purchaseTotal"> </sqm-task-card></div><sl-tab-group><sl-tab slot="nav" panel="referralHistory">Referral History </sl-tab><sl-tab slot="nav" panel="rewardHistory">Reward History </sl-tab><sl-tab slot="nav" panel="rewardExchange">Reward Exchange </sl-tab><sl-tab-panel name="referralHistory"><sqm-referral-table><sqm-referral-table-user-column column-title="User"> </sqm-referral-table-user-column><sqm-referral-table-status-column column-title="Referral Status"> </sqm-referral-table-status-column><sqm-referral-table-rewards-column> </sqm-referral-table-rewards-column><sqm-referral-table-date-column column-title="Date Referred" date-shown="dateReferralStarted"> </sqm-referral-table-date-column></sqm-referral-table></sl-tab-panel><sl-tab-panel name="rewardHistory"><sqb-program-section program-id=""><sqm-rewards-table><sqm-rewards-table-column></sqm-rewards-table-column></sqm-rewards-table></sqb-program-section></sl-tab-panel><sl-tab-panel name="rewardExchange"><sqm-reward-exchange-list not-available-error="{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {Not enough points} TESTING {JSONata special case} other {Not available} }"></sqm-reward-exchange-list></sl-tab-panel></sl-tab-group></sqm-portal-container></sqm-portal-container><style>* { box-sizing: border-box; } body {margin: 0;}#i5i16c{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto auto;grid-gap:10px;grid-auto-flow:column;}:root{--sqm-portal-background: white;--sl-color-primary-50: #e8e5f8;--sl-color-primary-100: #c6beed;--sl-color-primary-200: #a192e2;--sl-color-primary-300: #7b66d6;--sl-color-primary-400: #5e46cd;--sl-color-primary-500: #4225c4;--sl-color-primary-600: #3c21be;--sl-color-primary-700: #331bb6;--sl-color-primary-800: #2b16af;--sl-color-primary-900: #1d0da2;}</style></body></html>',
|
|
4
|
+
jsOptions: {},
|
|
5
|
+
user: {
|
|
6
|
+
id: "sam+klip@saasquat.ch",
|
|
7
|
+
accountId: "sam+klip@saasquat.ch",
|
|
8
|
+
firstName: "sam",
|
|
9
|
+
lastName: "b",
|
|
10
|
+
referralCodes: {
|
|
11
|
+
"klip-referral-program": "SAMBSAMKLIP",
|
|
12
|
+
},
|
|
13
|
+
imageUrl: "",
|
|
14
|
+
email: "sam+klip@saasquat.ch",
|
|
15
|
+
cookieId: null,
|
|
16
|
+
locale: null,
|
|
17
|
+
countryCode: null,
|
|
18
|
+
referable: true,
|
|
19
|
+
firstSeenIP: "24.69.152.171",
|
|
20
|
+
lastSeenIP: "70.66.140.31",
|
|
21
|
+
dateCreated: 1637885093233,
|
|
22
|
+
programShareLinks: {
|
|
23
|
+
"klip-referral-program": {
|
|
24
|
+
cleanShareLink: "http://short.staging.referralsaasquatch.com/mz2Yk1",
|
|
25
|
+
UNKNOWN: {
|
|
26
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/mv2Yk1",
|
|
27
|
+
},
|
|
28
|
+
EMAIL: {
|
|
29
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/mP2Yk1",
|
|
30
|
+
},
|
|
31
|
+
MOBILE: {
|
|
32
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/me2Yk1",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
customFields: {
|
|
37
|
+
activityCount: 10,
|
|
38
|
+
videoHoursCount: 2,
|
|
39
|
+
lastSeenDate: 1638898707592,
|
|
40
|
+
purchaseTotal: 1050,
|
|
41
|
+
},
|
|
42
|
+
segments: ["dog"],
|
|
43
|
+
referredByCodes: [],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
template:
|
|
3
|
+
'<!DOCTYPE html><html> <head> <script type="text/javascript"> window.widgetIdent = {"programId":"klip-referral-program","userId":"sam+klip@saasquat.ch","accountId":"sam+klip@saasquat.ch","token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7ImFjY291bnRJZCI6InNhbStrbGlwQHNhYXNxdWF0LmNoIiwiaWQiOiJzYW0ra2xpcEBzYWFzcXVhdC5jaCIsImVtYWlsIjoic2FtK2tsaXBAc2Fhc3F1YXQuY2gifX0.GiaY8wwQdpUoVRnp_AV7uys3MsYsMzKUkdnZgUb0wYU","tenantAlias":"test_a74miwdpofztj","engagementMedium":"EMBED","appDomain":"https://staging.referralsaasquatch.com"}; </script> <link rel="stylesheet" type="text/css" href="https://fast-staging.ssqt.io/npm/@saasquatch/mint-components@1.3.2-17/dist/mint-components/mint-components.css"> <script src="https://fast-staging.ssqt.io/npm/@saasquatch/bedrock-components@1.2.0/dist/bedrock-components/bedrock-components.js"></script> <script src="https://fast-staging.ssqt.io/npm/@saasquatch/mint-components@1.3.2-17/dist/mint-components/mint-components.js"></script> <script src="https://fast-staging.ssqt.io/npm/@elastic/apm-rum@4.0.1/dist/bundles/elastic-apm-rum.umd.min.js" crossorigin></script> <script> window.apm = elasticApm.init({ serviceName: \'programwidget-staging\', serverUrl: \'https://1c9081d2ac2d43548254f581dca2dbee.apm.us-central1.gcp.cloud.es.io:443\', active: Math.random() < 0.1 }) </script> </head> <body> <sqm-portal-container class="squatch-container" direction="column" padding="small" gap="xxxx-large"><sqm-portal-container direction="column" padding="none" gap="xxx-large"><sqm-titled-section padding="none" label-margin="x-large"><sqm-text slot="label"><h2>Partner and Profit</h2></sqm-text><sqm-text slot="content"><p> Get rewarded for referring potential customers to Klip and for completing loyalty objectives! </p></sqm-text></sqm-titled-section><sqm-titled-section label-margin="small" padding="none"><sqm-text slot="label"><h3>Share your referral link</h3></sqm-text><sqm-share-link slot="content"> </sqm-share-link></sqm-titled-section><sqm-titled-section label-margin="small" padding="none"><sqm-text slot="label"><h3>Share via social media</h3></sqm-text><sqm-portal-container slot="content" direction="row" padding="none" gap="xxx-large" min-width="160px"><sqm-share-button icon="envelope" medium="email" size="medium" pill="true">Email a friend </sqm-share-button><sqm-share-button medium="twitter" size="medium" pill="true">Tweet about us </sqm-share-button><sqm-share-button medium="facebook" size="medium" pill="true">Share on Facebook </sqm-share-button></sqm-portal-container></sqm-titled-section></sqm-portal-container><sqm-portal-container direction="column" padding="none" gap="xx-large"><sqm-titled-section padding="none" label-margin="none"><sqm-text slot="label"><h2>Referrals And Rewards</h2></sqm-text></sqm-titled-section><sqm-stat-container space="xxxx-large"><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/referralsCount"><sqm-text><p>Referrals</p></sqm-text></sqm-big-stat><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/integrationRewardsCountFiltered/AVAILABLE"><sqm-text><p>Giftcards Earned</p></sqm-text></sqm-big-stat><sqm-big-stat flex-reverse="true" alignment="left" stat-type="/rewardBalance/CREDIT/POINT/global"><sqm-text><p>Points Balance</p></sqm-text></sqm-big-stat></sqm-stat-container><div id="i5i16c"><sqm-task-card reward-amount="50" card-title="Refer a friends" description="Invite your friends to klip and get rewarded when they signup for a free trial or contact our sales team for an enterprise license" button-text="Start Referring" button-link="https://klip-staging.vercel.app/app/invite-friends" goal="1"> </sqm-task-card><sqm-task-card reward-amount="50" goal="10" repeatable="" show-progress-bar="true" steps="true" card-title="Record 10 Hours of Video" description="Get rewarded for recording and uploading 10 hours of video on Klip each time you do it. Let us reward you for being a super user!" button-text="Record" button-link="https://klip-staging.vercel.app/app" stat-type="/customFields/videoHoursCount"> </sqm-task-card><sqb-program-section program-id="klip-loyalty"><sqm-task-card reward-amount="10" goal="1" repeatable="true" card-title="Upload a Video" description="Upload a video and get rewarded for exploring the functionality of Klip!" button-text="Upload" button-link="https://klip-staging.vercel.app/app" stat-type="/programGoals/count/Upload-Video"> </sqm-task-card></sqb-program-section><sqm-task-card reward-amount="50" goal="500" show-progress-bar="true" card-title="Spend 500$ on Klip Products" description="Let us reward you for being a loyal Klip customer! Spend 500$ on seats or licenses and get rewarded." button-text="See Plans" button-link="https://klip-staging.vercel.app/app/plans" stat-type="/customFields/purchaseTotal"> </sqm-task-card></div><sl-tab-group><sl-tab slot="nav" panel="referralHistory">Referral History </sl-tab><sl-tab slot="nav" panel="rewardHistory">Reward History </sl-tab><sl-tab slot="nav" panel="rewardExchange">Reward Exchange </sl-tab><sl-tab-panel name="referralHistory"><sqm-referral-table><sqm-referral-table-user-column column-title="User"> </sqm-referral-table-user-column><sqm-referral-table-status-column column-title="Referral Status"> </sqm-referral-table-status-column><sqm-referral-table-rewards-column> </sqm-referral-table-rewards-column><sqm-referral-table-date-column column-title="Date Referred" date-shown="dateReferralStarted"> </sqm-referral-table-date-column></sqm-referral-table></sl-tab-panel><sl-tab-panel name="rewardHistory"><sqb-program-section program-id=""><sqm-rewards-table><sqm-rewards-table-column></sqm-rewards-table-column></sqm-rewards-table></sqb-program-section></sl-tab-panel><sl-tab-panel name="rewardExchange"><sqm-reward-exchange-list not-available-error="{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {Not enough points} TESTING {JSONata special case} other {Not available} }"></sqm-reward-exchange-list></sl-tab-panel></sl-tab-group></sqm-portal-container></sqm-portal-container><style>* { box-sizing: border-box; } body {margin: 0;}#i5i16c{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto auto;grid-gap:10px;grid-auto-flow:column;}:root{--sqm-portal-background: white;--sl-color-primary-50: #e8e5f8;--sl-color-primary-100: #c6beed;--sl-color-primary-200: #a192e2;--sl-color-primary-300: #7b66d6;--sl-color-primary-400: #5e46cd;--sl-color-primary-500: #4225c4;--sl-color-primary-600: #3c21be;--sl-color-primary-700: #331bb6;--sl-color-primary-800: #2b16af;--sl-color-primary-900: #1d0da2;}</style> </body></html>',
|
|
4
|
+
jsOptions: {},
|
|
5
|
+
user: {
|
|
6
|
+
id: "sam+klip@saasquat.ch",
|
|
7
|
+
accountId: "sam+klip@saasquat.ch",
|
|
8
|
+
firstName: "sam",
|
|
9
|
+
lastName: "b",
|
|
10
|
+
referralCodes: {
|
|
11
|
+
"klip-referral-program": "SAMBSAMKLIP",
|
|
12
|
+
},
|
|
13
|
+
imageUrl: "",
|
|
14
|
+
email: "sam+klip@saasquat.ch",
|
|
15
|
+
cookieId: null,
|
|
16
|
+
locale: null,
|
|
17
|
+
countryCode: null,
|
|
18
|
+
referable: true,
|
|
19
|
+
firstSeenIP: "24.69.152.171",
|
|
20
|
+
lastSeenIP: "70.66.140.31",
|
|
21
|
+
dateCreated: 1637885093233,
|
|
22
|
+
programShareLinks: {
|
|
23
|
+
"klip-referral-program": {
|
|
24
|
+
cleanShareLink: "http://short.staging.referralsaasquatch.com/mz2Yk1",
|
|
25
|
+
UNKNOWN: {
|
|
26
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/mv2Yk1",
|
|
27
|
+
},
|
|
28
|
+
EMAIL: {
|
|
29
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/mP2Yk1",
|
|
30
|
+
},
|
|
31
|
+
MOBILE: {
|
|
32
|
+
DIRECT: "http://short.staging.referralsaasquatch.com/me2Yk1",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
customFields: {
|
|
37
|
+
activityCount: 10,
|
|
38
|
+
videoHoursCount: 2,
|
|
39
|
+
lastSeenDate: 1638898707592,
|
|
40
|
+
purchaseTotal: 1050,
|
|
41
|
+
},
|
|
42
|
+
segments: ["dog"],
|
|
43
|
+
referredByCodes: [],
|
|
44
|
+
},
|
|
45
|
+
};
|