@screeb/sdk-browser 0.1.2 → 0.1.4
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/README.md +54 -5
- package/dist/es/index.d.ts +24 -47
- package/dist/es/index.js +32 -53
- package/docs/README.md +25 -68
- package/package.json +37 -17
package/README.md
CHANGED
|
@@ -1,9 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://screeb.app" alt="Intercom">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/ScreebApp/sdk-js/master/packages/screeb-sdk-browser/readme/screeb-logo.svg?token=GHSAT0AAAAAAB2OOPMGT2QD5TL3IRJN3CKCZDEYHJA" alt="Logo" height="120px" style="margin-top: 20px;"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">@screeb/sdk-browser</h1>
|
|
7
|
+
<p align="center">
|
|
8
|
+
Screeb's browser sdk.
|
|
2
9
|
|
|
3
|
-
|
|
10
|
+
<b>Continuous Product Discovery, Without the Time Sink.</b>
|
|
4
11
|
|
|
5
|
-
|
|
12
|
+
<a href="https://screeb.app" alt="Intercom">Screeb</a> is the only Continuous Product Discovery platform that lets you analyse users' behaviour, ask in-app questions, recruit people for interviews and analyse data in a blink with AI.
|
|
13
|
+
</p>
|
|
6
14
|
|
|
7
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://github.com/ScreebApp/sdk-js/actions/workflows/node.js.yml" alt="ci">
|
|
17
|
+
<img alt="ci" src="https://github.com/ScreebApp/sdk-js/actions/workflows/node.js.yml/badge.svg">
|
|
18
|
+
</a>
|
|
19
|
+
<img alt="version" src="https://img.shields.io/npm/v/@screeb/sdk-browser.svg" />
|
|
20
|
+
<img alt="minzipped size" src="https://badgen.net/bundlephobia/minzip/@screeb/sdk-browser">
|
|
21
|
+
<img alt="downloads" src="https://badgen.net/npm/dw/@screeb/sdk-browser" />
|
|
22
|
+
</p>
|
|
8
23
|
|
|
9
|
-
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
This library is published in the NPM registry and can be installed using any compatible package manager.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @screeb/sdk-browser --save
|
|
31
|
+
|
|
32
|
+
# For Yarn, use the command below.
|
|
33
|
+
yarn add @screeb/sdk-browser
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
Basic usage:
|
|
39
|
+
```ts
|
|
40
|
+
import * as Screeb from "@screeb/sdk-browser";
|
|
41
|
+
|
|
42
|
+
Screeb.load();
|
|
43
|
+
Screeb.init('<your-website-id>');
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For a more advanced usage and a complete API documentation, see [documentation generated from source files](https://github.com/ScreebApp/sdk-js/tree/master/packages/screeb-sdk-browser/docs).
|
|
47
|
+
|
|
48
|
+
For further information, see [our developper documentation](https://github.com/ScreebApp/developers).
|
|
49
|
+
|
|
50
|
+
## Support
|
|
51
|
+
For any issues, please contact our support team at support@screeb.com.
|
|
52
|
+
|
|
53
|
+
## Contributing
|
|
54
|
+
All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
Released under [MIT License](https://github.com/ScreebApp/sdk-js/blob/master/LICENSE).
|
package/dist/es/index.d.ts
CHANGED
|
@@ -34,8 +34,8 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
|
|
|
34
34
|
* Initializes Screeb tag.
|
|
35
35
|
*
|
|
36
36
|
* @param websiteId Your website/channel id.
|
|
37
|
-
* @param
|
|
38
|
-
* @param
|
|
37
|
+
* @param userId The unique identifier of your user.
|
|
38
|
+
* @param userProperties The properties of your user.
|
|
39
39
|
* ```text Requirements:
|
|
40
40
|
* - Property names must be limited to 128 characters
|
|
41
41
|
* - No more than 1000 attributes
|
|
@@ -48,7 +48,7 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
|
|
|
48
48
|
*
|
|
49
49
|
* Screeb.init(
|
|
50
50
|
* "<your-website-id>",
|
|
51
|
-
* "<your-
|
|
51
|
+
* "<your-user-id>",
|
|
52
52
|
* {
|
|
53
53
|
* firstname: '<user-firstname>',
|
|
54
54
|
* lastname: '<user-lastname>',
|
|
@@ -59,7 +59,7 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
|
|
|
59
59
|
* );
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
|
-
export declare const init: (websiteId: string,
|
|
62
|
+
export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord) => void | Promise<unknown>;
|
|
63
63
|
/**
|
|
64
64
|
* Checks if Screeb tag has been loaded.
|
|
65
65
|
*
|
|
@@ -113,7 +113,7 @@ export declare const close: () => void | Promise<unknown>;
|
|
|
113
113
|
*/
|
|
114
114
|
export declare const debug: () => void | Promise<unknown>;
|
|
115
115
|
/**
|
|
116
|
-
* Tracks a
|
|
116
|
+
* Tracks a user event.
|
|
117
117
|
*
|
|
118
118
|
* @param eventName The event name.
|
|
119
119
|
* @param eventProperties The properties of your event.
|
|
@@ -127,8 +127,7 @@ export declare const debug: () => void | Promise<unknown>;
|
|
|
127
127
|
* ```ts
|
|
128
128
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
129
129
|
*
|
|
130
|
-
* Screeb.
|
|
131
|
-
* "event.track",
|
|
130
|
+
* Screeb.eventTrack(
|
|
132
131
|
* "Product added to cart",
|
|
133
132
|
* {
|
|
134
133
|
* product_name: 'Red bike 2021',
|
|
@@ -146,11 +145,11 @@ export declare const debug: () => void | Promise<unknown>;
|
|
|
146
145
|
*/
|
|
147
146
|
export declare const eventTrack: (eventName: string, eventProperties?: PropertyRecord) => void | Promise<unknown>;
|
|
148
147
|
/**
|
|
149
|
-
* Change the current
|
|
148
|
+
* Change the current user identity.
|
|
150
149
|
* Warning: Running surveys will be closed.
|
|
151
150
|
*
|
|
152
|
-
* @param
|
|
153
|
-
* @param
|
|
151
|
+
* @param userId The unique identifier of your user.
|
|
152
|
+
* @param userProperties The properties of your user.
|
|
154
153
|
* ```text Requirements:
|
|
155
154
|
* - Property names must be limited to 128 characters
|
|
156
155
|
* - No more than 1000 attributes
|
|
@@ -162,7 +161,7 @@ export declare const eventTrack: (eventName: string, eventProperties?: PropertyR
|
|
|
162
161
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
163
162
|
*
|
|
164
163
|
* Screeb.identity(
|
|
165
|
-
* "<your-
|
|
164
|
+
* "<your-user-id>",
|
|
166
165
|
* {
|
|
167
166
|
* firstname: '<user-firstname>',
|
|
168
167
|
* lastname: '<user-lastname>',
|
|
@@ -173,7 +172,7 @@ export declare const eventTrack: (eventName: string, eventProperties?: PropertyR
|
|
|
173
172
|
* );
|
|
174
173
|
* ```
|
|
175
174
|
*/
|
|
176
|
-
export declare const identity: (
|
|
175
|
+
export declare const identity: (userId: string, userProperties?: PropertyRecord) => void | Promise<unknown>;
|
|
177
176
|
type ScreebIdentityGetReturn = {
|
|
178
177
|
anonymous_id: string;
|
|
179
178
|
user_id: string;
|
|
@@ -184,7 +183,7 @@ type ScreebIdentityGetReturn = {
|
|
|
184
183
|
is_ready: boolean;
|
|
185
184
|
};
|
|
186
185
|
/**
|
|
187
|
-
* Retrieves the current
|
|
186
|
+
* Retrieves the current user identity.
|
|
188
187
|
*
|
|
189
188
|
* @example
|
|
190
189
|
* ```ts
|
|
@@ -204,11 +203,11 @@ type ScreebIdentityGetReturn = {
|
|
|
204
203
|
*/
|
|
205
204
|
export declare const identityGet: () => Promise<ScreebIdentityGetReturn>;
|
|
206
205
|
/**
|
|
207
|
-
* Assigns the current
|
|
206
|
+
* Assigns the current user to a group.
|
|
208
207
|
*
|
|
209
208
|
* @param groupName
|
|
210
209
|
* @param groupType
|
|
211
|
-
* @param groupProperties The properties of your
|
|
210
|
+
* @param groupProperties The properties of your user group.
|
|
212
211
|
* ```text Requirements:
|
|
213
212
|
* - Property names must be limited to 128 characters
|
|
214
213
|
* - No more than 1000 attributes
|
|
@@ -235,10 +234,10 @@ export declare const identityGet: () => Promise<ScreebIdentityGetReturn>;
|
|
|
235
234
|
*/
|
|
236
235
|
export declare const identityGroupAssign: (groupName: string, groupType?: string, groupProperties?: PropertyRecord) => void | Promise<unknown>;
|
|
237
236
|
/**
|
|
238
|
-
* Unassigns the current
|
|
237
|
+
* Unassigns the current user to a group.
|
|
239
238
|
*
|
|
240
|
-
* @param groupName The name of your
|
|
241
|
-
* @param groupType The type of your
|
|
239
|
+
* @param groupName The name of your user group.
|
|
240
|
+
* @param groupType The type of your user group.
|
|
242
241
|
*
|
|
243
242
|
* @example
|
|
244
243
|
* ```ts
|
|
@@ -249,9 +248,9 @@ export declare const identityGroupAssign: (groupName: string, groupType?: string
|
|
|
249
248
|
*/
|
|
250
249
|
export declare const identityGroupUnassign: (groupName: string, groupType?: string) => void | Promise<unknown>;
|
|
251
250
|
/**
|
|
252
|
-
* Adds properties to the current
|
|
251
|
+
* Adds properties to the current user identity.
|
|
253
252
|
*
|
|
254
|
-
* @param
|
|
253
|
+
* @param userProperties The properties of your user.
|
|
255
254
|
* ```text Requirements:
|
|
256
255
|
* - Property names must be limited to 128 characters
|
|
257
256
|
* - No more than 1000 attributes
|
|
@@ -262,7 +261,7 @@ export declare const identityGroupUnassign: (groupName: string, groupType?: stri
|
|
|
262
261
|
* ```ts
|
|
263
262
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
264
263
|
*
|
|
265
|
-
* // Set
|
|
264
|
+
* // Set user properties
|
|
266
265
|
* Screeb.identityProperties(
|
|
267
266
|
* {
|
|
268
267
|
* firstname: '<user-firstname>',
|
|
@@ -273,7 +272,7 @@ export declare const identityGroupUnassign: (groupName: string, groupType?: stri
|
|
|
273
272
|
* }
|
|
274
273
|
* );
|
|
275
274
|
*
|
|
276
|
-
* // Delete
|
|
275
|
+
* // Delete user property : set values to null
|
|
277
276
|
* Screeb.identityProperties(
|
|
278
277
|
* {
|
|
279
278
|
* age: null,
|
|
@@ -283,9 +282,9 @@ export declare const identityGroupUnassign: (groupName: string, groupType?: stri
|
|
|
283
282
|
* );
|
|
284
283
|
* ```
|
|
285
284
|
*/
|
|
286
|
-
export declare const identityProperties: (
|
|
285
|
+
export declare const identityProperties: (userProperties: PropertyRecord) => void | Promise<unknown>;
|
|
287
286
|
/**
|
|
288
|
-
* Resets the current
|
|
287
|
+
* Resets the current user identity.
|
|
289
288
|
* Warning: This command must be called only once, since it creates a new identity on Screeb side.
|
|
290
289
|
*
|
|
291
290
|
* @example
|
|
@@ -343,7 +342,7 @@ export declare const targetingCheck: () => void | Promise<unknown>;
|
|
|
343
342
|
* ```ts
|
|
344
343
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
345
344
|
*
|
|
346
|
-
* Screeb.targetingDebug();
|
|
345
|
+
* console.log(await Screeb.targetingDebug());
|
|
347
346
|
* // targeting ************ SCREEB TARGETING RULES DEBUG **************
|
|
348
347
|
* // Disabled surveys are not listed here.
|
|
349
348
|
* //
|
|
@@ -361,26 +360,4 @@ export declare const targetingCheck: () => void | Promise<unknown>;
|
|
|
361
360
|
* ```
|
|
362
361
|
*/
|
|
363
362
|
export declare const targetingDebug: () => void | Promise<unknown>;
|
|
364
|
-
/**
|
|
365
|
-
* Starts the targeting engine.
|
|
366
|
-
*
|
|
367
|
-
* @example
|
|
368
|
-
* ```ts
|
|
369
|
-
* import * as Screeb from "@screeb/sdk-browser";
|
|
370
|
-
*
|
|
371
|
-
* Screeb.targetingStart();
|
|
372
|
-
* ```
|
|
373
|
-
*/
|
|
374
|
-
export declare const targetingStart: () => void | Promise<unknown>;
|
|
375
|
-
/**
|
|
376
|
-
* Stops the targeting engine.
|
|
377
|
-
*
|
|
378
|
-
* @example
|
|
379
|
-
* ```ts
|
|
380
|
-
* import * as Screeb from "@screeb/sdk-browser";
|
|
381
|
-
*
|
|
382
|
-
* Screeb.targetingStop();
|
|
383
|
-
* ```
|
|
384
|
-
*/
|
|
385
|
-
export declare const targetingStop: () => void | Promise<unknown>;
|
|
386
363
|
export {};
|
package/dist/es/index.js
CHANGED
|
@@ -42,8 +42,8 @@ var load = function (options) {
|
|
|
42
42
|
* Initializes Screeb tag.
|
|
43
43
|
*
|
|
44
44
|
* @param websiteId Your website/channel id.
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
45
|
+
* @param userId The unique identifier of your user.
|
|
46
|
+
* @param userProperties The properties of your user.
|
|
47
47
|
* ```text Requirements:
|
|
48
48
|
* - Property names must be limited to 128 characters
|
|
49
49
|
* - No more than 1000 attributes
|
|
@@ -56,7 +56,7 @@ var load = function (options) {
|
|
|
56
56
|
*
|
|
57
57
|
* Screeb.init(
|
|
58
58
|
* "<your-website-id>",
|
|
59
|
-
* "<your-
|
|
59
|
+
* "<your-user-id>",
|
|
60
60
|
* {
|
|
61
61
|
* firstname: '<user-firstname>',
|
|
62
62
|
* lastname: '<user-lastname>',
|
|
@@ -67,13 +67,13 @@ var load = function (options) {
|
|
|
67
67
|
* );
|
|
68
68
|
* ```
|
|
69
69
|
*/
|
|
70
|
-
var init = function (websiteId,
|
|
70
|
+
var init = function (websiteId, userId, userProperties) {
|
|
71
71
|
var identityObject;
|
|
72
|
-
if (
|
|
72
|
+
if (userId || userProperties) {
|
|
73
73
|
identityObject = {
|
|
74
74
|
identity: {
|
|
75
|
-
id:
|
|
76
|
-
properties:
|
|
75
|
+
id: userId,
|
|
76
|
+
properties: userProperties,
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
}
|
|
@@ -132,7 +132,7 @@ var close = function () { return $screeb("close"); };
|
|
|
132
132
|
*/
|
|
133
133
|
var debug = function () { return $screeb("debug"); };
|
|
134
134
|
/**
|
|
135
|
-
* Tracks a
|
|
135
|
+
* Tracks a user event.
|
|
136
136
|
*
|
|
137
137
|
* @param eventName The event name.
|
|
138
138
|
* @param eventProperties The properties of your event.
|
|
@@ -146,8 +146,7 @@ var debug = function () { return $screeb("debug"); };
|
|
|
146
146
|
* ```ts
|
|
147
147
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
148
148
|
*
|
|
149
|
-
* Screeb.
|
|
150
|
-
* "event.track",
|
|
149
|
+
* Screeb.eventTrack(
|
|
151
150
|
* "Product added to cart",
|
|
152
151
|
* {
|
|
153
152
|
* product_name: 'Red bike 2021',
|
|
@@ -165,11 +164,11 @@ var debug = function () { return $screeb("debug"); };
|
|
|
165
164
|
*/
|
|
166
165
|
var eventTrack = function (eventName, eventProperties) { return $screeb("event.track", eventName, eventProperties); };
|
|
167
166
|
/**
|
|
168
|
-
* Change the current
|
|
167
|
+
* Change the current user identity.
|
|
169
168
|
* Warning: Running surveys will be closed.
|
|
170
169
|
*
|
|
171
|
-
* @param
|
|
172
|
-
* @param
|
|
170
|
+
* @param userId The unique identifier of your user.
|
|
171
|
+
* @param userProperties The properties of your user.
|
|
173
172
|
* ```text Requirements:
|
|
174
173
|
* - Property names must be limited to 128 characters
|
|
175
174
|
* - No more than 1000 attributes
|
|
@@ -181,7 +180,7 @@ var eventTrack = function (eventName, eventProperties) { return $screeb("event.t
|
|
|
181
180
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
182
181
|
*
|
|
183
182
|
* Screeb.identity(
|
|
184
|
-
* "<your-
|
|
183
|
+
* "<your-user-id>",
|
|
185
184
|
* {
|
|
186
185
|
* firstname: '<user-firstname>',
|
|
187
186
|
* lastname: '<user-lastname>',
|
|
@@ -192,9 +191,11 @@ var eventTrack = function (eventName, eventProperties) { return $screeb("event.t
|
|
|
192
191
|
* );
|
|
193
192
|
* ```
|
|
194
193
|
*/
|
|
195
|
-
var identity = function (
|
|
194
|
+
var identity = function (userId, userProperties) {
|
|
195
|
+
return $screeb("identity", userId, userProperties);
|
|
196
|
+
};
|
|
196
197
|
/**
|
|
197
|
-
* Retrieves the current
|
|
198
|
+
* Retrieves the current user identity.
|
|
198
199
|
*
|
|
199
200
|
* @example
|
|
200
201
|
* ```ts
|
|
@@ -216,11 +217,11 @@ var identityGet = function () {
|
|
|
216
217
|
return $screeb("identity.get");
|
|
217
218
|
};
|
|
218
219
|
/**
|
|
219
|
-
* Assigns the current
|
|
220
|
+
* Assigns the current user to a group.
|
|
220
221
|
*
|
|
221
222
|
* @param groupName
|
|
222
223
|
* @param groupType
|
|
223
|
-
* @param groupProperties The properties of your
|
|
224
|
+
* @param groupProperties The properties of your user group.
|
|
224
225
|
* ```text Requirements:
|
|
225
226
|
* - Property names must be limited to 128 characters
|
|
226
227
|
* - No more than 1000 attributes
|
|
@@ -247,10 +248,10 @@ var identityGet = function () {
|
|
|
247
248
|
*/
|
|
248
249
|
var identityGroupAssign = function (groupName, groupType, groupProperties) { return $screeb("identity.group.assign", groupType, groupName, groupProperties); };
|
|
249
250
|
/**
|
|
250
|
-
* Unassigns the current
|
|
251
|
+
* Unassigns the current user to a group.
|
|
251
252
|
*
|
|
252
|
-
* @param groupName The name of your
|
|
253
|
-
* @param groupType The type of your
|
|
253
|
+
* @param groupName The name of your user group.
|
|
254
|
+
* @param groupType The type of your user group.
|
|
254
255
|
*
|
|
255
256
|
* @example
|
|
256
257
|
* ```ts
|
|
@@ -263,9 +264,9 @@ var identityGroupUnassign = function (groupName, groupType) {
|
|
|
263
264
|
return $screeb("identity.group.unassign", groupType, groupName);
|
|
264
265
|
};
|
|
265
266
|
/**
|
|
266
|
-
* Adds properties to the current
|
|
267
|
+
* Adds properties to the current user identity.
|
|
267
268
|
*
|
|
268
|
-
* @param
|
|
269
|
+
* @param userProperties The properties of your user.
|
|
269
270
|
* ```text Requirements:
|
|
270
271
|
* - Property names must be limited to 128 characters
|
|
271
272
|
* - No more than 1000 attributes
|
|
@@ -276,7 +277,7 @@ var identityGroupUnassign = function (groupName, groupType) {
|
|
|
276
277
|
* ```ts
|
|
277
278
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
278
279
|
*
|
|
279
|
-
* // Set
|
|
280
|
+
* // Set user properties
|
|
280
281
|
* Screeb.identityProperties(
|
|
281
282
|
* {
|
|
282
283
|
* firstname: '<user-firstname>',
|
|
@@ -287,7 +288,7 @@ var identityGroupUnassign = function (groupName, groupType) {
|
|
|
287
288
|
* }
|
|
288
289
|
* );
|
|
289
290
|
*
|
|
290
|
-
* // Delete
|
|
291
|
+
* // Delete user property : set values to null
|
|
291
292
|
* Screeb.identityProperties(
|
|
292
293
|
* {
|
|
293
294
|
* age: null,
|
|
@@ -297,11 +298,11 @@ var identityGroupUnassign = function (groupName, groupType) {
|
|
|
297
298
|
* );
|
|
298
299
|
* ```
|
|
299
300
|
*/
|
|
300
|
-
var identityProperties = function (
|
|
301
|
-
return $screeb("identity.properties",
|
|
301
|
+
var identityProperties = function (userProperties) {
|
|
302
|
+
return $screeb("identity.properties", userProperties);
|
|
302
303
|
};
|
|
303
304
|
/**
|
|
304
|
-
* Resets the current
|
|
305
|
+
* Resets the current user identity.
|
|
305
306
|
* Warning: This command must be called only once, since it creates a new identity on Screeb side.
|
|
306
307
|
*
|
|
307
308
|
* @example
|
|
@@ -341,7 +342,7 @@ var surveyClose = function () { return $screeb("survey.close"); };
|
|
|
341
342
|
* ```
|
|
342
343
|
*/
|
|
343
344
|
var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields) {
|
|
344
|
-
if (allowMultipleResponses === void 0) { allowMultipleResponses =
|
|
345
|
+
if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
|
|
345
346
|
if (hiddenFields === void 0) { hiddenFields = {}; }
|
|
346
347
|
return $screeb("survey.start", surveyId, {
|
|
347
348
|
allow_multiple_responses: allowMultipleResponses,
|
|
@@ -366,7 +367,7 @@ var targetingCheck = function () { return $screeb("targeting.check"); };
|
|
|
366
367
|
* ```ts
|
|
367
368
|
* import * as Screeb from "@screeb/sdk-browser";
|
|
368
369
|
*
|
|
369
|
-
* Screeb.targetingDebug();
|
|
370
|
+
* console.log(await Screeb.targetingDebug());
|
|
370
371
|
* // targeting ************ SCREEB TARGETING RULES DEBUG **************
|
|
371
372
|
* // Disabled surveys are not listed here.
|
|
372
373
|
* //
|
|
@@ -384,27 +385,5 @@ var targetingCheck = function () { return $screeb("targeting.check"); };
|
|
|
384
385
|
* ```
|
|
385
386
|
*/
|
|
386
387
|
var targetingDebug = function () { return $screeb("targeting.debug"); };
|
|
387
|
-
/**
|
|
388
|
-
* Starts the targeting engine.
|
|
389
|
-
*
|
|
390
|
-
* @example
|
|
391
|
-
* ```ts
|
|
392
|
-
* import * as Screeb from "@screeb/sdk-browser";
|
|
393
|
-
*
|
|
394
|
-
* Screeb.targetingStart();
|
|
395
|
-
* ```
|
|
396
|
-
*/
|
|
397
|
-
var targetingStart = function () { return $screeb("targeting.start"); };
|
|
398
|
-
/**
|
|
399
|
-
* Stops the targeting engine.
|
|
400
|
-
*
|
|
401
|
-
* @example
|
|
402
|
-
* ```ts
|
|
403
|
-
* import * as Screeb from "@screeb/sdk-browser";
|
|
404
|
-
*
|
|
405
|
-
* Screeb.targetingStop();
|
|
406
|
-
* ```
|
|
407
|
-
*/
|
|
408
|
-
var targetingStop = function () { return $screeb("targeting.stop"); };
|
|
409
388
|
|
|
410
|
-
export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug
|
|
389
|
+
export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug };
|
package/docs/README.md
CHANGED
|
@@ -29,8 +29,6 @@
|
|
|
29
29
|
- [surveyStart](README.md#surveystart)
|
|
30
30
|
- [targetingCheck](README.md#targetingcheck)
|
|
31
31
|
- [targetingDebug](README.md#targetingdebug)
|
|
32
|
-
- [targetingStart](README.md#targetingstart)
|
|
33
|
-
- [targetingStop](README.md#targetingstop)
|
|
34
32
|
|
|
35
33
|
## Type Aliases
|
|
36
34
|
|
|
@@ -136,15 +134,14 @@ ___
|
|
|
136
134
|
|
|
137
135
|
▸ **eventTrack**(`eventName`, `eventProperties?`): `void` \| `Promise`<`unknown`\>
|
|
138
136
|
|
|
139
|
-
Tracks a
|
|
137
|
+
Tracks a user event.
|
|
140
138
|
|
|
141
139
|
**`Example`**
|
|
142
140
|
|
|
143
141
|
```ts
|
|
144
142
|
import * as Screeb from "@screeb/sdk-browser";
|
|
145
143
|
|
|
146
|
-
Screeb.
|
|
147
|
-
"event.track",
|
|
144
|
+
Screeb.eventTrack(
|
|
148
145
|
"Product added to cart",
|
|
149
146
|
{
|
|
150
147
|
product_name: 'Red bike 2021',
|
|
@@ -175,9 +172,9 @@ ___
|
|
|
175
172
|
|
|
176
173
|
### identity
|
|
177
174
|
|
|
178
|
-
▸ **identity**(`
|
|
175
|
+
▸ **identity**(`userId`, `userProperties?`): `void` \| `Promise`<`unknown`\>
|
|
179
176
|
|
|
180
|
-
Change the current
|
|
177
|
+
Change the current user identity.
|
|
181
178
|
Warning: Running surveys will be closed.
|
|
182
179
|
|
|
183
180
|
**`Example`**
|
|
@@ -186,7 +183,7 @@ Warning: Running surveys will be closed.
|
|
|
186
183
|
import * as Screeb from "@screeb/sdk-browser";
|
|
187
184
|
|
|
188
185
|
Screeb.identity(
|
|
189
|
-
"<your-
|
|
186
|
+
"<your-user-id>",
|
|
190
187
|
{
|
|
191
188
|
firstname: '<user-firstname>',
|
|
192
189
|
lastname: '<user-lastname>',
|
|
@@ -201,8 +198,8 @@ Screeb.identity(
|
|
|
201
198
|
|
|
202
199
|
| Name | Type | Description |
|
|
203
200
|
| :------ | :------ | :------ |
|
|
204
|
-
| `
|
|
205
|
-
| `
|
|
201
|
+
| `userId` | `string` | The unique identifier of your user. |
|
|
202
|
+
| `userProperties?` | [`PropertyRecord`](README.md#propertyrecord) | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
206
203
|
|
|
207
204
|
#### Returns
|
|
208
205
|
|
|
@@ -214,7 +211,7 @@ ___
|
|
|
214
211
|
|
|
215
212
|
▸ **identityGet**(): `Promise`<`ScreebIdentityGetReturn`\>
|
|
216
213
|
|
|
217
|
-
Retrieves the current
|
|
214
|
+
Retrieves the current user identity.
|
|
218
215
|
|
|
219
216
|
**`Example`**
|
|
220
217
|
|
|
@@ -243,7 +240,7 @@ ___
|
|
|
243
240
|
|
|
244
241
|
▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `void` \| `Promise`<`unknown`\>
|
|
245
242
|
|
|
246
|
-
Assigns the current
|
|
243
|
+
Assigns the current user to a group.
|
|
247
244
|
|
|
248
245
|
**`Example`**
|
|
249
246
|
|
|
@@ -270,7 +267,7 @@ Screeb.identityGroupAssign(
|
|
|
270
267
|
| :------ | :------ | :------ |
|
|
271
268
|
| `groupName` | `string` | |
|
|
272
269
|
| `groupType?` | `string` | |
|
|
273
|
-
| `groupProperties?` | [`PropertyRecord`](README.md#propertyrecord) | The properties of your
|
|
270
|
+
| `groupProperties?` | [`PropertyRecord`](README.md#propertyrecord) | The properties of your user group. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
274
271
|
|
|
275
272
|
#### Returns
|
|
276
273
|
|
|
@@ -282,7 +279,7 @@ ___
|
|
|
282
279
|
|
|
283
280
|
▸ **identityGroupUnassign**(`groupName`, `groupType?`): `void` \| `Promise`<`unknown`\>
|
|
284
281
|
|
|
285
|
-
Unassigns the current
|
|
282
|
+
Unassigns the current user to a group.
|
|
286
283
|
|
|
287
284
|
**`Example`**
|
|
288
285
|
|
|
@@ -296,8 +293,8 @@ Screeb.identityGroupUnassign('company', 'Apple');
|
|
|
296
293
|
|
|
297
294
|
| Name | Type | Description |
|
|
298
295
|
| :------ | :------ | :------ |
|
|
299
|
-
| `groupName` | `string` | The name of your
|
|
300
|
-
| `groupType?` | `string` | The type of your
|
|
296
|
+
| `groupName` | `string` | The name of your user group. |
|
|
297
|
+
| `groupType?` | `string` | The type of your user group. |
|
|
301
298
|
|
|
302
299
|
#### Returns
|
|
303
300
|
|
|
@@ -307,16 +304,16 @@ ___
|
|
|
307
304
|
|
|
308
305
|
### identityProperties
|
|
309
306
|
|
|
310
|
-
▸ **identityProperties**(`
|
|
307
|
+
▸ **identityProperties**(`userProperties`): `void` \| `Promise`<`unknown`\>
|
|
311
308
|
|
|
312
|
-
Adds properties to the current
|
|
309
|
+
Adds properties to the current user identity.
|
|
313
310
|
|
|
314
311
|
**`Example`**
|
|
315
312
|
|
|
316
313
|
```ts
|
|
317
314
|
import * as Screeb from "@screeb/sdk-browser";
|
|
318
315
|
|
|
319
|
-
// Set
|
|
316
|
+
// Set user properties
|
|
320
317
|
Screeb.identityProperties(
|
|
321
318
|
{
|
|
322
319
|
firstname: '<user-firstname>',
|
|
@@ -327,7 +324,7 @@ Screeb.identityProperties(
|
|
|
327
324
|
}
|
|
328
325
|
);
|
|
329
326
|
|
|
330
|
-
// Delete
|
|
327
|
+
// Delete user property : set values to null
|
|
331
328
|
Screeb.identityProperties(
|
|
332
329
|
{
|
|
333
330
|
age: null,
|
|
@@ -341,7 +338,7 @@ Screeb.identityProperties(
|
|
|
341
338
|
|
|
342
339
|
| Name | Type | Description |
|
|
343
340
|
| :------ | :------ | :------ |
|
|
344
|
-
| `
|
|
341
|
+
| `userProperties` | [`PropertyRecord`](README.md#propertyrecord) | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
|
|
345
342
|
|
|
346
343
|
#### Returns
|
|
347
344
|
|
|
@@ -353,7 +350,7 @@ ___
|
|
|
353
350
|
|
|
354
351
|
▸ **identityReset**(): `void` \| `Promise`<`unknown`\>
|
|
355
352
|
|
|
356
|
-
Resets the current
|
|
353
|
+
Resets the current user identity.
|
|
357
354
|
Warning: This command must be called only once, since it creates a new identity on Screeb side.
|
|
358
355
|
|
|
359
356
|
**`Example`**
|
|
@@ -372,7 +369,7 @@ ___
|
|
|
372
369
|
|
|
373
370
|
### init
|
|
374
371
|
|
|
375
|
-
▸ **init**(`websiteId`, `
|
|
372
|
+
▸ **init**(`websiteId`, `userId?`, `userProperties?`): `void` \| `Promise`<`unknown`\>
|
|
376
373
|
|
|
377
374
|
Initializes Screeb tag.
|
|
378
375
|
|
|
@@ -383,7 +380,7 @@ import * as Screeb from "@screeb/sdk-browser";
|
|
|
383
380
|
|
|
384
381
|
Screeb.init(
|
|
385
382
|
"<your-website-id>",
|
|
386
|
-
"<your-
|
|
383
|
+
"<your-user-id>",
|
|
387
384
|
{
|
|
388
385
|
firstname: '<user-firstname>',
|
|
389
386
|
lastname: '<user-lastname>',
|
|
@@ -399,8 +396,8 @@ Screeb.init(
|
|
|
399
396
|
| Name | Type | Description |
|
|
400
397
|
| :------ | :------ | :------ |
|
|
401
398
|
| `websiteId` | `string` | Your website/channel id. |
|
|
402
|
-
| `
|
|
403
|
-
| `
|
|
399
|
+
| `userId?` | `string` | The unique identifier of your user. |
|
|
400
|
+
| `userProperties?` | [`PropertyRecord`](README.md#propertyrecord) | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date ``` |
|
|
404
401
|
|
|
405
402
|
#### Returns
|
|
406
403
|
|
|
@@ -502,7 +499,7 @@ Screeb.surveyStart(
|
|
|
502
499
|
| Name | Type | Default value |
|
|
503
500
|
| :------ | :------ | :------ |
|
|
504
501
|
| `surveyId` | `string` | `undefined` |
|
|
505
|
-
| `allowMultipleResponses` | `boolean` | `
|
|
502
|
+
| `allowMultipleResponses` | `boolean` | `true` |
|
|
506
503
|
| `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) | `{}` |
|
|
507
504
|
|
|
508
505
|
#### Returns
|
|
@@ -542,7 +539,7 @@ Prints the current state of the targeting engine.
|
|
|
542
539
|
```ts
|
|
543
540
|
import * as Screeb from "@screeb/sdk-browser";
|
|
544
541
|
|
|
545
|
-
Screeb.targetingDebug();
|
|
542
|
+
console.log(await Screeb.targetingDebug());
|
|
546
543
|
// targeting ************ SCREEB TARGETING RULES DEBUG **************
|
|
547
544
|
// Disabled surveys are not listed here.
|
|
548
545
|
//
|
|
@@ -562,43 +559,3 @@ Screeb.targetingDebug();
|
|
|
562
559
|
#### Returns
|
|
563
560
|
|
|
564
561
|
`void` \| `Promise`<`unknown`\>
|
|
565
|
-
|
|
566
|
-
___
|
|
567
|
-
|
|
568
|
-
### targetingStart
|
|
569
|
-
|
|
570
|
-
▸ **targetingStart**(): `void` \| `Promise`<`unknown`\>
|
|
571
|
-
|
|
572
|
-
Starts the targeting engine.
|
|
573
|
-
|
|
574
|
-
**`Example`**
|
|
575
|
-
|
|
576
|
-
```ts
|
|
577
|
-
import * as Screeb from "@screeb/sdk-browser";
|
|
578
|
-
|
|
579
|
-
Screeb.targetingStart();
|
|
580
|
-
```
|
|
581
|
-
|
|
582
|
-
#### Returns
|
|
583
|
-
|
|
584
|
-
`void` \| `Promise`<`unknown`\>
|
|
585
|
-
|
|
586
|
-
___
|
|
587
|
-
|
|
588
|
-
### targetingStop
|
|
589
|
-
|
|
590
|
-
▸ **targetingStop**(): `void` \| `Promise`<`unknown`\>
|
|
591
|
-
|
|
592
|
-
Stops the targeting engine.
|
|
593
|
-
|
|
594
|
-
**`Example`**
|
|
595
|
-
|
|
596
|
-
```ts
|
|
597
|
-
import * as Screeb from "@screeb/sdk-browser";
|
|
598
|
-
|
|
599
|
-
Screeb.targetingStop();
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
#### Returns
|
|
603
|
-
|
|
604
|
-
`void` \| `Promise`<`unknown`\>
|
package/package.json
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-browser",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"author": "Screeb's frontend team",
|
|
3
|
+
"version": "0.1.4",
|
|
5
4
|
"description": "Screeb's browser sdk.",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"product discovery",
|
|
7
|
+
"product management",
|
|
8
|
+
"survey",
|
|
9
|
+
"analytics",
|
|
10
|
+
"user feedback",
|
|
11
|
+
"user voice",
|
|
12
|
+
"user research"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://screeb.app",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/ScreebApp/sdk-js/issues",
|
|
17
|
+
"email": "suuport@screeb.app"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/ScreebApp/sdk-js.git",
|
|
22
|
+
"directory": "packages/screeb-sdk-browser"
|
|
13
23
|
},
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"author": "Screeb's frontend team",
|
|
14
26
|
"sideEffects": false,
|
|
15
27
|
"type": "module",
|
|
28
|
+
"exports": {
|
|
29
|
+
"./package.json": "./package.json",
|
|
30
|
+
".": {
|
|
31
|
+
"import": "./dist/es/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
16
34
|
"module": "dist/es/index.js",
|
|
17
35
|
"types": "dist/es/index.d.ts",
|
|
18
36
|
"files": [
|
|
@@ -20,15 +38,14 @@
|
|
|
20
38
|
"docs",
|
|
21
39
|
"README.md"
|
|
22
40
|
],
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "rollup -c ./node_modules/@screeb/typescript-config/src/rollup.config.js",
|
|
43
|
+
"build:doc": "typedoc src/index.ts",
|
|
44
|
+
"clean": "rm -Rf dist",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"test": "jest"
|
|
28
47
|
},
|
|
29
|
-
"
|
|
30
|
-
"@screeb/eslint-config": "^0.1.1",
|
|
31
|
-
"@screeb/typescript-config": "^0.1.1",
|
|
48
|
+
"devDependencies": {
|
|
32
49
|
"@types/jest": "^29.5.1",
|
|
33
50
|
"@types/node": "^18.16.3",
|
|
34
51
|
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
|
@@ -44,5 +61,8 @@
|
|
|
44
61
|
"ts-jest": "^29.1.0",
|
|
45
62
|
"typedoc": "^0.24.6",
|
|
46
63
|
"typedoc-plugin-markdown": "^3.15.3"
|
|
64
|
+
},
|
|
65
|
+
"publishConfig": {
|
|
66
|
+
"access": "public"
|
|
47
67
|
}
|
|
48
68
|
}
|