@screeb/sdk-angular 0.1.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.
@@ -0,0 +1,505 @@
1
+ [@screeb/sdk-angular](../README.md) / Screeb
2
+
3
+ # Class: Screeb
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](Screeb.md#constructor)
10
+
11
+ ### Properties
12
+
13
+ - [config](Screeb.md#config)
14
+ - [isInitialized](Screeb.md#isinitialized)
15
+
16
+ ### Methods
17
+
18
+ - [close](Screeb.md#close)
19
+ - [debug](Screeb.md#debug)
20
+ - [ensureScreeb](Screeb.md#ensurescreeb)
21
+ - [eventTrack](Screeb.md#eventtrack)
22
+ - [identity](Screeb.md#identity)
23
+ - [identityGet](Screeb.md#identityget)
24
+ - [identityGroupAssign](Screeb.md#identitygroupassign)
25
+ - [identityGroupUnassign](Screeb.md#identitygroupunassign)
26
+ - [identityProperties](Screeb.md#identityproperties)
27
+ - [identityReset](Screeb.md#identityreset)
28
+ - [init](Screeb.md#init)
29
+ - [load](Screeb.md#load)
30
+ - [surveyClose](Screeb.md#surveyclose)
31
+ - [surveyStart](Screeb.md#surveystart)
32
+ - [targetingCheck](Screeb.md#targetingcheck)
33
+ - [targetingDebug](Screeb.md#targetingdebug)
34
+
35
+ ## Constructors
36
+
37
+ ### constructor
38
+
39
+ • **new Screeb**(`config`)
40
+
41
+ #### Parameters
42
+
43
+ | Name | Type |
44
+ | :------ | :------ |
45
+ | `config` | [`ScreebConfig`](ScreebConfig.md) |
46
+
47
+ ## Properties
48
+
49
+ ### config
50
+
51
+ • `Private` **config**: [`ScreebConfig`](ScreebConfig.md)
52
+
53
+ ___
54
+
55
+ ### isInitialized
56
+
57
+ • `Private` **isInitialized**: `boolean` = `false`
58
+
59
+ ## Methods
60
+
61
+ ### close
62
+
63
+ ▸ **close**(): `Promise`<`unknown`\>
64
+
65
+ Shutdowns current Screeb session.
66
+
67
+ **`Example`**
68
+
69
+ ```ts
70
+ this.screeb.close();
71
+ ```
72
+
73
+ #### Returns
74
+
75
+ `Promise`<`unknown`\>
76
+
77
+ ___
78
+
79
+ ### debug
80
+
81
+ ▸ **debug**(): `Promise`<`unknown`\>
82
+
83
+ Prints the actual state information of Screeb tag.
84
+
85
+ **`Example`**
86
+
87
+ ```ts
88
+ this.screeb.debug();
89
+ // ******************* SCREEB SESSION DEBUG *********************
90
+ // Screeb channel id: <UUID>
91
+ // Screeb channel type: widget
92
+ // Screeb respondent id: <UUID>
93
+ // Screeb survey id: none
94
+ // Screeb response id: none
95
+ //
96
+ // Screeb current session start: Thu May 04 2023 16:53:49 GMT+0200 (Central European Summer Time)
97
+ // Screeb current session last activity: Thu May 04 2023 17:41:30 GMT+0200 (Central European Summer Time)
98
+ //
99
+ // Screeb targeting engine status: disabled
100
+ // Screeb targeting engine: 3 surveys
101
+ //
102
+ // Detected platform: desktop
103
+ // Detected locale: en-GB
104
+ // Detected timezone: -120
105
+ // **************************************************************
106
+ ```
107
+
108
+ #### Returns
109
+
110
+ `Promise`<`unknown`\>
111
+
112
+ ___
113
+
114
+ ### ensureScreeb
115
+
116
+ ▸ `Private` **ensureScreeb**(`functionName`, `onlyLoaded?`): `Promise`<`void`\>
117
+
118
+ #### Parameters
119
+
120
+ | Name | Type | Default value |
121
+ | :------ | :------ | :------ |
122
+ | `functionName` | `string` | `undefined` |
123
+ | `onlyLoaded` | `boolean` | `false` |
124
+
125
+ #### Returns
126
+
127
+ `Promise`<`void`\>
128
+
129
+ ___
130
+
131
+ ### eventTrack
132
+
133
+ ▸ **eventTrack**(`eventName`, `eventProperties?`): `Promise`<`unknown`\>
134
+
135
+ Tracks a user event.
136
+
137
+ **`Example`**
138
+
139
+ ```ts
140
+ this.screeb.eventTrack(
141
+ "Product added to cart",
142
+ {
143
+ product_name: 'Red bike 2021',
144
+ category: 'sport',
145
+ color: 'red',
146
+ price: 299,
147
+ count: 1,
148
+ reference: '2CF093TG1',
149
+ delivery_method: 'UPS',
150
+ user_logged: false,
151
+ added_at: new Date(),
152
+ }
153
+ );
154
+ ```
155
+
156
+ #### Parameters
157
+
158
+ | Name | Type | Description |
159
+ | :------ | :------ | :------ |
160
+ | `eventName` | `string` | The event name. |
161
+ | `eventProperties?` | `PropertyRecord` | The properties of your event. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
162
+
163
+ #### Returns
164
+
165
+ `Promise`<`unknown`\>
166
+
167
+ ___
168
+
169
+ ### identity
170
+
171
+ ▸ **identity**(`userId`, `userProperties?`): `Promise`<`unknown`\>
172
+
173
+ Change the current user identity.
174
+ Warning: Running surveys will be closed.
175
+
176
+ **`Example`**
177
+
178
+ ```ts
179
+ this.screeb.identity(
180
+ "<your-user-id>",
181
+ {
182
+ firstname: '<user-firstname>',
183
+ lastname: '<user-lastname>',
184
+ plan: '<user-plan>',
185
+ last_seen_at: new Date(),
186
+ authenticated: true
187
+ }
188
+ );
189
+ ```
190
+
191
+ #### Parameters
192
+
193
+ | Name | Type | Description |
194
+ | :------ | :------ | :------ |
195
+ | `userId` | `string` | The unique identifier of your user. |
196
+ | `userProperties?` | `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. ``` |
197
+
198
+ #### Returns
199
+
200
+ `Promise`<`unknown`\>
201
+
202
+ ___
203
+
204
+ ### identityGet
205
+
206
+ ▸ **identityGet**(): `Promise`<`ScreebIdentityGetReturn`\>
207
+
208
+ Retrieves the current user identity.
209
+
210
+ **`Example`**
211
+
212
+ ```ts
213
+ console.log(await this.screeb.identityGet());
214
+ // {
215
+ // anonymous_id: "<UUID>",
216
+ // user_id: "<UUID>",
217
+ // session_id: "<UUID>",
218
+ // session_start: "2023-05-04T16:30:15.882Z",
219
+ // session_end: "2023-05-04T17:02:09.087Z",
220
+ // channel_id: "<UUID>",
221
+ // is_ready: true,
222
+ // }
223
+ ```
224
+
225
+ #### Returns
226
+
227
+ `Promise`<`ScreebIdentityGetReturn`\>
228
+
229
+ ___
230
+
231
+ ### identityGroupAssign
232
+
233
+ ▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `Promise`<`unknown`\>
234
+
235
+ Assigns the current user to a group.
236
+
237
+ **`Example`**
238
+
239
+ ```ts
240
+ this.screeb.identityGroupAssign(
241
+ 'company',
242
+ 'Apple',
243
+ {
244
+ address_line_1: 'Apple Campus',
245
+ address_line_2: '1 Infinite Loop',
246
+ city: 'Cupertino',
247
+ zipcode: 95014,
248
+ state: 'California',
249
+ country: 'United states',
250
+ }
251
+ );
252
+ ```
253
+
254
+ #### Parameters
255
+
256
+ | Name | Type | Description |
257
+ | :------ | :------ | :------ |
258
+ | `groupName` | `string` | |
259
+ | `groupType?` | `string` | |
260
+ | `groupProperties?` | `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. ``` |
261
+
262
+ #### Returns
263
+
264
+ `Promise`<`unknown`\>
265
+
266
+ ___
267
+
268
+ ### identityGroupUnassign
269
+
270
+ ▸ **identityGroupUnassign**(`groupName`, `groupType?`): `Promise`<`unknown`\>
271
+
272
+ Unassigns the current user to a group.
273
+
274
+ **`Example`**
275
+
276
+ ```ts
277
+ this.screeb.identityGroupUnassign('company', 'Apple');
278
+ ```
279
+
280
+ #### Parameters
281
+
282
+ | Name | Type | Description |
283
+ | :------ | :------ | :------ |
284
+ | `groupName` | `string` | The name of your user group. |
285
+ | `groupType?` | `string` | The type of your user group. |
286
+
287
+ #### Returns
288
+
289
+ `Promise`<`unknown`\>
290
+
291
+ ___
292
+
293
+ ### identityProperties
294
+
295
+ ▸ **identityProperties**(`userProperties`): `Promise`<`unknown`\>
296
+
297
+ Adds properties to the current user identity.
298
+
299
+ **`Example`**
300
+
301
+ ```ts
302
+ // Set user properties
303
+ this.screeb.identityProperties(
304
+ {
305
+ firstname: '<user-firstname>',
306
+ lastname: '<user-lastname>',
307
+ plan: '<user-plan>',
308
+ last_seen_at: new Date(),
309
+ authenticated: true
310
+ }
311
+ );
312
+
313
+ // Delete user property : set values to null
314
+ this.screeb.identityProperties(
315
+ {
316
+ age: null,
317
+ company: null,
318
+ logged: true,
319
+ }
320
+ );
321
+ ```
322
+
323
+ #### Parameters
324
+
325
+ | Name | Type | Description |
326
+ | :------ | :------ | :------ |
327
+ | `userProperties` | `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. ``` |
328
+
329
+ #### Returns
330
+
331
+ `Promise`<`unknown`\>
332
+
333
+ ___
334
+
335
+ ### identityReset
336
+
337
+ ▸ **identityReset**(): `Promise`<`unknown`\>
338
+
339
+ Resets the current user identity.
340
+ Warning: This command must be called only once, since it creates a new identity on Screeb side.
341
+
342
+ **`Example`**
343
+
344
+ ```ts
345
+ this.screeb.identityReset();
346
+ ```
347
+
348
+ #### Returns
349
+
350
+ `Promise`<`unknown`\>
351
+
352
+ ___
353
+
354
+ ### init
355
+
356
+ ▸ **init**(`websiteId`, `userId?`, `userProperties?`): `Promise`<`unknown`\>
357
+
358
+ Initializes Screeb tag.
359
+
360
+ **`Example`**
361
+
362
+ ```ts
363
+ this.screeb.init(
364
+ "<your-website-id>",
365
+ "<your-user-id>",
366
+ {
367
+ firstname: '<user-firstname>',
368
+ lastname: '<user-lastname>',
369
+ plan: '<user-plan>',
370
+ last_seen_at: new Date(),
371
+ authenticated: true
372
+ }
373
+ );
374
+ ```
375
+
376
+ #### Parameters
377
+
378
+ | Name | Type | Description |
379
+ | :------ | :------ | :------ |
380
+ | `websiteId` | `string` | Your website/channel id. |
381
+ | `userId?` | `string` | The unique identifier of your user. |
382
+ | `userProperties?` | `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 ``` |
383
+
384
+ #### Returns
385
+
386
+ `Promise`<`unknown`\>
387
+
388
+ ___
389
+
390
+ ### load
391
+
392
+ ▸ **load**(): `Promise`<`undefined`\>
393
+
394
+ Appends Screeb tag into your dom.
395
+
396
+ **`Example`**
397
+
398
+ ```ts
399
+ this.screeb.load();
400
+ ```
401
+
402
+ #### Returns
403
+
404
+ `Promise`<`undefined`\>
405
+
406
+ ___
407
+
408
+ ### surveyClose
409
+
410
+ ▸ **surveyClose**(): `Promise`<`unknown`\>
411
+
412
+ Interrupts a running survey.
413
+
414
+ **`Example`**
415
+
416
+ ```ts
417
+ this.screeb.surveyClose();
418
+ ```
419
+
420
+ #### Returns
421
+
422
+ `Promise`<`unknown`\>
423
+
424
+ ___
425
+
426
+ ### surveyStart
427
+
428
+ ▸ **surveyStart**(`surveyId`, `allowMultipleResponses`, `hiddenFields`): `Promise`<`unknown`\>
429
+
430
+ Starts a survey by its ID.
431
+
432
+ **`Example`**
433
+
434
+ ```ts
435
+ this.screeb.surveyStart(
436
+ '<UUID>',
437
+ false,
438
+ {
439
+ color: "green",
440
+ article_id: 42
441
+ }
442
+ );
443
+ ```
444
+
445
+ #### Parameters
446
+
447
+ | Name | Type |
448
+ | :------ | :------ |
449
+ | `surveyId` | `string` |
450
+ | `allowMultipleResponses` | `boolean` |
451
+ | `hiddenFields` | `PropertyRecord` |
452
+
453
+ #### Returns
454
+
455
+ `Promise`<`unknown`\>
456
+
457
+ ___
458
+
459
+ ### targetingCheck
460
+
461
+ ▸ **targetingCheck**(): `Promise`<`unknown`\>
462
+
463
+ Forces a targeting check.
464
+
465
+ **`Example`**
466
+
467
+ ```ts
468
+ this.screeb.targetingCheck();
469
+ ```
470
+
471
+ #### Returns
472
+
473
+ `Promise`<`unknown`\>
474
+
475
+ ___
476
+
477
+ ### targetingDebug
478
+
479
+ ▸ **targetingDebug**(): `Promise`<`unknown`\>
480
+
481
+ Prints the current state of the targeting engine.
482
+
483
+ **`Example`**
484
+
485
+ ```ts
486
+ console.log(await this.screeb.targetingDebug());
487
+ // targeting ************ SCREEB TARGETING RULES DEBUG **************
488
+ // Disabled surveys are not listed here.
489
+ //
490
+ // Screeb channel id: <UUID>
491
+ // Screeb respondent id: <UUID>
492
+ //
493
+ // Survey <UUID>:
494
+ // https://admin.screeb.app/org/last/survey/<UUID>/share
495
+ //
496
+ // - Rule of type "Device type (desktop/mobile/tablet)": true 🟢
497
+ // - Rule of type "Multiple display": true 🟢
498
+ // - Rule of type "Capping per time between survey display on current respondent": true 🟢
499
+ // - Rule of type "User event count": false 🔴
500
+ // - Rule of type "Capping per respondent display count": false 🔴
501
+ ```
502
+
503
+ #### Returns
504
+
505
+ `Promise`<`unknown`\>
@@ -0,0 +1,87 @@
1
+ [@screeb/sdk-angular](../README.md) / ScreebConfig
2
+
3
+ # Class: ScreebConfig
4
+
5
+ Configuration of Screeb module
6
+
7
+ ## Table of contents
8
+
9
+ ### Constructors
10
+
11
+ - [constructor](ScreebConfig.md#constructor)
12
+
13
+ ### Properties
14
+
15
+ - [autoInit](ScreebConfig.md#autoinit)
16
+ - [options](ScreebConfig.md#options)
17
+ - [shouldLoad](ScreebConfig.md#shouldload)
18
+ - [userId](ScreebConfig.md#userid)
19
+ - [userProperties](ScreebConfig.md#userproperties)
20
+ - [websiteId](ScreebConfig.md#websiteid)
21
+
22
+ ## Constructors
23
+
24
+ ### constructor
25
+
26
+ • **new ScreebConfig**()
27
+
28
+ ## Properties
29
+
30
+ ### autoInit
31
+
32
+ • `Optional` **autoInit**: `boolean`
33
+
34
+ Indicates if Screeb should be automatically initialized.
35
+
36
+ **`Remarks`**
37
+
38
+ if `true`, 'init' does not need to be called manually
39
+
40
+ ___
41
+
42
+ ### options
43
+
44
+ • `Optional` **options**: `ScreebOptions`
45
+
46
+ Screeb tag initialization options.
47
+
48
+ **`Remarks`**
49
+
50
+ this is used is really particular cases, handle with care.
51
+
52
+ ___
53
+
54
+ ### shouldLoad
55
+
56
+ • `Optional` **shouldLoad**: `boolean`
57
+
58
+ Indicates if Screeb should be automatically loaded.
59
+ This will ping to the Screeb servers.
60
+
61
+ **`Remarks`**
62
+
63
+ if `true`, 'load' does not need to be called manually. Can be used for multistaged environments
64
+
65
+ ___
66
+
67
+ ### userId
68
+
69
+ • `Optional` **userId**: `string`
70
+
71
+ The unique identifier of your user.
72
+
73
+ ___
74
+
75
+ ### userProperties
76
+
77
+ • `Optional` **userProperties**: `PropertyRecord`
78
+
79
+ The properties of your user.
80
+
81
+ ___
82
+
83
+ ### websiteId
84
+
85
+ • `Optional` **websiteId**: `string`
86
+
87
+ Your website/channel id.
@@ -0,0 +1,61 @@
1
+ [@screeb/sdk-angular](../README.md) / ScreebModule
2
+
3
+ # Class: ScreebModule
4
+
5
+ ## Table of contents
6
+
7
+ ### Constructors
8
+
9
+ - [constructor](ScreebModule.md#constructor)
10
+
11
+ ### Methods
12
+
13
+ - [forRoot](ScreebModule.md#forroot)
14
+
15
+ ## Constructors
16
+
17
+ ### constructor
18
+
19
+ • **new ScreebModule**(`config`, `screeb`)
20
+
21
+ #### Parameters
22
+
23
+ | Name | Type |
24
+ | :------ | :------ |
25
+ | `config` | [`ScreebConfig`](ScreebConfig.md) |
26
+ | `screeb` | [`Screeb`](Screeb.md) |
27
+
28
+ ## Methods
29
+
30
+ ### forRoot
31
+
32
+ ▸ `Static` **forRoot**(`config`): `ModuleWithProviders`<[`ScreebModule`](ScreebModule.md)\>
33
+
34
+ This is used to initialize Screeb at the top of your Angular application
35
+
36
+ **`Example`**
37
+
38
+ ```ts
39
+ ScreebModule.forRoot({
40
+ autoInit: true,
41
+ "<your-website-id>",
42
+ "<your-user-id>",
43
+ {
44
+ firstname: '<user-firstname>',
45
+ lastname: '<user-lastname>',
46
+ plan: '<user-plan>',
47
+ last_seen_at: new Date(),
48
+ authenticated: true
49
+ }
50
+ })
51
+ ```
52
+
53
+ #### Parameters
54
+
55
+ | Name | Type | Description |
56
+ | :------ | :------ | :------ |
57
+ | `config` | [`ScreebConfig`](ScreebConfig.md) | Configuration to pass to Screeb browser SDK |
58
+
59
+ #### Returns
60
+
61
+ `ModuleWithProviders`<[`ScreebModule`](ScreebModule.md)\>
package/package.json ADDED
@@ -0,0 +1,78 @@
1
+ {
2
+ "name": "@screeb/sdk-angular",
3
+ "version": "0.1.1",
4
+ "description": "Screeb's browser sdk, optimized for Angular.",
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": "support@screeb.app"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/ScreebApp/sdk-js.git",
22
+ "directory": "packages/screeb-sdk-angular"
23
+ },
24
+ "license": "MIT",
25
+ "author": "Screeb's frontend team",
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "exports": {
29
+ "./package.json": "./package.json",
30
+ ".": {
31
+ "import": "./dist/es/index.js"
32
+ }
33
+ },
34
+ "module": "dist/es/index.js",
35
+ "types": "dist/es/index.d.ts",
36
+ "files": [
37
+ "dist",
38
+ "docs",
39
+ "README.md"
40
+ ],
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": "echo '@TODO'"
47
+ },
48
+ "dependencies": {
49
+ "@screeb/sdk-browser": "^0.1.8"
50
+ },
51
+ "devDependencies": {
52
+ "@angular/common": "^16.0.3",
53
+ "@angular/core": "^16.0.3",
54
+ "@screeb/eslint-config": "^0.1.5",
55
+ "@screeb/sdk-browser": "^0.1.6",
56
+ "@screeb/typescript-config": "^0.1.5",
57
+ "@types/jest": "^29.5.1",
58
+ "@types/node": "^18.11.19",
59
+ "@typescript-eslint/eslint-plugin": "^5.59.6",
60
+ "eslint": "^8.41.0",
61
+ "eslint-plugin-import": "^2.27.5",
62
+ "eslint-plugin-jest": "^27.2.1",
63
+ "eslint-plugin-jsx-a11y": "^6.7.1",
64
+ "eslint-plugin-prettier": "^4.2.1",
65
+ "jest": "^29.5.0",
66
+ "prettier": "^2.8.8",
67
+ "rollup": "^3.23.0",
68
+ "typedoc": "^0.24.7",
69
+ "typedoc-plugin-markdown": "^3.15.3"
70
+ },
71
+ "peerDependencies": {
72
+ "@angular/common": ">=10",
73
+ "@angular/core": ">=10"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ }
78
+ }