@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,301 @@
1
+ import * as _Screeb from "@screeb/sdk-browser";
2
+ import { ScreebConfig } from "./screeb-config";
3
+ export declare class Screeb {
4
+ private config;
5
+ private isInitialized;
6
+ constructor(config: ScreebConfig);
7
+ private ensureScreeb;
8
+ /**
9
+ * Shutdowns current Screeb session.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * this.screeb.close();
14
+ * ```
15
+ */
16
+ close(): Promise<unknown>;
17
+ /**
18
+ * Prints the actual state information of Screeb tag.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * this.screeb.debug();
23
+ * // ******************* SCREEB SESSION DEBUG *********************
24
+ * // Screeb channel id: <UUID>
25
+ * // Screeb channel type: widget
26
+ * // Screeb respondent id: <UUID>
27
+ * // Screeb survey id: none
28
+ * // Screeb response id: none
29
+ * //
30
+ * // Screeb current session start: Thu May 04 2023 16:53:49 GMT+0200 (Central European Summer Time)
31
+ * // Screeb current session last activity: Thu May 04 2023 17:41:30 GMT+0200 (Central European Summer Time)
32
+ * //
33
+ * // Screeb targeting engine status: disabled
34
+ * // Screeb targeting engine: 3 surveys
35
+ * //
36
+ * // Detected platform: desktop
37
+ * // Detected locale: en-GB
38
+ * // Detected timezone: -120
39
+ * // **************************************************************
40
+ * ```
41
+ */
42
+ debug(): Promise<unknown>;
43
+ /**
44
+ * Tracks a user event.
45
+ *
46
+ * @param eventName The event name.
47
+ * @param eventProperties The properties of your event.
48
+ * ```text Requirements:
49
+ * - Property names must be limited to 128 characters
50
+ * - No more than 1000 attributes
51
+ * - Supported types for values: string, number, boolean and Date.
52
+ * ```
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * this.screeb.eventTrack(
57
+ * "Product added to cart",
58
+ * {
59
+ * product_name: 'Red bike 2021',
60
+ * category: 'sport',
61
+ * color: 'red',
62
+ * price: 299,
63
+ * count: 1,
64
+ * reference: '2CF093TG1',
65
+ * delivery_method: 'UPS',
66
+ * user_logged: false,
67
+ * added_at: new Date(),
68
+ * }
69
+ * );
70
+ * ```
71
+ */
72
+ eventTrack(eventName: string, eventProperties?: _Screeb.PropertyRecord): Promise<unknown>;
73
+ /**
74
+ * Change the current user identity.
75
+ * Warning: Running surveys will be closed.
76
+ *
77
+ * @param userId The unique identifier of your user.
78
+ * @param userProperties The properties of your user.
79
+ * ```text Requirements:
80
+ * - Property names must be limited to 128 characters
81
+ * - No more than 1000 attributes
82
+ * - Supported types for values: string, number, boolean and Date.
83
+ * ```
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * this.screeb.identity(
88
+ * "<your-user-id>",
89
+ * {
90
+ * firstname: '<user-firstname>',
91
+ * lastname: '<user-lastname>',
92
+ * plan: '<user-plan>',
93
+ * last_seen_at: new Date(),
94
+ * authenticated: true
95
+ * }
96
+ * );
97
+ * ```
98
+ */
99
+ identity(userId: string, userProperties?: _Screeb.PropertyRecord): Promise<unknown>;
100
+ /**
101
+ * Retrieves the current user identity.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * console.log(await this.screeb.identityGet());
106
+ * // {
107
+ * // anonymous_id: "<UUID>",
108
+ * // user_id: "<UUID>",
109
+ * // session_id: "<UUID>",
110
+ * // session_start: "2023-05-04T16:30:15.882Z",
111
+ * // session_end: "2023-05-04T17:02:09.087Z",
112
+ * // channel_id: "<UUID>",
113
+ * // is_ready: true,
114
+ * // }
115
+ * ```
116
+ */
117
+ identityGet(): Promise<_Screeb.ScreebIdentityGetReturn>;
118
+ /**
119
+ * Assigns the current user to a group.
120
+ *
121
+ * @param groupName
122
+ * @param groupType
123
+ * @param groupProperties The properties of your user group.
124
+ * ```text Requirements:
125
+ * - Property names must be limited to 128 characters
126
+ * - No more than 1000 attributes
127
+ * - Supported types for values: string, number, boolean and Date.
128
+ * ```
129
+ *
130
+ * @example
131
+ * ```ts
132
+ * this.screeb.identityGroupAssign(
133
+ * 'company',
134
+ * 'Apple',
135
+ * {
136
+ * address_line_1: 'Apple Campus',
137
+ * address_line_2: '1 Infinite Loop',
138
+ * city: 'Cupertino',
139
+ * zipcode: 95014,
140
+ * state: 'California',
141
+ * country: 'United states',
142
+ * }
143
+ * );
144
+ * ```
145
+ */
146
+ identityGroupAssign(groupName: string, groupType?: string, groupProperties?: _Screeb.PropertyRecord): Promise<unknown>;
147
+ /**
148
+ * Unassigns the current user to a group.
149
+ *
150
+ * @param groupName The name of your user group.
151
+ * @param groupType The type of your user group.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * this.screeb.identityGroupUnassign('company', 'Apple');
156
+ * ```
157
+ */
158
+ identityGroupUnassign(groupName: string, groupType?: string): Promise<unknown>;
159
+ /**
160
+ * Adds properties to the current user identity.
161
+ *
162
+ * @param userProperties The properties of your user.
163
+ * ```text Requirements:
164
+ * - Property names must be limited to 128 characters
165
+ * - No more than 1000 attributes
166
+ * - Supported types for values: string, number, boolean and Date.
167
+ * ```
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * // Set user properties
172
+ * this.screeb.identityProperties(
173
+ * {
174
+ * firstname: '<user-firstname>',
175
+ * lastname: '<user-lastname>',
176
+ * plan: '<user-plan>',
177
+ * last_seen_at: new Date(),
178
+ * authenticated: true
179
+ * }
180
+ * );
181
+ *
182
+ * // Delete user property : set values to null
183
+ * this.screeb.identityProperties(
184
+ * {
185
+ * age: null,
186
+ * company: null,
187
+ * logged: true,
188
+ * }
189
+ * );
190
+ * ```
191
+ */
192
+ identityProperties(userProperties: _Screeb.PropertyRecord): Promise<unknown>;
193
+ /**
194
+ * Resets the current user identity.
195
+ * Warning: This command must be called only once, since it creates a new identity on Screeb side.
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * this.screeb.identityReset();
200
+ * ```
201
+ */
202
+ identityReset(): Promise<unknown>;
203
+ /**
204
+ * Interrupts a running survey.
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * this.screeb.surveyClose();
209
+ * ```
210
+ */
211
+ surveyClose(): Promise<unknown>;
212
+ /**
213
+ * Starts a survey by its ID.
214
+ *
215
+ * @example
216
+ * ```ts
217
+ * this.screeb.surveyStart(
218
+ * '<UUID>',
219
+ * false,
220
+ * {
221
+ * color: "green",
222
+ * article_id: 42
223
+ * }
224
+ * );
225
+ * ```
226
+ */
227
+ surveyStart(surveyId: string, allowMultipleResponses: boolean, hiddenFields: _Screeb.PropertyRecord): Promise<unknown>;
228
+ /**
229
+ * Forces a targeting check.
230
+ *
231
+ * @example
232
+ * ```ts
233
+ * this.screeb.targetingCheck();
234
+ * ```
235
+ */
236
+ targetingCheck(): Promise<unknown>;
237
+ /**
238
+ * Prints the current state of the targeting engine.
239
+ *
240
+ * @example
241
+ * ```ts
242
+ * console.log(await this.screeb.targetingDebug());
243
+ * // targeting ************ SCREEB TARGETING RULES DEBUG **************
244
+ * // Disabled surveys are not listed here.
245
+ * //
246
+ * // Screeb channel id: <UUID>
247
+ * // Screeb respondent id: <UUID>
248
+ * //
249
+ * // Survey <UUID>:
250
+ * // https://admin.screeb.app/org/last/survey/<UUID>/share
251
+ * //
252
+ * // - Rule of type "Device type (desktop/mobile/tablet)": true 🟢
253
+ * // - Rule of type "Multiple display": true 🟢
254
+ * // - Rule of type "Capping per time between survey display on current respondent": true 🟢
255
+ * // - Rule of type "User event count": false 🔴
256
+ * // - Rule of type "Capping per respondent display count": false 🔴
257
+ * ```
258
+ */
259
+ targetingDebug(): Promise<unknown>;
260
+ /**
261
+ * Initializes Screeb tag.
262
+ *
263
+ * @param websiteId Your website/channel id.
264
+ * @param userId The unique identifier of your user.
265
+ * @param userProperties The properties of your user.
266
+ * ```text Requirements:
267
+ * - Property names must be limited to 128 characters
268
+ * - No more than 1000 attributes
269
+ * - Supported types for values: string, number, boolean and Date
270
+ * ```
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * this.screeb.init(
275
+ * "<your-website-id>",
276
+ * "<your-user-id>",
277
+ * {
278
+ * firstname: '<user-firstname>',
279
+ * lastname: '<user-lastname>',
280
+ * plan: '<user-plan>',
281
+ * last_seen_at: new Date(),
282
+ * authenticated: true
283
+ * }
284
+ * );
285
+ * ```
286
+ */
287
+ init(websiteId: string, userId?: string, userProperties?: _Screeb.PropertyRecord): Promise<unknown>;
288
+ /**
289
+ * Appends Screeb tag into your dom.
290
+ *
291
+ * @param options Screeb module options.
292
+ * @param options.window If you're running Screeb tag in an iframe, please set the inner window here.
293
+ * @param options.screebEndpoint Please don't do this.
294
+ *
295
+ * @example
296
+ * ```ts
297
+ * this.screeb.load();
298
+ * ```
299
+ */
300
+ load(): Promise<undefined>;
301
+ }
@@ -0,0 +1,27 @@
1
+ import { ModuleWithProviders } from "@angular/core";
2
+ import { Screeb } from "./screeb";
3
+ import { ScreebConfig } from "./screeb-config";
4
+ export declare class ScreebModule {
5
+ /**
6
+ * This is used to initialize Screeb at the top of your Angular application
7
+ * @param config Configuration to pass to Screeb browser SDK
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * ScreebModule.forRoot({
12
+ * autoInit: true,
13
+ * "<your-website-id>",
14
+ * "<your-user-id>",
15
+ * {
16
+ * firstname: '<user-firstname>',
17
+ * lastname: '<user-lastname>',
18
+ * plan: '<user-plan>',
19
+ * last_seen_at: new Date(),
20
+ * authenticated: true
21
+ * }
22
+ * })
23
+ * ```
24
+ */
25
+ static forRoot(config: ScreebConfig): ModuleWithProviders<ScreebModule>;
26
+ constructor(config: ScreebConfig, screeb: Screeb);
27
+ }
package/docs/.nojekyll ADDED
@@ -0,0 +1 @@
1
+ TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
package/docs/README.md ADDED
@@ -0,0 +1,11 @@
1
+ @screeb/sdk-angular
2
+
3
+ # @screeb/sdk-angular
4
+
5
+ ## Table of contents
6
+
7
+ ### Classes
8
+
9
+ - [Screeb](classes/Screeb.md)
10
+ - [ScreebConfig](classes/ScreebConfig.md)
11
+ - [ScreebModule](classes/ScreebModule.md)