@screeb/sdk-angular 0.1.1 → 0.1.3
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 +3 -3
- package/dist/screeb-sdk-angular/esm2022/lib/logger.mjs +27 -0
- package/dist/screeb-sdk-angular/esm2022/lib/screeb-config.mjs +13 -0
- package/dist/screeb-sdk-angular/esm2022/lib/screeb.mjs +379 -0
- package/dist/screeb-sdk-angular/esm2022/lib/screeb.module.mjs +59 -0
- package/dist/screeb-sdk-angular/esm2022/public-api.mjs +7 -0
- package/dist/screeb-sdk-angular/esm2022/screeb-sdk-angular.mjs +5 -0
- package/dist/screeb-sdk-angular/fesm2022/screeb-sdk-angular.mjs +475 -0
- package/dist/screeb-sdk-angular/fesm2022/screeb-sdk-angular.mjs.map +1 -0
- package/dist/screeb-sdk-angular/index.d.ts +5 -0
- package/dist/{es → screeb-sdk-angular/lib}/screeb-config.d.ts +3 -0
- package/dist/{es → screeb-sdk-angular/lib}/screeb.d.ts +3 -0
- package/dist/{es → screeb-sdk-angular/lib}/screeb.module.d.ts +7 -3
- package/dist/screeb-sdk-angular/package.json +25 -0
- package/dist/screeb-sdk-angular/public-api.d.ts +3 -0
- package/docs/classes/ScreebModule.md +3 -3
- package/package.json +36 -18
- package/dist/es/index.d.ts +0 -3
- package/dist/es/index.js +0 -653
- /package/dist/{es → screeb-sdk-angular/lib}/logger.d.ts +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, Inject, NgModule } from '@angular/core';
|
|
3
|
+
import * as _Screeb from '@screeb/sdk-browser';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Logs messages in the console with a corresponding urgency
|
|
7
|
+
*
|
|
8
|
+
* @param level the urgency of the message
|
|
9
|
+
* @param message the message to log in the console
|
|
10
|
+
*/
|
|
11
|
+
const log = (level, message) => {
|
|
12
|
+
const packageName = "[@screeb/angular-sdk]";
|
|
13
|
+
switch (level) {
|
|
14
|
+
case "info":
|
|
15
|
+
// eslint-disable-next-line no-console
|
|
16
|
+
console.log(`${packageName} ${message}`);
|
|
17
|
+
break;
|
|
18
|
+
case "warn":
|
|
19
|
+
// eslint-disable-next-line no-console
|
|
20
|
+
console.warn(`${packageName} ${message}`);
|
|
21
|
+
break;
|
|
22
|
+
case "error":
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.error(`${packageName} ${message}`);
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
console.log(`${packageName} ${message}`);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Configuration of Screeb module */
|
|
33
|
+
class ScreebConfig {
|
|
34
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
35
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebConfig, providedIn: "root" }); }
|
|
36
|
+
}
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebConfig, decorators: [{
|
|
38
|
+
type: Injectable,
|
|
39
|
+
args: [{ providedIn: "root" }]
|
|
40
|
+
}] });
|
|
41
|
+
|
|
42
|
+
class Screeb {
|
|
43
|
+
// eslint-disable-next-line no-unused-vars
|
|
44
|
+
constructor(config) {
|
|
45
|
+
this.config = config;
|
|
46
|
+
this.isInitialized = false;
|
|
47
|
+
}
|
|
48
|
+
async ensureScreeb(functionName, onlyLoaded = false) {
|
|
49
|
+
if (!_Screeb.isLoaded() && !this.config.shouldLoad) {
|
|
50
|
+
const message = "Screeb instance is not loaded because `shouldLoad` is set to `false` in `ScreebModule` configuration.";
|
|
51
|
+
log("warn", message);
|
|
52
|
+
return Promise.reject(message);
|
|
53
|
+
}
|
|
54
|
+
if (!this.isInitialized && !onlyLoaded) {
|
|
55
|
+
const message = [
|
|
56
|
+
`"${functionName}" was called but Screeb has not been initialized yet. `,
|
|
57
|
+
`Please call 'init' before calling '${functionName}' or `,
|
|
58
|
+
"set 'autoInit' to true in the `ScreebModule` configuration.",
|
|
59
|
+
].join("");
|
|
60
|
+
log("warn", message);
|
|
61
|
+
return Promise.reject(message);
|
|
62
|
+
}
|
|
63
|
+
return Promise.resolve();
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Shutdowns current Screeb session.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* this.screeb.close();
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
async close() {
|
|
74
|
+
await this.ensureScreeb("close");
|
|
75
|
+
return _Screeb.close();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Prints the actual state information of Screeb tag.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* this.screeb.debug();
|
|
83
|
+
* // ******************* SCREEB SESSION DEBUG *********************
|
|
84
|
+
* // Screeb channel id: <UUID>
|
|
85
|
+
* // Screeb channel type: widget
|
|
86
|
+
* // Screeb respondent id: <UUID>
|
|
87
|
+
* // Screeb survey id: none
|
|
88
|
+
* // Screeb response id: none
|
|
89
|
+
* //
|
|
90
|
+
* // Screeb current session start: Thu May 04 2023 16:53:49 GMT+0200 (Central European Summer Time)
|
|
91
|
+
* // Screeb current session last activity: Thu May 04 2023 17:41:30 GMT+0200 (Central European Summer Time)
|
|
92
|
+
* //
|
|
93
|
+
* // Screeb targeting engine status: disabled
|
|
94
|
+
* // Screeb targeting engine: 3 surveys
|
|
95
|
+
* //
|
|
96
|
+
* // Detected platform: desktop
|
|
97
|
+
* // Detected locale: en-GB
|
|
98
|
+
* // Detected timezone: -120
|
|
99
|
+
* // **************************************************************
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async debug() {
|
|
103
|
+
await this.ensureScreeb("debug");
|
|
104
|
+
return _Screeb.debug();
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Tracks a user event.
|
|
108
|
+
*
|
|
109
|
+
* @param eventName The event name.
|
|
110
|
+
* @param eventProperties The properties of your event.
|
|
111
|
+
* ```text Requirements:
|
|
112
|
+
* - Property names must be limited to 128 characters
|
|
113
|
+
* - No more than 1000 attributes
|
|
114
|
+
* - Supported types for values: string, number, boolean and Date.
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* this.screeb.eventTrack(
|
|
120
|
+
* "Product added to cart",
|
|
121
|
+
* {
|
|
122
|
+
* product_name: 'Red bike 2021',
|
|
123
|
+
* category: 'sport',
|
|
124
|
+
* color: 'red',
|
|
125
|
+
* price: 299,
|
|
126
|
+
* count: 1,
|
|
127
|
+
* reference: '2CF093TG1',
|
|
128
|
+
* delivery_method: 'UPS',
|
|
129
|
+
* user_logged: false,
|
|
130
|
+
* added_at: new Date(),
|
|
131
|
+
* }
|
|
132
|
+
* );
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
async eventTrack(eventName, eventProperties) {
|
|
136
|
+
await this.ensureScreeb("eventTrack");
|
|
137
|
+
return _Screeb.eventTrack(eventName, eventProperties);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Change the current user identity.
|
|
141
|
+
* Warning: Running surveys will be closed.
|
|
142
|
+
*
|
|
143
|
+
* @param userId The unique identifier of your user.
|
|
144
|
+
* @param userProperties The properties of your user.
|
|
145
|
+
* ```text Requirements:
|
|
146
|
+
* - Property names must be limited to 128 characters
|
|
147
|
+
* - No more than 1000 attributes
|
|
148
|
+
* - Supported types for values: string, number, boolean and Date.
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* this.screeb.identity(
|
|
154
|
+
* "<your-user-id>",
|
|
155
|
+
* {
|
|
156
|
+
* firstname: '<user-firstname>',
|
|
157
|
+
* lastname: '<user-lastname>',
|
|
158
|
+
* plan: '<user-plan>',
|
|
159
|
+
* last_seen_at: new Date(),
|
|
160
|
+
* authenticated: true
|
|
161
|
+
* }
|
|
162
|
+
* );
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
async identity(userId, userProperties) {
|
|
166
|
+
await this.ensureScreeb("identity");
|
|
167
|
+
return _Screeb.identity(userId, userProperties);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves the current user identity.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* console.log(await this.screeb.identityGet());
|
|
175
|
+
* // {
|
|
176
|
+
* // anonymous_id: "<UUID>",
|
|
177
|
+
* // user_id: "<UUID>",
|
|
178
|
+
* // session_id: "<UUID>",
|
|
179
|
+
* // session_start: "2023-05-04T16:30:15.882Z",
|
|
180
|
+
* // session_end: "2023-05-04T17:02:09.087Z",
|
|
181
|
+
* // channel_id: "<UUID>",
|
|
182
|
+
* // is_ready: true,
|
|
183
|
+
* // }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
async identityGet() {
|
|
187
|
+
await this.ensureScreeb("identityGet");
|
|
188
|
+
return _Screeb.identityGet();
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Assigns the current user to a group.
|
|
192
|
+
*
|
|
193
|
+
* @param groupName
|
|
194
|
+
* @param groupType
|
|
195
|
+
* @param groupProperties The properties of your user group.
|
|
196
|
+
* ```text Requirements:
|
|
197
|
+
* - Property names must be limited to 128 characters
|
|
198
|
+
* - No more than 1000 attributes
|
|
199
|
+
* - Supported types for values: string, number, boolean and Date.
|
|
200
|
+
* ```
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* this.screeb.identityGroupAssign(
|
|
205
|
+
* 'company',
|
|
206
|
+
* 'Apple',
|
|
207
|
+
* {
|
|
208
|
+
* address_line_1: 'Apple Campus',
|
|
209
|
+
* address_line_2: '1 Infinite Loop',
|
|
210
|
+
* city: 'Cupertino',
|
|
211
|
+
* zipcode: 95014,
|
|
212
|
+
* state: 'California',
|
|
213
|
+
* country: 'United states',
|
|
214
|
+
* }
|
|
215
|
+
* );
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
async identityGroupAssign(groupName, groupType, groupProperties) {
|
|
219
|
+
await this.ensureScreeb("identityGroupAssign");
|
|
220
|
+
return _Screeb.identityGroupAssign(groupName, groupType, groupProperties);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Unassigns the current user to a group.
|
|
224
|
+
*
|
|
225
|
+
* @param groupName The name of your user group.
|
|
226
|
+
* @param groupType The type of your user group.
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* this.screeb.identityGroupUnassign('company', 'Apple');
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
async identityGroupUnassign(groupName, groupType) {
|
|
234
|
+
await this.ensureScreeb("identityGroupUnassign");
|
|
235
|
+
return _Screeb.identityGroupUnassign(groupName, groupType);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Adds properties to the current user identity.
|
|
239
|
+
*
|
|
240
|
+
* @param userProperties The properties of your user.
|
|
241
|
+
* ```text Requirements:
|
|
242
|
+
* - Property names must be limited to 128 characters
|
|
243
|
+
* - No more than 1000 attributes
|
|
244
|
+
* - Supported types for values: string, number, boolean and Date.
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```ts
|
|
249
|
+
* // Set user properties
|
|
250
|
+
* this.screeb.identityProperties(
|
|
251
|
+
* {
|
|
252
|
+
* firstname: '<user-firstname>',
|
|
253
|
+
* lastname: '<user-lastname>',
|
|
254
|
+
* plan: '<user-plan>',
|
|
255
|
+
* last_seen_at: new Date(),
|
|
256
|
+
* authenticated: true
|
|
257
|
+
* }
|
|
258
|
+
* );
|
|
259
|
+
*
|
|
260
|
+
* // Delete user property : set values to null
|
|
261
|
+
* this.screeb.identityProperties(
|
|
262
|
+
* {
|
|
263
|
+
* age: null,
|
|
264
|
+
* company: null,
|
|
265
|
+
* logged: true,
|
|
266
|
+
* }
|
|
267
|
+
* );
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
async identityProperties(userProperties) {
|
|
271
|
+
await this.ensureScreeb("identityProperties");
|
|
272
|
+
return _Screeb.identityProperties(userProperties);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Resets the current user identity.
|
|
276
|
+
* Warning: This command must be called only once, since it creates a new identity on Screeb side.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* this.screeb.identityReset();
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
async identityReset() {
|
|
284
|
+
await this.ensureScreeb("identityReset");
|
|
285
|
+
return _Screeb.identityReset();
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Interrupts a running survey.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* this.screeb.surveyClose();
|
|
293
|
+
* ```
|
|
294
|
+
*/
|
|
295
|
+
async surveyClose() {
|
|
296
|
+
await this.ensureScreeb("surveyClose");
|
|
297
|
+
return _Screeb.surveyClose();
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Starts a survey by its ID.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```ts
|
|
304
|
+
* this.screeb.surveyStart(
|
|
305
|
+
* '<UUID>',
|
|
306
|
+
* false,
|
|
307
|
+
* {
|
|
308
|
+
* color: "green",
|
|
309
|
+
* article_id: 42
|
|
310
|
+
* }
|
|
311
|
+
* );
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
async surveyStart(surveyId, allowMultipleResponses, hiddenFields) {
|
|
315
|
+
await this.ensureScreeb("surveyStart");
|
|
316
|
+
return _Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Forces a targeting check.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* this.screeb.targetingCheck();
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
async targetingCheck() {
|
|
327
|
+
await this.ensureScreeb("targetingCheck");
|
|
328
|
+
return _Screeb.targetingCheck();
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Prints the current state of the targeting engine.
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```ts
|
|
335
|
+
* console.log(await this.screeb.targetingDebug());
|
|
336
|
+
* // targeting ************ SCREEB TARGETING RULES DEBUG **************
|
|
337
|
+
* // Disabled surveys are not listed here.
|
|
338
|
+
* //
|
|
339
|
+
* // Screeb channel id: <UUID>
|
|
340
|
+
* // Screeb respondent id: <UUID>
|
|
341
|
+
* //
|
|
342
|
+
* // Survey <UUID>:
|
|
343
|
+
* // https://admin.screeb.app/org/last/survey/<UUID>/share
|
|
344
|
+
* //
|
|
345
|
+
* // - Rule of type "Device type (desktop/mobile/tablet)": true 🟢
|
|
346
|
+
* // - Rule of type "Multiple display": true 🟢
|
|
347
|
+
* // - Rule of type "Capping per time between survey display on current respondent": true 🟢
|
|
348
|
+
* // - Rule of type "User event count": false 🔴
|
|
349
|
+
* // - Rule of type "Capping per respondent display count": false 🔴
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
async targetingDebug() {
|
|
353
|
+
await this.ensureScreeb("targetingDebug");
|
|
354
|
+
return _Screeb.targetingDebug();
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Initializes Screeb tag.
|
|
358
|
+
*
|
|
359
|
+
* @param websiteId Your website/channel id.
|
|
360
|
+
* @param userId The unique identifier of your user.
|
|
361
|
+
* @param userProperties The properties of your user.
|
|
362
|
+
* ```text Requirements:
|
|
363
|
+
* - Property names must be limited to 128 characters
|
|
364
|
+
* - No more than 1000 attributes
|
|
365
|
+
* - Supported types for values: string, number, boolean and Date
|
|
366
|
+
* ```
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```ts
|
|
370
|
+
* this.screeb.init(
|
|
371
|
+
* "<your-website-id>",
|
|
372
|
+
* "<your-user-id>",
|
|
373
|
+
* {
|
|
374
|
+
* firstname: '<user-firstname>',
|
|
375
|
+
* lastname: '<user-lastname>',
|
|
376
|
+
* plan: '<user-plan>',
|
|
377
|
+
* last_seen_at: new Date(),
|
|
378
|
+
* authenticated: true
|
|
379
|
+
* }
|
|
380
|
+
* );
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
async init(websiteId, userId, userProperties) {
|
|
384
|
+
await this.ensureScreeb("init", true);
|
|
385
|
+
this.isInitialized = true;
|
|
386
|
+
return await _Screeb.init(websiteId, userId, userProperties);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Appends Screeb tag into your dom.
|
|
390
|
+
*
|
|
391
|
+
* @param options Screeb module options.
|
|
392
|
+
* @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
|
|
393
|
+
* @param options.screebEndpoint Please don't do this.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* this.screeb.load();
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
async load() {
|
|
401
|
+
return _Screeb.load();
|
|
402
|
+
}
|
|
403
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Screeb, deps: [{ token: ScreebConfig }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
404
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Screeb, providedIn: "root" }); }
|
|
405
|
+
}
|
|
406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: Screeb, decorators: [{
|
|
407
|
+
type: Injectable,
|
|
408
|
+
args: [{ providedIn: "root" }]
|
|
409
|
+
}], ctorParameters: function () { return [{ type: ScreebConfig, decorators: [{
|
|
410
|
+
type: Inject,
|
|
411
|
+
args: [ScreebConfig]
|
|
412
|
+
}] }]; } });
|
|
413
|
+
|
|
414
|
+
class ScreebModule {
|
|
415
|
+
/**
|
|
416
|
+
* This is used to initialize Screeb at the top of your Angular application
|
|
417
|
+
* @param config Configuration to pass to Screeb browser SDK
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```ts
|
|
421
|
+
* ScreebModule.forRoot({
|
|
422
|
+
* autoInit: true,
|
|
423
|
+
* websiteId: "<your-website-id>",
|
|
424
|
+
* userId: "<your-user-id>",
|
|
425
|
+
* userProperties: {
|
|
426
|
+
* firstname: '<user-firstname>',
|
|
427
|
+
* lastname: '<user-lastname>',
|
|
428
|
+
* plan: '<user-plan>',
|
|
429
|
+
* last_seen_at: new Date(),
|
|
430
|
+
* authenticated: true
|
|
431
|
+
* }
|
|
432
|
+
* })
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
static forRoot(config) {
|
|
436
|
+
return {
|
|
437
|
+
ngModule: ScreebModule,
|
|
438
|
+
providers: [Screeb, { provide: ScreebConfig, useValue: config }],
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
constructor(config, screeb) {
|
|
442
|
+
if (config.shouldLoad ?? true) {
|
|
443
|
+
screeb.load();
|
|
444
|
+
}
|
|
445
|
+
if ((config.autoInit ?? false) && config.websiteId) {
|
|
446
|
+
screeb.init(config.websiteId, config.userId, config.userProperties);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebModule, deps: [{ token: ScreebConfig }, { token: Screeb }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
450
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.4", ngImport: i0, type: ScreebModule }); }
|
|
451
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebModule, providers: [Screeb, ScreebConfig] }); }
|
|
452
|
+
}
|
|
453
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.4", ngImport: i0, type: ScreebModule, decorators: [{
|
|
454
|
+
type: NgModule,
|
|
455
|
+
args: [{
|
|
456
|
+
providers: [Screeb, ScreebConfig],
|
|
457
|
+
}]
|
|
458
|
+
}], ctorParameters: function () { return [{ type: ScreebConfig, decorators: [{
|
|
459
|
+
type: Inject,
|
|
460
|
+
args: [ScreebConfig]
|
|
461
|
+
}] }, { type: Screeb, decorators: [{
|
|
462
|
+
type: Inject,
|
|
463
|
+
args: [Screeb]
|
|
464
|
+
}] }]; } });
|
|
465
|
+
|
|
466
|
+
/*
|
|
467
|
+
* Public API Surface of screeb-sdk-angular
|
|
468
|
+
*/
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Generated bundle index. Do not edit.
|
|
472
|
+
*/
|
|
473
|
+
|
|
474
|
+
export { Screeb, ScreebConfig, ScreebModule };
|
|
475
|
+
//# sourceMappingURL=screeb-sdk-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screeb-sdk-angular.mjs","sources":["../../../projects/screeb-sdk-angular/src/lib/logger.ts","../../../projects/screeb-sdk-angular/src/lib/screeb-config.ts","../../../projects/screeb-sdk-angular/src/lib/screeb.ts","../../../projects/screeb-sdk-angular/src/lib/screeb.module.ts","../../../projects/screeb-sdk-angular/src/public-api.ts","../../../projects/screeb-sdk-angular/src/screeb-sdk-angular.ts"],"sourcesContent":["type LogLevel = \"info\" | \"error\" | \"warn\";\n\n/**\n * Logs messages in the console with a corresponding urgency\n *\n * @param level the urgency of the message\n * @param message the message to log in the console\n */\nexport const log = (level: LogLevel, message: string) => {\n const packageName = \"[@screeb/angular-sdk]\";\n\n switch (level) {\n case \"info\":\n // eslint-disable-next-line no-console\n console.log(`${packageName} ${message}`);\n break;\n case \"warn\":\n // eslint-disable-next-line no-console\n console.warn(`${packageName} ${message}`);\n break;\n case \"error\":\n // eslint-disable-next-line no-console\n console.error(`${packageName} ${message}`);\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(`${packageName} ${message}`);\n }\n};\n","import { Injectable } from \"@angular/core\";\nimport { PropertyRecord, ScreebOptions } from \"@screeb/sdk-browser\";\n\n/** Configuration of Screeb module */\n@Injectable({ providedIn: \"root\" })\nexport class ScreebConfig {\n /** Your website/channel id. */\n websiteId?: string;\n /** The unique identifier of your user. */\n userId?: string;\n /** The properties of your user. */\n userProperties?: PropertyRecord;\n /**\n * Indicates if Screeb should be automatically loaded.\n * This will ping to the Screeb servers.\n *\n * @remarks if `true`, 'load' does not need to be called manually. Can be used for multistaged environments\n */\n shouldLoad?: boolean;\n /**\n * Indicates if Screeb should be automatically initialized.\n *\n * @remarks if `true`, 'init' does not need to be called manually\n * */\n autoInit?: boolean;\n /**\n * Screeb tag initialization options.\n *\n * @remarks this is used is really particular cases, handle with care.\n * */\n options?: ScreebOptions;\n}\n","import { Inject, Injectable } from \"@angular/core\";\nimport * as _Screeb from \"@screeb/sdk-browser\";\n\nimport * as logger from \"./logger\";\nimport { ScreebConfig } from \"./screeb-config\";\n\n@Injectable({ providedIn: \"root\" })\nexport class Screeb {\n private isInitialized = false;\n\n // eslint-disable-next-line no-unused-vars\n constructor(@Inject(ScreebConfig) private config: ScreebConfig) {}\n\n private async ensureScreeb(functionName: string, onlyLoaded = false) {\n if (!_Screeb.isLoaded() && !this.config.shouldLoad) {\n const message =\n \"Screeb instance is not loaded because `shouldLoad` is set to `false` in `ScreebModule` configuration.\";\n\n logger.log(\"warn\", message);\n\n return Promise.reject(message);\n }\n if (!this.isInitialized && !onlyLoaded) {\n const message = [\n `\"${functionName}\" was called but Screeb has not been initialized yet. `,\n `Please call 'init' before calling '${functionName}' or `,\n \"set 'autoInit' to true in the `ScreebModule` configuration.\",\n ].join(\"\");\n\n logger.log(\"warn\", message);\n\n return Promise.reject(message);\n }\n return Promise.resolve();\n }\n\n /**\n * Shutdowns current Screeb session.\n *\n * @example\n * ```ts\n * this.screeb.close();\n * ```\n */\n public async close() {\n await this.ensureScreeb(\"close\");\n\n return _Screeb.close();\n }\n\n /**\n * Prints the actual state information of Screeb tag.\n *\n * @example\n * ```ts\n * this.screeb.debug();\n * // ******************* SCREEB SESSION DEBUG *********************\n * // Screeb channel id: <UUID>\n * // Screeb channel type: widget\n * // Screeb respondent id: <UUID>\n * // Screeb survey id: none\n * // Screeb response id: none\n * //\n * // Screeb current session start: Thu May 04 2023 16:53:49 GMT+0200 (Central European Summer Time)\n * // Screeb current session last activity: Thu May 04 2023 17:41:30 GMT+0200 (Central European Summer Time)\n * //\n * // Screeb targeting engine status: disabled\n * // Screeb targeting engine: 3 surveys\n * //\n * // Detected platform: desktop\n * // Detected locale: en-GB\n * // Detected timezone: -120\n * // **************************************************************\n * ```\n */\n public async debug() {\n await this.ensureScreeb(\"debug\");\n\n return _Screeb.debug();\n }\n\n /**\n * Tracks a user event.\n *\n * @param eventName The event name.\n * @param eventProperties The properties of your event.\n * ```text Requirements:\n * - Property names must be limited to 128 characters\n * - No more than 1000 attributes\n * - Supported types for values: string, number, boolean and Date.\n * ```\n *\n * @example\n * ```ts\n * this.screeb.eventTrack(\n * \"Product added to cart\",\n * {\n * product_name: 'Red bike 2021',\n * category: 'sport',\n * color: 'red',\n * price: 299,\n * count: 1,\n * reference: '2CF093TG1',\n * delivery_method: 'UPS',\n * user_logged: false,\n * added_at: new Date(),\n * }\n * );\n * ```\n */\n public async eventTrack(\n eventName: string,\n eventProperties?: _Screeb.PropertyRecord\n ) {\n await this.ensureScreeb(\"eventTrack\");\n\n return _Screeb.eventTrack(eventName, eventProperties);\n }\n\n /**\n * Change the current user identity.\n * Warning: Running surveys will be closed.\n *\n * @param userId The unique identifier of your user.\n * @param userProperties The properties of your user.\n * ```text Requirements:\n * - Property names must be limited to 128 characters\n * - No more than 1000 attributes\n * - Supported types for values: string, number, boolean and Date.\n * ```\n *\n * @example\n * ```ts\n * this.screeb.identity(\n * \"<your-user-id>\",\n * {\n * firstname: '<user-firstname>',\n * lastname: '<user-lastname>',\n * plan: '<user-plan>',\n * last_seen_at: new Date(),\n * authenticated: true\n * }\n * );\n * ```\n */\n public async identity(\n userId: string,\n userProperties?: _Screeb.PropertyRecord\n ) {\n await this.ensureScreeb(\"identity\");\n\n return _Screeb.identity(userId, userProperties);\n }\n\n /**\n * Retrieves the current user identity.\n *\n * @example\n * ```ts\n * console.log(await this.screeb.identityGet());\n * // {\n * // anonymous_id: \"<UUID>\",\n * // user_id: \"<UUID>\",\n * // session_id: \"<UUID>\",\n * // session_start: \"2023-05-04T16:30:15.882Z\",\n * // session_end: \"2023-05-04T17:02:09.087Z\",\n * // channel_id: \"<UUID>\",\n * // is_ready: true,\n * // }\n * ```\n */\n public async identityGet() {\n await this.ensureScreeb(\"identityGet\");\n\n return _Screeb.identityGet();\n }\n\n /**\n * Assigns the current user to a group.\n *\n * @param groupName\n * @param groupType\n * @param groupProperties The properties of your user group.\n * ```text Requirements:\n * - Property names must be limited to 128 characters\n * - No more than 1000 attributes\n * - Supported types for values: string, number, boolean and Date.\n * ```\n *\n * @example\n * ```ts\n * this.screeb.identityGroupAssign(\n * 'company',\n * 'Apple',\n * {\n * address_line_1: 'Apple Campus',\n * address_line_2: '1 Infinite Loop',\n * city: 'Cupertino',\n * zipcode: 95014,\n * state: 'California',\n * country: 'United states',\n * }\n * );\n * ```\n */\n public async identityGroupAssign(\n groupName: string,\n groupType?: string,\n groupProperties?: _Screeb.PropertyRecord\n ) {\n await this.ensureScreeb(\"identityGroupAssign\");\n\n return _Screeb.identityGroupAssign(groupName, groupType, groupProperties);\n }\n\n /**\n * Unassigns the current user to a group.\n *\n * @param groupName The name of your user group.\n * @param groupType The type of your user group.\n *\n * @example\n * ```ts\n * this.screeb.identityGroupUnassign('company', 'Apple');\n * ```\n */\n public async identityGroupUnassign(groupName: string, groupType?: string) {\n await this.ensureScreeb(\"identityGroupUnassign\");\n\n return _Screeb.identityGroupUnassign(groupName, groupType);\n }\n\n /**\n * Adds properties to the current user identity.\n *\n * @param userProperties The properties of your user.\n * ```text Requirements:\n * - Property names must be limited to 128 characters\n * - No more than 1000 attributes\n * - Supported types for values: string, number, boolean and Date.\n * ```\n *\n * @example\n * ```ts\n * // Set user properties\n * this.screeb.identityProperties(\n * {\n * firstname: '<user-firstname>',\n * lastname: '<user-lastname>',\n * plan: '<user-plan>',\n * last_seen_at: new Date(),\n * authenticated: true\n * }\n * );\n *\n * // Delete user property : set values to null\n * this.screeb.identityProperties(\n * {\n * age: null,\n * company: null,\n * logged: true,\n * }\n * );\n * ```\n */\n public async identityProperties(userProperties: _Screeb.PropertyRecord) {\n await this.ensureScreeb(\"identityProperties\");\n\n return _Screeb.identityProperties(userProperties);\n }\n\n /**\n * Resets the current user identity.\n * Warning: This command must be called only once, since it creates a new identity on Screeb side.\n *\n * @example\n * ```ts\n * this.screeb.identityReset();\n * ```\n */\n public async identityReset() {\n await this.ensureScreeb(\"identityReset\");\n\n return _Screeb.identityReset();\n }\n\n /**\n * Interrupts a running survey.\n *\n * @example\n * ```ts\n * this.screeb.surveyClose();\n * ```\n */\n public async surveyClose() {\n await this.ensureScreeb(\"surveyClose\");\n\n return _Screeb.surveyClose();\n }\n\n /**\n * Starts a survey by its ID.\n *\n * @example\n * ```ts\n * this.screeb.surveyStart(\n * '<UUID>',\n * false,\n * {\n * color: \"green\",\n * article_id: 42\n * }\n * );\n * ```\n */\n public async surveyStart(\n surveyId: string,\n allowMultipleResponses: boolean,\n hiddenFields: _Screeb.PropertyRecord\n ) {\n await this.ensureScreeb(\"surveyStart\");\n\n return _Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields);\n }\n\n /**\n * Forces a targeting check.\n *\n * @example\n * ```ts\n * this.screeb.targetingCheck();\n * ```\n */\n public async targetingCheck() {\n await this.ensureScreeb(\"targetingCheck\");\n\n return _Screeb.targetingCheck();\n }\n\n /**\n * Prints the current state of the targeting engine.\n *\n * @example\n * ```ts\n * console.log(await this.screeb.targetingDebug());\n * // targeting ************ SCREEB TARGETING RULES DEBUG **************\n * // Disabled surveys are not listed here.\n * //\n * // Screeb channel id: <UUID>\n * // Screeb respondent id: <UUID>\n * //\n * // Survey <UUID>:\n * // https://admin.screeb.app/org/last/survey/<UUID>/share\n * //\n * // - Rule of type \"Device type (desktop/mobile/tablet)\": true 🟢\n * // - Rule of type \"Multiple display\": true 🟢\n * // - Rule of type \"Capping per time between survey display on current respondent\": true 🟢\n * // - Rule of type \"User event count\": false 🔴\n * // - Rule of type \"Capping per respondent display count\": false 🔴\n * ```\n */\n public async targetingDebug() {\n await this.ensureScreeb(\"targetingDebug\");\n\n return _Screeb.targetingDebug();\n }\n\n /**\n * Initializes Screeb tag.\n *\n * @param websiteId Your website/channel id.\n * @param userId The unique identifier of your user.\n * @param userProperties The properties of your user.\n * ```text Requirements:\n * - Property names must be limited to 128 characters\n * - No more than 1000 attributes\n * - Supported types for values: string, number, boolean and Date\n * ```\n *\n * @example\n * ```ts\n * this.screeb.init(\n * \"<your-website-id>\",\n * \"<your-user-id>\",\n * {\n * firstname: '<user-firstname>',\n * lastname: '<user-lastname>',\n * plan: '<user-plan>',\n * last_seen_at: new Date(),\n * authenticated: true\n * }\n * );\n * ```\n */\n public async init(\n websiteId: string,\n userId?: string,\n userProperties?: _Screeb.PropertyRecord\n ) {\n await this.ensureScreeb(\"init\", true);\n\n this.isInitialized = true;\n\n return await _Screeb.init(websiteId, userId, userProperties);\n }\n\n /**\n * Appends Screeb tag into your dom.\n *\n * @param options Screeb module options.\n * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.\n * @param options.screebEndpoint Please don't do this.\n *\n * @example\n * ```ts\n * this.screeb.load();\n * ```\n */\n public async load() {\n return _Screeb.load();\n }\n}\n","import { Inject, ModuleWithProviders, NgModule } from \"@angular/core\";\nimport { Screeb } from \"./screeb\";\nimport { ScreebConfig } from \"./screeb-config\";\n\n@NgModule({\n providers: [Screeb, ScreebConfig],\n})\nexport class ScreebModule {\n /**\n * This is used to initialize Screeb at the top of your Angular application\n * @param config Configuration to pass to Screeb browser SDK\n *\n * @example\n * ```ts\n * ScreebModule.forRoot({\n * autoInit: true,\n * websiteId: \"<your-website-id>\",\n * userId: \"<your-user-id>\",\n * userProperties: {\n * firstname: '<user-firstname>',\n * lastname: '<user-lastname>',\n * plan: '<user-plan>',\n * last_seen_at: new Date(),\n * authenticated: true\n * }\n * })\n * ```\n */\n static forRoot(config: ScreebConfig): ModuleWithProviders<ScreebModule> {\n return {\n ngModule: ScreebModule,\n providers: [Screeb, { provide: ScreebConfig, useValue: config }],\n };\n }\n\n constructor(\n @Inject(ScreebConfig) config: ScreebConfig,\n @Inject(Screeb) screeb: Screeb\n ) {\n if (config.shouldLoad ?? true) {\n screeb.load();\n }\n\n if ((config.autoInit ?? false) && config.websiteId) {\n screeb.init(config.websiteId, config.userId, config.userProperties);\n }\n }\n}\n","/*\n * Public API Surface of screeb-sdk-angular\n */\n\nexport { ScreebModule } from \"./lib/screeb.module\";\nexport { ScreebConfig } from \"./lib/screeb-config\";\nexport { Screeb } from \"./lib/screeb\";\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["logger.log"],"mappings":";;;;AAEA;;;;;AAKG;AACI,MAAM,GAAG,GAAG,CAAC,KAAe,EAA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C,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;AACrE,SAAA;KACF;iIAvCU,YAAY,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EA6Bb,YAAY,EAAA,EAAA,EAAA,KAAA,EACZ,MAAM,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA,EAAA;kIA9BL,YAAY,EAAA,CAAA,CAAA,EAAA;AAAZ,uBAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,EAFZ,SAAA,EAAA,CAAC,MAAM,EAAE,YAAY,CAAC,EAAA,CAAA,CAAA,EAAA;;2FAEtB,YAAY,EAAA,UAAA,EAAA,CAAA;kBAHxB,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,SAAS,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC;AAClC,iBAAA,CAAA;;0BA8BI,MAAM;2BAAC,YAAY,CAAA;;0BACnB,MAAM;2BAAC,MAAM,CAAA;;;ACrClB;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PropertyRecord, ScreebOptions } from "@screeb/sdk-browser";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
2
3
|
/** Configuration of Screeb module */
|
|
3
4
|
export declare class ScreebConfig {
|
|
4
5
|
/** Your website/channel id. */
|
|
@@ -26,4 +27,6 @@ export declare class ScreebConfig {
|
|
|
26
27
|
* @remarks this is used is really particular cases, handle with care.
|
|
27
28
|
* */
|
|
28
29
|
options?: ScreebOptions;
|
|
30
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScreebConfig, never>;
|
|
31
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ScreebConfig>;
|
|
29
32
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _Screeb from "@screeb/sdk-browser";
|
|
2
2
|
import { ScreebConfig } from "./screeb-config";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
3
4
|
export declare class Screeb {
|
|
4
5
|
private config;
|
|
5
6
|
private isInitialized;
|
|
@@ -298,4 +299,6 @@ export declare class Screeb {
|
|
|
298
299
|
* ```
|
|
299
300
|
*/
|
|
300
301
|
load(): Promise<undefined>;
|
|
302
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<Screeb, never>;
|
|
303
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<Screeb>;
|
|
301
304
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModuleWithProviders } from "@angular/core";
|
|
2
2
|
import { Screeb } from "./screeb";
|
|
3
3
|
import { ScreebConfig } from "./screeb-config";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class ScreebModule {
|
|
5
6
|
/**
|
|
6
7
|
* This is used to initialize Screeb at the top of your Angular application
|
|
@@ -10,9 +11,9 @@ export declare class ScreebModule {
|
|
|
10
11
|
* ```ts
|
|
11
12
|
* ScreebModule.forRoot({
|
|
12
13
|
* autoInit: true,
|
|
13
|
-
* "<your-website-id>",
|
|
14
|
-
* "<your-user-id>",
|
|
15
|
-
* {
|
|
14
|
+
* websiteId: "<your-website-id>",
|
|
15
|
+
* userId: "<your-user-id>",
|
|
16
|
+
* userProperties: {
|
|
16
17
|
* firstname: '<user-firstname>',
|
|
17
18
|
* lastname: '<user-lastname>',
|
|
18
19
|
* plan: '<user-plan>',
|
|
@@ -24,4 +25,7 @@ export declare class ScreebModule {
|
|
|
24
25
|
*/
|
|
25
26
|
static forRoot(config: ScreebConfig): ModuleWithProviders<ScreebModule>;
|
|
26
27
|
constructor(config: ScreebConfig, screeb: Screeb);
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ScreebModule, never>;
|
|
29
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ScreebModule, never, never, never>;
|
|
30
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<ScreebModule>;
|
|
27
31
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "screeb-sdk-angular",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": ">=10",
|
|
6
|
+
"@angular/core": ">=10"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/screeb-sdk-angular.mjs",
|
|
13
|
+
"typings": "index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"esm2022": "./esm2022/screeb-sdk-angular.mjs",
|
|
21
|
+
"esm": "./esm2022/screeb-sdk-angular.mjs",
|
|
22
|
+
"default": "./fesm2022/screeb-sdk-angular.mjs"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -38,9 +38,9 @@ This is used to initialize Screeb at the top of your Angular application
|
|
|
38
38
|
```ts
|
|
39
39
|
ScreebModule.forRoot({
|
|
40
40
|
autoInit: true,
|
|
41
|
-
"<your-website-id>",
|
|
42
|
-
"<your-user-id>",
|
|
43
|
-
{
|
|
41
|
+
websiteId: "<your-website-id>",
|
|
42
|
+
userId: "<your-user-id>",
|
|
43
|
+
userProperties: {
|
|
44
44
|
firstname: '<user-firstname>',
|
|
45
45
|
lastname: '<user-lastname>',
|
|
46
46
|
plan: '<user-plan>',
|