@screeb/sdk-browser 0.1.16 → 0.1.18

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.
@@ -1,5 +1,38 @@
1
1
  'use strict';
2
2
 
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol */
18
+
19
+
20
+ var __assign = function() {
21
+ __assign = Object.assign || function __assign(t) {
22
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
23
+ s = arguments[i];
24
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
25
+ }
26
+ return t;
27
+ };
28
+ return __assign.apply(this, arguments);
29
+ };
30
+
31
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
32
+ var e = new Error(message);
33
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
34
+ };
35
+
3
36
  var SCREEB_TAG_ENDPOINT = "https://t.screeb.app/tag.js";
4
37
  var CONSTANTS = { version: "0.0.0-dev" };
5
38
  var _window = typeof window === "undefined" ? undefined : window;
@@ -81,6 +114,8 @@ var load = function (options) {
81
114
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
82
115
  * or when a question is replied.
83
116
  *
117
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
118
+ *
84
119
  * @example
85
120
  * ```ts
86
121
  * import * as Screeb from "@screeb/sdk-browser";
@@ -99,10 +134,11 @@ var load = function (options) {
99
134
  * version: "1.0.0",
100
135
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
101
136
  * },
137
+ * "en"
102
138
  * );
103
139
  * ```
104
140
  */
105
- var init = function (websiteId, userId, userProperties, hooks) {
141
+ var init = function (websiteId, userId, userProperties, hooks, language) {
106
142
  var identityObject;
107
143
  if (userId || userProperties) {
108
144
  identityObject = {
@@ -113,6 +149,9 @@ var init = function (websiteId, userId, userProperties, hooks) {
113
149
  },
114
150
  };
115
151
  }
152
+ if (language) {
153
+ identityObject = __assign(__assign({}, identityObject), { language: language });
154
+ }
116
155
  return callScreebCommand("init", websiteId, identityObject);
117
156
  };
118
157
  /**
@@ -382,14 +421,57 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
382
421
  * version: "1.0.0",
383
422
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
384
423
  * },
424
+ * "en"
385
425
  * );
386
426
  * ```
387
427
  */
388
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks) {
428
+ var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
389
429
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
390
430
  if (hiddenFields === void 0) { hiddenFields = {}; }
391
431
  return callScreebCommand("survey.start", surveyId, {
392
432
  allow_multiple_responses: allowMultipleResponses,
433
+ language: language,
434
+ hidden_fields: hiddenFields,
435
+ hooks: hooks,
436
+ });
437
+ };
438
+ /**
439
+ * Interrupts a running message.
440
+ *
441
+ * @example
442
+ * ```ts
443
+ * import * as Screeb from "@screeb/sdk-browser";
444
+ *
445
+ * Screeb.messageClose();
446
+ * ```
447
+ */
448
+ var messageClose = function () { return callScreebCommand("message.close"); };
449
+ /**
450
+ * Starts a message by its ID.
451
+ *
452
+ * @example
453
+ * ```ts
454
+ * import * as Screeb from "@screeb/sdk-browser";
455
+ *
456
+ * Screeb.messageStart(
457
+ * '<UUID>',
458
+ * false,
459
+ * {
460
+ * color: "green",
461
+ * article_id: 42
462
+ * },
463
+ * {
464
+ * version: "1.0.0",
465
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
466
+ * },
467
+ * "en"
468
+ * );
469
+ * ```
470
+ */
471
+ var messageStart = function (messageId, hiddenFields, hooks, language) {
472
+ if (hiddenFields === void 0) { hiddenFields = {}; }
473
+ return callScreebCommand("message.start", messageId, {
474
+ language: language,
393
475
  hidden_fields: hiddenFields,
394
476
  hooks: hooks,
395
477
  });
@@ -443,8 +525,10 @@ exports.identityReset = identityReset;
443
525
  exports.init = init;
444
526
  exports.isLoaded = isLoaded;
445
527
  exports.load = load;
528
+ exports.messageClose = messageClose;
529
+ exports.messageStart = messageStart;
446
530
  exports.surveyClose = surveyClose;
447
531
  exports.surveyStart = surveyStart;
448
532
  exports.targetingCheck = targetingCheck;
449
533
  exports.targetingDebug = targetingDebug;
450
- CONSTANTS.version = '0.1.16'
534
+ CONSTANTS.version = '0.1.18'
@@ -30,6 +30,8 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
30
30
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
31
31
  * or when a question is replied.
32
32
  *
33
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
34
+ *
33
35
  * @example
34
36
  * ```ts
35
37
  * import * as Screeb from "@screeb/sdk-browser";
@@ -48,10 +50,11 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
48
50
  * version: "1.0.0",
49
51
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
50
52
  * },
53
+ * "en"
51
54
  * );
52
55
  * ```
53
56
  */
54
- export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
57
+ export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
55
58
  /**
56
59
  * Checks if Screeb tag has been loaded.
57
60
  *
@@ -307,10 +310,45 @@ export declare const surveyClose: () => void | Promise<unknown>;
307
310
  * version: "1.0.0",
308
311
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
309
312
  * },
313
+ * "en"
314
+ * );
315
+ * ```
316
+ */
317
+ export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
+ /**
319
+ * Interrupts a running message.
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * import * as Screeb from "@screeb/sdk-browser";
324
+ *
325
+ * Screeb.messageClose();
326
+ * ```
327
+ */
328
+ export declare const messageClose: () => void | Promise<unknown>;
329
+ /**
330
+ * Starts a message by its ID.
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * import * as Screeb from "@screeb/sdk-browser";
335
+ *
336
+ * Screeb.messageStart(
337
+ * '<UUID>',
338
+ * false,
339
+ * {
340
+ * color: "green",
341
+ * article_id: 42
342
+ * },
343
+ * {
344
+ * version: "1.0.0",
345
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
346
+ * },
347
+ * "en"
310
348
  * );
311
349
  * ```
312
350
  */
313
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
351
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
314
352
  /**
315
353
  * Forces a targeting check.
316
354
  *
@@ -30,6 +30,8 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
30
30
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
31
31
  * or when a question is replied.
32
32
  *
33
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
34
+ *
33
35
  * @example
34
36
  * ```ts
35
37
  * import * as Screeb from "@screeb/sdk-browser";
@@ -48,10 +50,11 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
48
50
  * version: "1.0.0",
49
51
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
50
52
  * },
53
+ * "en"
51
54
  * );
52
55
  * ```
53
56
  */
54
- export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
57
+ export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
55
58
  /**
56
59
  * Checks if Screeb tag has been loaded.
57
60
  *
@@ -307,10 +310,45 @@ export declare const surveyClose: () => void | Promise<unknown>;
307
310
  * version: "1.0.0",
308
311
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
309
312
  * },
313
+ * "en"
314
+ * );
315
+ * ```
316
+ */
317
+ export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
318
+ /**
319
+ * Interrupts a running message.
320
+ *
321
+ * @example
322
+ * ```ts
323
+ * import * as Screeb from "@screeb/sdk-browser";
324
+ *
325
+ * Screeb.messageClose();
326
+ * ```
327
+ */
328
+ export declare const messageClose: () => void | Promise<unknown>;
329
+ /**
330
+ * Starts a message by its ID.
331
+ *
332
+ * @example
333
+ * ```ts
334
+ * import * as Screeb from "@screeb/sdk-browser";
335
+ *
336
+ * Screeb.messageStart(
337
+ * '<UUID>',
338
+ * false,
339
+ * {
340
+ * color: "green",
341
+ * article_id: 42
342
+ * },
343
+ * {
344
+ * version: "1.0.0",
345
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
346
+ * },
347
+ * "en"
310
348
  * );
311
349
  * ```
312
350
  */
313
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
351
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
314
352
  /**
315
353
  * Forces a targeting check.
316
354
  *
package/dist/es/index.mjs CHANGED
@@ -1,3 +1,36 @@
1
+ /******************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ /* global Reflect, Promise, SuppressedError, Symbol */
16
+
17
+
18
+ var __assign = function() {
19
+ __assign = Object.assign || function __assign(t) {
20
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
21
+ s = arguments[i];
22
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+
29
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
30
+ var e = new Error(message);
31
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
32
+ };
33
+
1
34
  var SCREEB_TAG_ENDPOINT = "https://t.screeb.app/tag.js";
2
35
  var CONSTANTS = { version: "0.0.0-dev" };
3
36
  var _window = typeof window === "undefined" ? undefined : window;
@@ -79,6 +112,8 @@ var load = function (options) {
79
112
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
80
113
  * or when a question is replied.
81
114
  *
115
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
116
+ *
82
117
  * @example
83
118
  * ```ts
84
119
  * import * as Screeb from "@screeb/sdk-browser";
@@ -97,10 +132,11 @@ var load = function (options) {
97
132
  * version: "1.0.0",
98
133
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
99
134
  * },
135
+ * "en"
100
136
  * );
101
137
  * ```
102
138
  */
103
- var init = function (websiteId, userId, userProperties, hooks) {
139
+ var init = function (websiteId, userId, userProperties, hooks, language) {
104
140
  var identityObject;
105
141
  if (userId || userProperties) {
106
142
  identityObject = {
@@ -111,6 +147,9 @@ var init = function (websiteId, userId, userProperties, hooks) {
111
147
  },
112
148
  };
113
149
  }
150
+ if (language) {
151
+ identityObject = __assign(__assign({}, identityObject), { language: language });
152
+ }
114
153
  return callScreebCommand("init", websiteId, identityObject);
115
154
  };
116
155
  /**
@@ -380,14 +419,57 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
380
419
  * version: "1.0.0",
381
420
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
382
421
  * },
422
+ * "en"
383
423
  * );
384
424
  * ```
385
425
  */
386
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks) {
426
+ var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
387
427
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
388
428
  if (hiddenFields === void 0) { hiddenFields = {}; }
389
429
  return callScreebCommand("survey.start", surveyId, {
390
430
  allow_multiple_responses: allowMultipleResponses,
431
+ language: language,
432
+ hidden_fields: hiddenFields,
433
+ hooks: hooks,
434
+ });
435
+ };
436
+ /**
437
+ * Interrupts a running message.
438
+ *
439
+ * @example
440
+ * ```ts
441
+ * import * as Screeb from "@screeb/sdk-browser";
442
+ *
443
+ * Screeb.messageClose();
444
+ * ```
445
+ */
446
+ var messageClose = function () { return callScreebCommand("message.close"); };
447
+ /**
448
+ * Starts a message by its ID.
449
+ *
450
+ * @example
451
+ * ```ts
452
+ * import * as Screeb from "@screeb/sdk-browser";
453
+ *
454
+ * Screeb.messageStart(
455
+ * '<UUID>',
456
+ * false,
457
+ * {
458
+ * color: "green",
459
+ * article_id: 42
460
+ * },
461
+ * {
462
+ * version: "1.0.0",
463
+ * onMessageShowed: (payload) => console.log("Message showed", payload),
464
+ * },
465
+ * "en"
466
+ * );
467
+ * ```
468
+ */
469
+ var messageStart = function (messageId, hiddenFields, hooks, language) {
470
+ if (hiddenFields === void 0) { hiddenFields = {}; }
471
+ return callScreebCommand("message.start", messageId, {
472
+ language: language,
391
473
  hidden_fields: hiddenFields,
392
474
  hooks: hooks,
393
475
  });
@@ -429,5 +511,5 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
429
511
  */
430
512
  var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
431
513
 
432
- export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug };
433
- CONSTANTS.version = '0.1.16'
514
+ export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, messageClose, messageStart, surveyClose, surveyStart, targetingCheck, targetingDebug };
515
+ CONSTANTS.version = '0.1.18'
package/docs/README.md CHANGED
@@ -46,6 +46,8 @@
46
46
  - [init](README.md#init)
47
47
  - [isLoaded](README.md#isloaded)
48
48
  - [load](README.md#load)
49
+ - [messageClose](README.md#messageclose)
50
+ - [messageStart](README.md#messagestart)
49
51
  - [surveyClose](README.md#surveyclose)
50
52
  - [surveyStart](README.md#surveystart)
51
53
  - [targetingCheck](README.md#targetingcheck)
@@ -88,7 +90,7 @@ ___
88
90
 
89
91
  ### HookOnQuestionReplied
90
92
 
91
- Ƭ **HookOnQuestionReplied**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } }) => `void`
93
+ Ƭ **HookOnQuestionReplied**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } }) => `void`
92
94
 
93
95
  #### Type declaration
94
96
 
@@ -98,7 +100,7 @@ ___
98
100
 
99
101
  | Name | Type |
100
102
  | :------ | :------ |
101
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } } |
103
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } } |
102
104
 
103
105
  ##### Returns
104
106
 
@@ -108,7 +110,7 @@ ___
108
110
 
109
111
  ### HookOnReady
110
112
 
111
- Ƭ **HookOnReady**: (`data`: { `channel`: [`Channel`](README.md#channel) ; `user`: [`User`](README.md#user) }) => `void`
113
+ Ƭ **HookOnReady**: (`data`: \{ `channel`: [`Channel`](README.md#channel) ; `user`: [`User`](README.md#user) }) => `void`
112
114
 
113
115
  #### Type declaration
114
116
 
@@ -130,7 +132,7 @@ ___
130
132
 
131
133
  ### HookOnSurveyCompleted
132
134
 
133
- Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
135
+ Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
134
136
 
135
137
  #### Type declaration
136
138
 
@@ -140,7 +142,7 @@ ___
140
142
 
141
143
  | Name | Type |
142
144
  | :------ | :------ |
143
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
145
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
144
146
 
145
147
  ##### Returns
146
148
 
@@ -150,7 +152,7 @@ ___
150
152
 
151
153
  ### HookOnSurveyHidden
152
154
 
153
- Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
155
+ Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
154
156
 
155
157
  #### Type declaration
156
158
 
@@ -160,7 +162,7 @@ ___
160
162
 
161
163
  | Name | Type |
162
164
  | :------ | :------ |
163
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
165
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
164
166
 
165
167
  ##### Returns
166
168
 
@@ -170,7 +172,7 @@ ___
170
172
 
171
173
  ### HookOnSurveyShowed
172
174
 
173
- Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
175
+ Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
174
176
 
175
177
  #### Type declaration
176
178
 
@@ -180,7 +182,7 @@ ___
180
182
 
181
183
  | Name | Type |
182
184
  | :------ | :------ |
183
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
185
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
184
186
 
185
187
  ##### Returns
186
188
 
@@ -190,7 +192,7 @@ ___
190
192
 
191
193
  ### HookOnSurveyStarted
192
194
 
193
- Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` } }) => `void`
195
+ Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } }) => `void`
194
196
 
195
197
  #### Type declaration
196
198
 
@@ -200,7 +202,7 @@ ___
200
202
 
201
203
  | Name | Type |
202
204
  | :------ | :------ |
203
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` } } |
205
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } } |
204
206
 
205
207
  ##### Returns
206
208
 
@@ -269,7 +271,7 @@ ___
269
271
 
270
272
  | Name | Type |
271
273
  | :------ | :------ |
272
- | `fields?` | { `boolean?`: `boolean` ; `number?`: `number` ; `text?`: `string` ; `time?`: `string` ; `type`: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"none"`` \| ``"time"`` \| ``"file"`` }[] |
274
+ | `fields?` | \{ `boolean?`: `boolean` ; `number?`: `number` ; `text?`: `string` ; `time?`: `string` ; `type`: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"none"`` \| ``"time"`` \| ``"file"`` }[] |
273
275
  | `replied_at?` | `string` |
274
276
 
275
277
  ___
@@ -297,11 +299,11 @@ ___
297
299
 
298
300
  ### ScreebFunction
299
301
 
300
- Ƭ **ScreebFunction**: (...`_`: `unknown`[]) => `void` \| `Promise`<`unknown`\>
302
+ Ƭ **ScreebFunction**: (...`_`: `unknown`[]) => `void` \| `Promise`\<`unknown`\>
301
303
 
302
304
  #### Type declaration
303
305
 
304
- ▸ (`..._`): `void` \| `Promise`<`unknown`\>
306
+ ▸ (`..._`): `void` \| `Promise`\<`unknown`\>
305
307
 
306
308
  ##### Parameters
307
309
 
@@ -311,7 +313,7 @@ ___
311
313
 
312
314
  ##### Returns
313
315
 
314
- `void` \| `Promise`<`unknown`\>
316
+ `void` \| `Promise`\<`unknown`\>
315
317
 
316
318
  ___
317
319
 
@@ -337,7 +339,7 @@ ___
337
339
 
338
340
  ### ScreebObject
339
341
 
340
- Ƭ **ScreebObject**: [`ScreebFunction`](README.md#screebfunction) & { `q?`: { `args`: `unknown`[] ; `ko`: (`reason?`: `unknown`) => `void` ; `ok`: (`value?`: `unknown`) => `void` ; `v`: `number` }[] }
342
+ Ƭ **ScreebObject**: [`ScreebFunction`](README.md#screebfunction) & \{ `q?`: \{ `args`: `unknown`[] ; `ko`: (`reason?`: `unknown`) => `void` ; `ok`: (`value?`: `unknown`) => `void` ; `v`: `number` }[] }
341
343
 
342
344
  This is the Screeb object publicly exposed in browser `window`.
343
345
 
@@ -408,13 +410,13 @@ ___
408
410
 
409
411
  ### close
410
412
 
411
- ▸ **close**(): `void` \| `Promise`<`unknown`\>
413
+ ▸ **close**(): `void` \| `Promise`\<`unknown`\>
412
414
 
413
415
  Shutdowns current Screeb session.
414
416
 
415
417
  #### Returns
416
418
 
417
- `void` \| `Promise`<`unknown`\>
419
+ `void` \| `Promise`\<`unknown`\>
418
420
 
419
421
  **`Example`**
420
422
 
@@ -428,13 +430,13 @@ ___
428
430
 
429
431
  ### debug
430
432
 
431
- ▸ **debug**(): `void` \| `Promise`<`unknown`\>
433
+ ▸ **debug**(): `void` \| `Promise`\<`unknown`\>
432
434
 
433
435
  Prints the actual state information of Screeb tag.
434
436
 
435
437
  #### Returns
436
438
 
437
- `void` \| `Promise`<`unknown`\>
439
+ `void` \| `Promise`\<`unknown`\>
438
440
 
439
441
  **`Example`**
440
442
 
@@ -465,7 +467,7 @@ ___
465
467
 
466
468
  ### eventTrack
467
469
 
468
- ▸ **eventTrack**(`eventName`, `eventProperties?`): `void` \| `Promise`<`unknown`\>
470
+ ▸ **eventTrack**(`eventName`, `eventProperties?`): `void` \| `Promise`\<`unknown`\>
469
471
 
470
472
  Tracks a user event.
471
473
 
@@ -478,7 +480,7 @@ Tracks a user event.
478
480
 
479
481
  #### Returns
480
482
 
481
- `void` \| `Promise`<`unknown`\>
483
+ `void` \| `Promise`\<`unknown`\>
482
484
 
483
485
  **`Example`**
484
486
 
@@ -505,7 +507,7 @@ ___
505
507
 
506
508
  ### identity
507
509
 
508
- ▸ **identity**(`userId`, `userProperties?`): `void` \| `Promise`<`unknown`\>
510
+ ▸ **identity**(`userId`, `userProperties?`): `void` \| `Promise`\<`unknown`\>
509
511
 
510
512
  Change the current user identity.
511
513
  Warning: Running surveys will be closed.
@@ -519,7 +521,7 @@ Warning: Running surveys will be closed.
519
521
 
520
522
  #### Returns
521
523
 
522
- `void` \| `Promise`<`unknown`\>
524
+ `void` \| `Promise`\<`unknown`\>
523
525
 
524
526
  **`Example`**
525
527
 
@@ -542,13 +544,13 @@ ___
542
544
 
543
545
  ### identityGet
544
546
 
545
- ▸ **identityGet**(): `Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
547
+ ▸ **identityGet**(): `Promise`\<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
546
548
 
547
549
  Retrieves the current user identity.
548
550
 
549
551
  #### Returns
550
552
 
551
- `Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
553
+ `Promise`\<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
552
554
 
553
555
  **`Example`**
554
556
 
@@ -571,7 +573,7 @@ ___
571
573
 
572
574
  ### identityGroupAssign
573
575
 
574
- ▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `void` \| `Promise`<`unknown`\>
576
+ ▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `void` \| `Promise`\<`unknown`\>
575
577
 
576
578
  Assigns the current user to a group.
577
579
 
@@ -585,7 +587,7 @@ Assigns the current user to a group.
585
587
 
586
588
  #### Returns
587
589
 
588
- `void` \| `Promise`<`unknown`\>
590
+ `void` \| `Promise`\<`unknown`\>
589
591
 
590
592
  **`Example`**
591
593
 
@@ -610,7 +612,7 @@ ___
610
612
 
611
613
  ### identityGroupUnassign
612
614
 
613
- ▸ **identityGroupUnassign**(`groupName`, `groupType?`): `void` \| `Promise`<`unknown`\>
615
+ ▸ **identityGroupUnassign**(`groupName`, `groupType?`): `void` \| `Promise`\<`unknown`\>
614
616
 
615
617
  Unassigns the current user to a group.
616
618
 
@@ -623,7 +625,7 @@ Unassigns the current user to a group.
623
625
 
624
626
  #### Returns
625
627
 
626
- `void` \| `Promise`<`unknown`\>
628
+ `void` \| `Promise`\<`unknown`\>
627
629
 
628
630
  **`Example`**
629
631
 
@@ -637,7 +639,7 @@ ___
637
639
 
638
640
  ### identityProperties
639
641
 
640
- ▸ **identityProperties**(`userProperties`): `void` \| `Promise`<`unknown`\>
642
+ ▸ **identityProperties**(`userProperties`): `void` \| `Promise`\<`unknown`\>
641
643
 
642
644
  Adds properties to the current user identity.
643
645
 
@@ -649,7 +651,7 @@ Adds properties to the current user identity.
649
651
 
650
652
  #### Returns
651
653
 
652
- `void` \| `Promise`<`unknown`\>
654
+ `void` \| `Promise`\<`unknown`\>
653
655
 
654
656
  **`Example`**
655
657
 
@@ -681,14 +683,14 @@ ___
681
683
 
682
684
  ### identityReset
683
685
 
684
- ▸ **identityReset**(): `void` \| `Promise`<`unknown`\>
686
+ ▸ **identityReset**(): `void` \| `Promise`\<`unknown`\>
685
687
 
686
688
  Resets the current user identity.
687
689
  Warning: This command must be called only once, since it creates a new identity on Screeb side.
688
690
 
689
691
  #### Returns
690
692
 
691
- `void` \| `Promise`<`unknown`\>
693
+ `void` \| `Promise`\<`unknown`\>
692
694
 
693
695
  **`Example`**
694
696
 
@@ -702,7 +704,7 @@ ___
702
704
 
703
705
  ### init
704
706
 
705
- ▸ **init**(`websiteId`, `userId?`, `userProperties?`, `hooks?`): `void` \| `Promise`<`unknown`\>
707
+ ▸ **init**(`websiteId`, `userId?`, `userProperties?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
706
708
 
707
709
  Initializes Screeb tag.
708
710
 
@@ -714,10 +716,11 @@ Initializes Screeb tag.
714
716
  | `userId?` | `string` | The unique identifier of your user. |
715
717
  | `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 ``` |
716
718
  | `hooks?` | [`Hooks`](README.md#hooks) | Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden or when a question is replied. |
719
+ | `language?` | `string` | Force a specific language for the tag. eg: 'en'. default: browser language. |
717
720
 
718
721
  #### Returns
719
722
 
720
- `void` \| `Promise`<`unknown`\>
723
+ `void` \| `Promise`\<`unknown`\>
721
724
 
722
725
  **`Example`**
723
726
 
@@ -738,6 +741,7 @@ Screeb.init(
738
741
  version: "1.0.0",
739
742
  onReady: (payload) => console.log("Screeb SDK is ready!", payload),
740
743
  },
744
+ "en"
741
745
  );
742
746
  ```
743
747
 
@@ -767,7 +771,7 @@ ___
767
771
 
768
772
  ### load
769
773
 
770
- ▸ **load**(`options?`): `Promise`<`undefined`\>
774
+ ▸ **load**(`options?`): `Promise`\<`undefined`\>
771
775
 
772
776
  Appends Screeb tag into your dom.
773
777
 
@@ -779,7 +783,7 @@ Appends Screeb tag into your dom.
779
783
 
780
784
  #### Returns
781
785
 
782
- `Promise`<`undefined`\>
786
+ `Promise`\<`undefined`\>
783
787
 
784
788
  **`Example`**
785
789
 
@@ -791,15 +795,76 @@ Screeb.load();
791
795
 
792
796
  ___
793
797
 
798
+ ### messageClose
799
+
800
+ ▸ **messageClose**(): `void` \| `Promise`\<`unknown`\>
801
+
802
+ Interrupts a running message.
803
+
804
+ #### Returns
805
+
806
+ `void` \| `Promise`\<`unknown`\>
807
+
808
+ **`Example`**
809
+
810
+ ```ts
811
+ import * as Screeb from "@screeb/sdk-browser";
812
+
813
+ Screeb.messageClose();
814
+ ```
815
+
816
+ ___
817
+
818
+ ### messageStart
819
+
820
+ ▸ **messageStart**(`messageId`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
821
+
822
+ Starts a message by its ID.
823
+
824
+ #### Parameters
825
+
826
+ | Name | Type |
827
+ | :------ | :------ |
828
+ | `messageId` | `string` |
829
+ | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) |
830
+ | `hooks?` | [`Hooks`](README.md#hooks) |
831
+ | `language?` | `string` |
832
+
833
+ #### Returns
834
+
835
+ `void` \| `Promise`\<`unknown`\>
836
+
837
+ **`Example`**
838
+
839
+ ```ts
840
+ import * as Screeb from "@screeb/sdk-browser";
841
+
842
+ Screeb.messageStart(
843
+ '<UUID>',
844
+ false,
845
+ {
846
+ color: "green",
847
+ article_id: 42
848
+ },
849
+ {
850
+ version: "1.0.0",
851
+ onMessageShowed: (payload) => console.log("Message showed", payload),
852
+ },
853
+ "en"
854
+ );
855
+ ```
856
+
857
+ ___
858
+
794
859
  ### surveyClose
795
860
 
796
- ▸ **surveyClose**(): `void` \| `Promise`<`unknown`\>
861
+ ▸ **surveyClose**(): `void` \| `Promise`\<`unknown`\>
797
862
 
798
863
  Interrupts a running survey.
799
864
 
800
865
  #### Returns
801
866
 
802
- `void` \| `Promise`<`unknown`\>
867
+ `void` \| `Promise`\<`unknown`\>
803
868
 
804
869
  **`Example`**
805
870
 
@@ -813,7 +878,7 @@ ___
813
878
 
814
879
  ### surveyStart
815
880
 
816
- ▸ **surveyStart**(`surveyId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`): `void` \| `Promise`<`unknown`\>
881
+ ▸ **surveyStart**(`surveyId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
817
882
 
818
883
  Starts a survey by its ID.
819
884
 
@@ -825,10 +890,11 @@ Starts a survey by its ID.
825
890
  | `allowMultipleResponses` | `boolean` | `true` |
826
891
  | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) | `{}` |
827
892
  | `hooks?` | [`Hooks`](README.md#hooks) | `undefined` |
893
+ | `language?` | `string` | `undefined` |
828
894
 
829
895
  #### Returns
830
896
 
831
- `void` \| `Promise`<`unknown`\>
897
+ `void` \| `Promise`\<`unknown`\>
832
898
 
833
899
  **`Example`**
834
900
 
@@ -846,6 +912,7 @@ Screeb.surveyStart(
846
912
  version: "1.0.0",
847
913
  onSurveyShowed: (payload) => console.log("Survey showed", payload),
848
914
  },
915
+ "en"
849
916
  );
850
917
  ```
851
918
 
@@ -853,13 +920,13 @@ ___
853
920
 
854
921
  ### targetingCheck
855
922
 
856
- ▸ **targetingCheck**(): `void` \| `Promise`<`unknown`\>
923
+ ▸ **targetingCheck**(): `void` \| `Promise`\<`unknown`\>
857
924
 
858
925
  Forces a targeting check.
859
926
 
860
927
  #### Returns
861
928
 
862
- `void` \| `Promise`<`unknown`\>
929
+ `void` \| `Promise`\<`unknown`\>
863
930
 
864
931
  **`Example`**
865
932
 
@@ -873,13 +940,13 @@ ___
873
940
 
874
941
  ### targetingDebug
875
942
 
876
- ▸ **targetingDebug**(): `void` \| `Promise`<`unknown`\>
943
+ ▸ **targetingDebug**(): `void` \| `Promise`\<`unknown`\>
877
944
 
878
945
  Prints the current state of the targeting engine.
879
946
 
880
947
  #### Returns
881
948
 
882
- `void` \| `Promise`<`unknown`\>
949
+ `void` \| `Promise`\<`unknown`\>
883
950
 
884
951
  **`Example`**
885
952
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",