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