@saasquatch/squatch-js 2.4.1 → 2.4.2-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/CHANGELOG.md +285 -267
- package/README.md +1 -0
- package/dist/api/WidgetApi.d.ts +4 -2
- package/dist/squatch.esm.js +7 -2
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +7 -2
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +3 -3
- package/dist/stats.html +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/utils/io.d.ts +1 -1
- package/package.json +104 -104
package/CHANGELOG.md
CHANGED
|
@@ -1,267 +1,285 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [Unreleased]
|
|
9
|
-
|
|
10
|
-
## [2.4.
|
|
11
|
-
|
|
12
|
-
### Added
|
|
13
|
-
|
|
14
|
-
- Added
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
- `
|
|
74
|
-
|
|
75
|
-
## [2.
|
|
76
|
-
|
|
77
|
-
### Changed
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
## [2.
|
|
82
|
-
|
|
83
|
-
### Added
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
[2.
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
[2.2
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
[2.1
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
[2.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
[
|
|
252
|
-
[2.
|
|
253
|
-
[2.
|
|
254
|
-
[2.0
|
|
255
|
-
[2.
|
|
256
|
-
[2.0
|
|
257
|
-
[2.
|
|
258
|
-
[2.0
|
|
259
|
-
[2.
|
|
260
|
-
[2.
|
|
261
|
-
[2.
|
|
262
|
-
[2.
|
|
263
|
-
[2.
|
|
264
|
-
[2.
|
|
265
|
-
[2.
|
|
266
|
-
[2.
|
|
267
|
-
[2.
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [2.4.2] - 2023-03-06
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Added option to return encoded _saasquatch cookie as a string from `squatchReferralCookie`
|
|
15
|
+
|
|
16
|
+
- Example:
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
squatch
|
|
20
|
+
.api()
|
|
21
|
+
.squatchReferralCookie(true)
|
|
22
|
+
.then(function (response) {
|
|
23
|
+
element.value = response.codes["program-id"];
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## [2.4.1] - 2022-09-23
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Added event idempotencyKey to types
|
|
32
|
+
|
|
33
|
+
## [2.4.0] - 2022-03-15
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- EmbedWidget now supports a `container` as either a selector or an HTMLElement as a parameter
|
|
38
|
+
|
|
39
|
+
- Widget contents will be loaded in a hidden widget and can be opened and closed with `widget.open()` and `widget.close()`
|
|
40
|
+
|
|
41
|
+
- Example:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
var initObj = {
|
|
45
|
+
id: "testUser",
|
|
46
|
+
accountId: "testUser",
|
|
47
|
+
widgetType: "<MY_WIDGET>",
|
|
48
|
+
user: {
|
|
49
|
+
id: "testUser",
|
|
50
|
+
accountId: "testUser",
|
|
51
|
+
},
|
|
52
|
+
jwt: "<MY_JWT>",
|
|
53
|
+
engagementMedium: "EMBED",
|
|
54
|
+
container: ".myContainer",
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
squatch
|
|
58
|
+
.widgets()
|
|
59
|
+
.upsertUser(initObj)
|
|
60
|
+
.then(function (response) {
|
|
61
|
+
widget = response.widget;
|
|
62
|
+
widget.open();
|
|
63
|
+
})
|
|
64
|
+
.catch(function (error) {
|
|
65
|
+
console.log(error);
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- PopupWidget now supports a `trigger` as a selector
|
|
70
|
+
|
|
71
|
+
- provides the ability to use a class other than `.squatchpop` for opening the widget
|
|
72
|
+
|
|
73
|
+
- `sq:refresh` event is sent when `.open()` is called on EmbedWidget and PopupWidget
|
|
74
|
+
|
|
75
|
+
## [2.3.1] - 2022-01-11
|
|
76
|
+
|
|
77
|
+
### Changed
|
|
78
|
+
|
|
79
|
+
- Reduced resize timeout to 500ms from 5000ms
|
|
80
|
+
|
|
81
|
+
## [2.3.0] - 2021-05-19
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- Typescript definitions
|
|
86
|
+
- CommonJS/ES modules build for smaller bundle sizes when using squatch-js from NPM
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- `main` is now a CommonJS build instead of a UMD build
|
|
91
|
+
|
|
92
|
+
## [2.2.1] - 2020-06-17
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
|
|
96
|
+
- Remove the need to have JS Options, so that older clients can upgrade to squatch.js v2 easily.
|
|
97
|
+
|
|
98
|
+
## [2.2.0] - 2020-06-12
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
|
|
102
|
+
- Reads `_saasquatch` from the URL and stores a 1st-party cookie on the specified landing page's domain.
|
|
103
|
+
- Sets `cookies` on users during an upsert **automatically**
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
{
|
|
107
|
+
user: {
|
|
108
|
+
id: "abc",
|
|
109
|
+
accountId: "abc",
|
|
110
|
+
cookies: "SAASQUATCHCOOKIE",
|
|
111
|
+
...
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- Reads the 1st-party cookie when using `autofill`
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
squatch
|
|
119
|
+
.api()
|
|
120
|
+
.squatchReferralCookie()
|
|
121
|
+
.then(function (response) {
|
|
122
|
+
element.value = response.codes["program-id"];
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## [2.1.8] - 2020-05-25
|
|
127
|
+
|
|
128
|
+
No release notes.
|
|
129
|
+
|
|
130
|
+
## [2.1.7] - 2020-05-21
|
|
131
|
+
|
|
132
|
+
No release notes.
|
|
133
|
+
|
|
134
|
+
## [2.1.6] - 2019-04-15
|
|
135
|
+
|
|
136
|
+
No release notes.
|
|
137
|
+
|
|
138
|
+
## [2.1.5] - 2019-02-19
|
|
139
|
+
|
|
140
|
+
No release notes.
|
|
141
|
+
|
|
142
|
+
## [2.1.4] - 2019-01-03
|
|
143
|
+
|
|
144
|
+
No release notes.
|
|
145
|
+
|
|
146
|
+
## [2.1.3] - 2018-12-05
|
|
147
|
+
|
|
148
|
+
No release notes.
|
|
149
|
+
|
|
150
|
+
## [2.1.2] - 2018-10-22
|
|
151
|
+
|
|
152
|
+
No release notes.
|
|
153
|
+
|
|
154
|
+
## [2.1.1] - 2018-10-19
|
|
155
|
+
|
|
156
|
+
### Fixed
|
|
157
|
+
|
|
158
|
+
- POPUP Widget in iOS Safari is not clickable when is hidden anymore
|
|
159
|
+
|
|
160
|
+
## [2.1.0] - 2018-09-26
|
|
161
|
+
|
|
162
|
+
No release notes.
|
|
163
|
+
|
|
164
|
+
## [2.0.17] - 2017-12-21
|
|
165
|
+
|
|
166
|
+
### Fixed
|
|
167
|
+
|
|
168
|
+
- Fixed content-type detection bug
|
|
169
|
+
|
|
170
|
+
## [2.0.16] - 2017-10-24
|
|
171
|
+
|
|
172
|
+
### Fixed
|
|
173
|
+
|
|
174
|
+
- Fix scrolling issue to allow scrolling within popup modal
|
|
175
|
+
|
|
176
|
+
## [2.0.15] - 2017-10-12
|
|
177
|
+
|
|
178
|
+
### Added
|
|
179
|
+
|
|
180
|
+
- Support for scrolling popup in mobile
|
|
181
|
+
|
|
182
|
+
## [2.0.14] - 2017-10-11
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
|
|
186
|
+
- Fix registration form message in popup
|
|
187
|
+
|
|
188
|
+
## [2.0.13] - 2017-08-03
|
|
189
|
+
|
|
190
|
+
No release notes.
|
|
191
|
+
|
|
192
|
+
## [2.0.12] - 2017-07-18
|
|
193
|
+
|
|
194
|
+
No release notes.
|
|
195
|
+
|
|
196
|
+
## [2.0.11] - 2017-07-18
|
|
197
|
+
|
|
198
|
+
No release notes.
|
|
199
|
+
|
|
200
|
+
## [2.0.10] - 2017-06-30
|
|
201
|
+
|
|
202
|
+
No release notes.
|
|
203
|
+
|
|
204
|
+
## [2.0.9] - 2017-06-08
|
|
205
|
+
|
|
206
|
+
No release notes.
|
|
207
|
+
|
|
208
|
+
## [2.0.8] - 2017-06-08
|
|
209
|
+
|
|
210
|
+
No release notes.
|
|
211
|
+
|
|
212
|
+
## [2.0.7] - 2017-04-24
|
|
213
|
+
|
|
214
|
+
No release notes.
|
|
215
|
+
|
|
216
|
+
## [2.0.6] - 2017-02-14
|
|
217
|
+
|
|
218
|
+
### Fixed
|
|
219
|
+
|
|
220
|
+
- Fix share tracking
|
|
221
|
+
- Ignore CONVERSION_WIDGET widget rules when there's no referrals
|
|
222
|
+
|
|
223
|
+
### Changed
|
|
224
|
+
|
|
225
|
+
- Auto-fill content type check changed to non-case sensitive
|
|
226
|
+
|
|
227
|
+
## [2.0.5] - 2016-12-07
|
|
228
|
+
|
|
229
|
+
No release notes.
|
|
230
|
+
|
|
231
|
+
## [2.0.4] - 2016-12-06
|
|
232
|
+
|
|
233
|
+
No release notes.
|
|
234
|
+
|
|
235
|
+
## [2.0.3] - 2016-11-30
|
|
236
|
+
|
|
237
|
+
No release notes.
|
|
238
|
+
|
|
239
|
+
## [2.0.2] - 2016-11-29
|
|
240
|
+
|
|
241
|
+
No release notes.
|
|
242
|
+
|
|
243
|
+
## [2.0.1] - 2016-11-25
|
|
244
|
+
|
|
245
|
+
No release notes.
|
|
246
|
+
|
|
247
|
+
## [2.0.0] - 2016-11-25
|
|
248
|
+
|
|
249
|
+
No release notes.
|
|
250
|
+
|
|
251
|
+
[unreleased]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.2...HEAD
|
|
252
|
+
[2.4.2]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.1...@saasquatch%2Fsquatch-js@2.4.2
|
|
253
|
+
[2.4.1]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.4.0...@saasquatch%2Fsquatch-js@2.4.1
|
|
254
|
+
[2.4.0]: https://github.com/saasquatch/squatch-js/compare/v2.3.1...@saasquatch%2Fsquatch-js@2.4.0
|
|
255
|
+
[2.3.1]: https://github.com/saasquatch/squatch-js/compare/v2.3.0...v2.3.1
|
|
256
|
+
[2.3.0]: https://github.com/saasquatch/squatch-js/compare/v2.2.1...v2.3.0
|
|
257
|
+
[2.2.1]: https://github.com/saasquatch/squatch-js/compare/v2.2.0...v2.2.1
|
|
258
|
+
[2.2.0]: https://github.com/saasquatch/squatch-js/compare/v2.1.8...v2.2.0
|
|
259
|
+
[2.1.8]: https://github.com/saasquatch/squatch-js/compare/v2.1.7...v2.1.8
|
|
260
|
+
[2.1.7]: https://github.com/saasquatch/squatch-js/compare/v2.1.6...v2.1.7
|
|
261
|
+
[2.1.6]: https://github.com/saasquatch/squatch-js/compare/v2.1.5...v2.1.6
|
|
262
|
+
[2.1.5]: https://github.com/saasquatch/squatch-js/compare/v2.1.4...v2.1.5
|
|
263
|
+
[2.1.4]: https://github.com/saasquatch/squatch-js/compare/v2.1.3...v2.1.4
|
|
264
|
+
[2.1.3]: https://github.com/saasquatch/squatch-js/compare/v2.1.2...v2.1.3
|
|
265
|
+
[2.1.2]: https://github.com/saasquatch/squatch-js/compare/v2.1.1...v2.1.2
|
|
266
|
+
[2.1.1]: https://github.com/saasquatch/squatch-js/compare/v2.1.0...v2.1.1
|
|
267
|
+
[2.1.0]: https://github.com/saasquatch/squatch-js/compare/v2.0.17...v2.1.0
|
|
268
|
+
[2.0.17]: https://github.com/saasquatch/squatch-js/compare/v2.0.16...v2.0.17
|
|
269
|
+
[2.0.16]: https://github.com/saasquatch/squatch-js/compare/v2.0.15...v2.0.16
|
|
270
|
+
[2.0.15]: https://github.com/saasquatch/squatch-js/compare/v2.0.14...v2.0.15
|
|
271
|
+
[2.0.14]: https://github.com/saasquatch/squatch-js/compare/v2.0.13...v2.0.14
|
|
272
|
+
[2.0.13]: https://github.com/saasquatch/squatch-js/compare/v2.0.12...v2.0.13
|
|
273
|
+
[2.0.12]: https://github.com/saasquatch/squatch-js/compare/v2.0.11...v2.0.12
|
|
274
|
+
[2.0.11]: https://github.com/saasquatch/squatch-js/compare/v2.0.10...v2.0.11
|
|
275
|
+
[2.0.10]: https://github.com/saasquatch/squatch-js/compare/v2.0.9...v2.0.10
|
|
276
|
+
[2.0.9]: https://github.com/saasquatch/squatch-js/compare/v2.0.8...v2.0.9
|
|
277
|
+
[2.0.8]: https://github.com/saasquatch/squatch-js/compare/v2.0.7...v2.0.8
|
|
278
|
+
[2.0.7]: https://github.com/saasquatch/squatch-js/compare/v2.0.6...v2.0.7
|
|
279
|
+
[2.0.6]: https://github.com/saasquatch/squatch-js/compare/v2.0.5...v2.0.6
|
|
280
|
+
[2.0.5]: https://github.com/saasquatch/squatch-js/compare/v2.0.4...v2.0.5
|
|
281
|
+
[2.0.4]: https://github.com/saasquatch/squatch-js/compare/v2.0.3...v2.0.4
|
|
282
|
+
[2.0.3]: https://github.com/saasquatch/squatch-js/compare/v2.0.2...v2.0.3
|
|
283
|
+
[2.0.2]: https://github.com/saasquatch/squatch-js/compare/v2.0.1...v2.0.2
|
|
284
|
+
[2.0.1]: https://github.com/saasquatch/squatch-js/compare/v2.0.0...v2.0.1
|
|
285
|
+
[2.0.0]: https://github.com/saasquatch/squatch-js/releases/tag/v2.0.0
|
package/README.md
CHANGED
|
@@ -45,6 +45,7 @@ Note: `engagementMedium` is required in the `squatch.widgets()` functions if you
|
|
|
45
45
|
widgetType: 'p/PROGRAM-ID/w/referrerWidget', // Update PROGRAM-ID
|
|
46
46
|
jwt: 'TOKEN' // String (required by default, or disable Security in the portal)
|
|
47
47
|
|
|
48
|
+
});
|
|
48
49
|
});
|
|
49
50
|
</script>
|
|
50
51
|
```
|
package/dist/api/WidgetApi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfigOptions, CookieUser, WidgetConfig } from "../types";
|
|
1
|
+
import { ConfigOptions, CookieUser, WidgetConfig, ReferralCookieOptions } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
*
|
|
4
4
|
* The WidgetApi class is a wrapper around the Widget Endpoints of the SaaSquatch REST API.
|
|
@@ -87,7 +87,9 @@ export default class WidgetApi {
|
|
|
87
87
|
/**
|
|
88
88
|
* Looks up the referral code of the current user, if there is any.
|
|
89
89
|
*
|
|
90
|
+
* @param {Object} options Parameters for request
|
|
91
|
+
* @param {boolean} options.returnEncodedCookie Return the encoded cookie as a string
|
|
90
92
|
* @return {Promise<Object>} code referral code if true.
|
|
91
93
|
*/
|
|
92
|
-
squatchReferralCookie(): Promise<
|
|
94
|
+
squatchReferralCookie(options?: ReferralCookieOptions): Promise<Object>;
|
|
93
95
|
}
|
package/dist/squatch.esm.js
CHANGED
|
@@ -320,15 +320,20 @@ class WidgetApi {
|
|
|
320
320
|
/**
|
|
321
321
|
* Looks up the referral code of the current user, if there is any.
|
|
322
322
|
*
|
|
323
|
+
* @param {Object} options Parameters for request
|
|
324
|
+
* @param {boolean} options.returnEncodedCookie Return the encoded cookie as a string
|
|
323
325
|
* @return {Promise<Object>} code referral code if true.
|
|
324
326
|
*/
|
|
325
327
|
|
|
326
328
|
|
|
327
|
-
squatchReferralCookie() {
|
|
329
|
+
squatchReferralCookie(options) {
|
|
328
330
|
const tenantAlias = encodeURIComponent(this.tenantAlias);
|
|
329
331
|
|
|
330
|
-
const _saasquatch = Cookies.get("_saasquatch");
|
|
332
|
+
const _saasquatch = Cookies.get("_saasquatch") || "";
|
|
331
333
|
|
|
334
|
+
if (options != null && options.returnEncodedCookie) return Promise.resolve({
|
|
335
|
+
_saasquatch
|
|
336
|
+
});
|
|
332
337
|
const cookie = _saasquatch ? `?cookies=${encodeURIComponent(_saasquatch)}` : ``;
|
|
333
338
|
const url = `${this.domain}/a/${tenantAlias}/widgets/squatchcookiejson${cookie}`;
|
|
334
339
|
return doGet(url);
|