@saasquatch/squatch-js 2.4.0 → 2.4.1-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/CHANGELOG.md +260 -260
- 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 +39 -39
- package/demo/index.d.ts +15 -15
- package/demo/sandbox.ts +122 -122
- package/demo/styles.css +24 -24
- package/demo/templates/MintGA.ts +106 -106
- package/demo/templates/MintGAContainer.ts +105 -105
- package/demo/templates/MintGAContainerDisplayBlock.ts +104 -104
- package/demo/templates/QuirksMintGA.ts +104 -104
- package/demo/templates/QuirksMintGAContainer.ts +104 -104
- package/demo/templates/QuirksMintGAContainerDisplayBlock.ts +104 -104
- package/demo/templates/QuirksVanillaGA.ts +308 -308
- package/demo/templates/VanillaGA.ts +308 -308
- package/demo/templates/VanillaGANoContainer.ts +308 -308
- package/demo/templates/classic.ts +1234 -1234
- package/demo/toolbar.tsx +526 -526
- 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 -0
- package/dist/squatch.d.ts +2 -2
- package/dist/squatch.esm.js +2 -2
- package/dist/squatch.js +2 -2
- package/dist/stats.html +1 -1
- package/package.json +104 -103
- package/tsconfig.json +22 -22
- package/dist/squatchjs.min.js +0 -13
package/README.md
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
# Referral SaaSquatch Javascript SDK
|
|
2
|
-
|
|
3
|
-
## Install the library
|
|
4
|
-
|
|
5
|
-
To integrate any SaaSquatch program to your website or web app, copy/paste this snippet of JavaScript above the `</head>` tag of your page:
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<script type="text/javascript">
|
|
9
|
-
!function(a,b){a("squatch","https://fast.ssqt.io/squatch-js@2",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]={},c[a].ready=function(b){c["_" + a].ready = c["_" + a].ready || [];c["_" + a].ready.push(b);},e=document.createElement("script"),e.async=1,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);
|
|
10
|
-
</script>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or load the library synchronously from our CDN:
|
|
14
|
-
|
|
15
|
-
```html
|
|
16
|
-
<script src="https://fast.ssqt.io/squatch-js@2" type="text/javascript"></script>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Getting Started
|
|
21
|
-
The `init` function lets you configure your global squatch instance.
|
|
22
|
-
|
|
23
|
-
Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise, Squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
|
|
24
|
-
|
|
25
|
-
```html
|
|
26
|
-
<script type="text/javascript">
|
|
27
|
-
squatch.ready(function() {
|
|
28
|
-
|
|
29
|
-
// Always call init
|
|
30
|
-
squatch.init({
|
|
31
|
-
tenantAlias: "YOUR_TENANT_ALIAS", // String (required)
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
squatch.widgets().upsertUser({
|
|
35
|
-
user: { // Object (required)
|
|
36
|
-
id: 'USER_ID', // String (required)
|
|
37
|
-
accountId: 'USER_ACCOUNT_ID', // String (required)
|
|
38
|
-
email: 'USER_EMAIL', // String (optional)
|
|
39
|
-
firstName: 'USER_FIRST_NAME', // String (optional)
|
|
40
|
-
lastName: 'USER_LAST_NAME', // String (optional)
|
|
41
|
-
|
|
42
|
-
...
|
|
43
|
-
},
|
|
44
|
-
engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
|
|
45
|
-
widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
|
|
46
|
-
jwt: 'TOKEN' // String (required by default, or disable Security in the portal)
|
|
47
|
-
|
|
48
|
-
});
|
|
49
|
-
</script>
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## Data Only Operations
|
|
53
|
-
You can create/upsert users without loading a widget.
|
|
54
|
-
|
|
55
|
-
```html
|
|
56
|
-
<script type="text/javascript">
|
|
57
|
-
squatch.ready(function() {
|
|
58
|
-
|
|
59
|
-
// Always call init
|
|
60
|
-
squatch.init({
|
|
61
|
-
tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
var user;
|
|
65
|
-
|
|
66
|
-
squatch.api().upsertUser({
|
|
67
|
-
user: { // Object (required)
|
|
68
|
-
id: 'USER_ID', // String (required)
|
|
69
|
-
accountId: 'USER_ACCOUNT_ID', // String (required)
|
|
70
|
-
email: 'USER_EMAIL', // String (optional)
|
|
71
|
-
firstName: 'USER_FIRST_NAME', // String (optional)
|
|
72
|
-
lastName: 'USER_LAST_NAME', // String (optional)
|
|
73
|
-
...
|
|
74
|
-
},
|
|
75
|
-
engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
|
|
76
|
-
widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
|
|
77
|
-
jwt: 'TOKEN' // String (required)
|
|
78
|
-
}).then(function(response) {
|
|
79
|
-
user = response.user;
|
|
80
|
-
}).catch(function(err){
|
|
81
|
-
console.log(err);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
// autofill
|
|
85
|
-
var element = document.getElementById('my_coupon');
|
|
86
|
-
element.value = user.referredBy.code;
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
</script>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Get Referral Cookie Code
|
|
93
|
-
You can also use the `api()` function to call the WidgetApi methods directly.
|
|
94
|
-
|
|
95
|
-
```html
|
|
96
|
-
<script type="text/javascript">
|
|
97
|
-
squatch.ready(function(){
|
|
98
|
-
|
|
99
|
-
// Always call init
|
|
100
|
-
squatch.init({tenantAlias: 'YOUR_TENANT_ALIAS'});
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var element = document.getElementById('my_coupon');
|
|
104
|
-
|
|
105
|
-
squatch.api().squatchReferralCookie().then(function(response) {
|
|
106
|
-
/* `response.codes` looks like `{"program_id":"NEWCO", "friend_program":"BOB"}` */
|
|
107
|
-
|
|
108
|
-
element.value = response.codes["program-id"];
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
});
|
|
112
|
-
</script>
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Want more control? Visit our [guide](https://github.com/saasquatch/squatch-js/blob/master/docs/docs.md).
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
## Install via NPM and Webpack (advanced)
|
|
119
|
-
|
|
120
|
-
Squatch.js can also be installed via NPM and bundled into your application with Webpack.
|
|
121
|
-
|
|
122
|
-
```ssh
|
|
123
|
-
# via npm
|
|
124
|
-
$ npm install @saasquatch/squatch-js
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```js
|
|
128
|
-
import * as squatch from "@saasquatch/squatch-js";
|
|
129
|
-
|
|
130
|
-
// Always call init
|
|
131
|
-
squatch.init({
|
|
132
|
-
tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// Don't need to wait for .ready when importing via NPM/Webpack
|
|
136
|
-
squatch.api().upsertUser({...});
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Contributing
|
|
141
|
-
This is an open source project! If you are interested in contributing please look at [contributing guidelines](CONTRIBUTING.md) first.
|
|
142
|
-
|
|
143
|
-
## Support
|
|
144
|
-
Shoot us an email at [support@saasqt.ch](mailto:support@saasqt.ch) if you need help!
|
|
1
|
+
# Referral SaaSquatch Javascript SDK
|
|
2
|
+
|
|
3
|
+
## Install the library
|
|
4
|
+
|
|
5
|
+
To integrate any SaaSquatch program to your website or web app, copy/paste this snippet of JavaScript above the `</head>` tag of your page:
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<script type="text/javascript">
|
|
9
|
+
!function(a,b){a("squatch","https://fast.ssqt.io/squatch-js@2",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]={},c[a].ready=function(b){c["_" + a].ready = c["_" + a].ready || [];c["_" + a].ready.push(b);},e=document.createElement("script"),e.async=1,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);
|
|
10
|
+
</script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or load the library synchronously from our CDN:
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://fast.ssqt.io/squatch-js@2" type="text/javascript"></script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Getting Started
|
|
21
|
+
The `init` function lets you configure your global squatch instance.
|
|
22
|
+
|
|
23
|
+
Note: `engagementMedium` is required in the `squatch.widgets()` functions if you want to load the widget. Otherwise, Squatch.js will look for your portal settings and render the widget that's mapped to the URL where this snippet is included.
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<script type="text/javascript">
|
|
27
|
+
squatch.ready(function() {
|
|
28
|
+
|
|
29
|
+
// Always call init
|
|
30
|
+
squatch.init({
|
|
31
|
+
tenantAlias: "YOUR_TENANT_ALIAS", // String (required)
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
squatch.widgets().upsertUser({
|
|
35
|
+
user: { // Object (required)
|
|
36
|
+
id: 'USER_ID', // String (required)
|
|
37
|
+
accountId: 'USER_ACCOUNT_ID', // String (required)
|
|
38
|
+
email: 'USER_EMAIL', // String (optional)
|
|
39
|
+
firstName: 'USER_FIRST_NAME', // String (optional)
|
|
40
|
+
lastName: 'USER_LAST_NAME', // String (optional)
|
|
41
|
+
|
|
42
|
+
...
|
|
43
|
+
},
|
|
44
|
+
engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
|
|
45
|
+
widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
|
|
46
|
+
jwt: 'TOKEN' // String (required by default, or disable Security in the portal)
|
|
47
|
+
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Data Only Operations
|
|
53
|
+
You can create/upsert users without loading a widget.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<script type="text/javascript">
|
|
57
|
+
squatch.ready(function() {
|
|
58
|
+
|
|
59
|
+
// Always call init
|
|
60
|
+
squatch.init({
|
|
61
|
+
tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
var user;
|
|
65
|
+
|
|
66
|
+
squatch.api().upsertUser({
|
|
67
|
+
user: { // Object (required)
|
|
68
|
+
id: 'USER_ID', // String (required)
|
|
69
|
+
accountId: 'USER_ACCOUNT_ID', // String (required)
|
|
70
|
+
email: 'USER_EMAIL', // String (optional)
|
|
71
|
+
firstName: 'USER_FIRST_NAME', // String (optional)
|
|
72
|
+
lastName: 'USER_LAST_NAME', // String (optional)
|
|
73
|
+
...
|
|
74
|
+
},
|
|
75
|
+
engagementMedium: 'EMBED', // String (optional: POPUP, EMBED)
|
|
76
|
+
widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
|
|
77
|
+
jwt: 'TOKEN' // String (required)
|
|
78
|
+
}).then(function(response) {
|
|
79
|
+
user = response.user;
|
|
80
|
+
}).catch(function(err){
|
|
81
|
+
console.log(err);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// autofill
|
|
85
|
+
var element = document.getElementById('my_coupon');
|
|
86
|
+
element.value = user.referredBy.code;
|
|
87
|
+
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Get Referral Cookie Code
|
|
93
|
+
You can also use the `api()` function to call the WidgetApi methods directly.
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<script type="text/javascript">
|
|
97
|
+
squatch.ready(function(){
|
|
98
|
+
|
|
99
|
+
// Always call init
|
|
100
|
+
squatch.init({tenantAlias: 'YOUR_TENANT_ALIAS'});
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
var element = document.getElementById('my_coupon');
|
|
104
|
+
|
|
105
|
+
squatch.api().squatchReferralCookie().then(function(response) {
|
|
106
|
+
/* `response.codes` looks like `{"program_id":"NEWCO", "friend_program":"BOB"}` */
|
|
107
|
+
|
|
108
|
+
element.value = response.codes["program-id"];
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Want more control? Visit our [guide](https://github.com/saasquatch/squatch-js/blob/master/docs/docs.md).
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## Install via NPM and Webpack (advanced)
|
|
119
|
+
|
|
120
|
+
Squatch.js can also be installed via NPM and bundled into your application with Webpack.
|
|
121
|
+
|
|
122
|
+
```ssh
|
|
123
|
+
# via npm
|
|
124
|
+
$ npm install @saasquatch/squatch-js
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
import * as squatch from "@saasquatch/squatch-js";
|
|
129
|
+
|
|
130
|
+
// Always call init
|
|
131
|
+
squatch.init({
|
|
132
|
+
tenantAlias: "YOUR_TENANT_ALIAS" // String (required)
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Don't need to wait for .ready when importing via NPM/Webpack
|
|
136
|
+
squatch.api().upsertUser({...});
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Contributing
|
|
141
|
+
This is an open source project! If you are interested in contributing please look at [contributing guidelines](CONTRIBUTING.md) first.
|
|
142
|
+
|
|
143
|
+
## Support
|
|
144
|
+
Shoot us an email at [support@saasqt.ch](mailto:support@saasqt.ch) if you need help!
|
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,39 +1,39 @@
|
|
|
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
|
-
export const widgets = {
|
|
16
|
-
classic,
|
|
17
|
-
MintGA,
|
|
18
|
-
VanillaGA,
|
|
19
|
-
QuirksVanillaGA,
|
|
20
|
-
QuirksMintGA,
|
|
21
|
-
MintGAContainer,
|
|
22
|
-
MintGAContainerDisplayBlock,
|
|
23
|
-
QuirksMintGAContainerDisplayBlock,
|
|
24
|
-
QuirksMintGAContainer,
|
|
25
|
-
VanillaGANoContainer,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const handlers = window["mockWidget"] && [
|
|
29
|
-
rest.put("https://staging.referralsaasquatch.com/api/*", (req, res, ctx) => {
|
|
30
|
-
return res(
|
|
31
|
-
ctx.status(202, "Mocked status"),
|
|
32
|
-
ctx.json(widgets[window["mockWidget"]])
|
|
33
|
-
);
|
|
34
|
-
}),
|
|
35
|
-
];
|
|
36
|
-
// Setup requests interception using the given handlers.
|
|
37
|
-
|
|
38
|
-
export const worker = setupWorker(...handlers);
|
|
39
|
-
window["sandbox"] = fromURL();
|
|
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
|
+
export const widgets = {
|
|
16
|
+
classic,
|
|
17
|
+
MintGA,
|
|
18
|
+
VanillaGA,
|
|
19
|
+
QuirksVanillaGA,
|
|
20
|
+
QuirksMintGA,
|
|
21
|
+
MintGAContainer,
|
|
22
|
+
MintGAContainerDisplayBlock,
|
|
23
|
+
QuirksMintGAContainerDisplayBlock,
|
|
24
|
+
QuirksMintGAContainer,
|
|
25
|
+
VanillaGANoContainer,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const handlers = window["mockWidget"] && [
|
|
29
|
+
rest.put("https://staging.referralsaasquatch.com/api/*", (req, res, ctx) => {
|
|
30
|
+
return res(
|
|
31
|
+
ctx.status(202, "Mocked status"),
|
|
32
|
+
ctx.json(widgets[window["mockWidget"]])
|
|
33
|
+
);
|
|
34
|
+
}),
|
|
35
|
+
];
|
|
36
|
+
// Setup requests interception using the given handlers.
|
|
37
|
+
|
|
38
|
+
export const worker = setupWorker(...handlers);
|
|
39
|
+
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
|
+
}
|