@screeb/sdk-browser 0.1.15 → 0.1.17

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;
@@ -37,6 +70,9 @@ var load = function (options) {
37
70
  scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
38
71
  scriptElement.addEventListener("load", function () { return resolve(undefined); });
39
72
  scriptElement.addEventListener("error", reject);
73
+ if (options.platform) {
74
+ _window["ScreebConfig"] = { platform: options.platform };
75
+ }
40
76
  _window.$screeb =
41
77
  (_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
42
78
  var args = [];
@@ -78,6 +114,8 @@ var load = function (options) {
78
114
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
79
115
  * or when a question is replied.
80
116
  *
117
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
118
+ *
81
119
  * @example
82
120
  * ```ts
83
121
  * import * as Screeb from "@screeb/sdk-browser";
@@ -96,10 +134,11 @@ var load = function (options) {
96
134
  * version: "1.0.0",
97
135
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
98
136
  * },
137
+ * "en"
99
138
  * );
100
139
  * ```
101
140
  */
102
- var init = function (websiteId, userId, userProperties, hooks) {
141
+ var init = function (websiteId, userId, userProperties, hooks, language) {
103
142
  var identityObject;
104
143
  if (userId || userProperties) {
105
144
  identityObject = {
@@ -110,6 +149,9 @@ var init = function (websiteId, userId, userProperties, hooks) {
110
149
  },
111
150
  };
112
151
  }
152
+ if (language) {
153
+ identityObject = __assign(__assign({}, identityObject), { language: language });
154
+ }
113
155
  return callScreebCommand("init", websiteId, identityObject);
114
156
  };
115
157
  /**
@@ -379,14 +421,16 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
379
421
  * version: "1.0.0",
380
422
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
381
423
  * },
424
+ * "en"
382
425
  * );
383
426
  * ```
384
427
  */
385
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks) {
428
+ var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
386
429
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
387
430
  if (hiddenFields === void 0) { hiddenFields = {}; }
388
431
  return callScreebCommand("survey.start", surveyId, {
389
432
  allow_multiple_responses: allowMultipleResponses,
433
+ language: language,
390
434
  hidden_fields: hiddenFields,
391
435
  hooks: hooks,
392
436
  });
@@ -444,4 +488,4 @@ exports.surveyClose = surveyClose;
444
488
  exports.surveyStart = surveyStart;
445
489
  exports.targetingCheck = targetingCheck;
446
490
  exports.targetingDebug = targetingDebug;
447
- CONSTANTS.version = '0.1.15'
491
+ CONSTANTS.version = '0.1.17'
@@ -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,11 @@ 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"
310
314
  * );
311
315
  * ```
312
316
  */
313
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
317
+ export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
314
318
  /**
315
319
  * Forces a targeting check.
316
320
  *
@@ -15,6 +15,8 @@ export type ScreebOptions = {
15
15
  sdkVersion?: string;
16
16
  /** Please don't do this. */
17
17
  screebEndpoint?: string;
18
+ /** @hidden Use a specific platform */
19
+ platform?: string;
18
20
  };
19
21
  export type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>;
20
22
  /** This is the Screeb object publicly exposed in browser `window`. */
@@ -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,11 @@ 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"
310
314
  * );
311
315
  * ```
312
316
  */
313
- export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks) => void | Promise<unknown>;
317
+ export declare const surveyStart: (surveyId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
314
318
  /**
315
319
  * Forces a targeting check.
316
320
  *
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;
@@ -35,6 +68,9 @@ var load = function (options) {
35
68
  scriptElement.src = (_b = options.screebEndpoint) !== null && _b !== void 0 ? _b : SCREEB_TAG_ENDPOINT;
36
69
  scriptElement.addEventListener("load", function () { return resolve(undefined); });
37
70
  scriptElement.addEventListener("error", reject);
71
+ if (options.platform) {
72
+ _window["ScreebConfig"] = { platform: options.platform };
73
+ }
38
74
  _window.$screeb =
39
75
  (_c = _window.$screeb) !== null && _c !== void 0 ? _c : function () {
40
76
  var args = [];
@@ -76,6 +112,8 @@ var load = function (options) {
76
112
  * @param hooks Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden
77
113
  * or when a question is replied.
78
114
  *
115
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
116
+ *
79
117
  * @example
80
118
  * ```ts
81
119
  * import * as Screeb from "@screeb/sdk-browser";
@@ -94,10 +132,11 @@ var load = function (options) {
94
132
  * version: "1.0.0",
95
133
  * onReady: (payload) => console.log("Screeb SDK is ready!", payload),
96
134
  * },
135
+ * "en"
97
136
  * );
98
137
  * ```
99
138
  */
100
- var init = function (websiteId, userId, userProperties, hooks) {
139
+ var init = function (websiteId, userId, userProperties, hooks, language) {
101
140
  var identityObject;
102
141
  if (userId || userProperties) {
103
142
  identityObject = {
@@ -108,6 +147,9 @@ var init = function (websiteId, userId, userProperties, hooks) {
108
147
  },
109
148
  };
110
149
  }
150
+ if (language) {
151
+ identityObject = __assign(__assign({}, identityObject), { language: language });
152
+ }
111
153
  return callScreebCommand("init", websiteId, identityObject);
112
154
  };
113
155
  /**
@@ -377,14 +419,16 @@ var surveyClose = function () { return callScreebCommand("survey.close"); };
377
419
  * version: "1.0.0",
378
420
  * onSurveyShowed: (payload) => console.log("Survey showed", payload),
379
421
  * },
422
+ * "en"
380
423
  * );
381
424
  * ```
382
425
  */
383
- var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks) {
426
+ var surveyStart = function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) {
384
427
  if (allowMultipleResponses === void 0) { allowMultipleResponses = true; }
385
428
  if (hiddenFields === void 0) { hiddenFields = {}; }
386
429
  return callScreebCommand("survey.start", surveyId, {
387
430
  allow_multiple_responses: allowMultipleResponses,
431
+ language: language,
388
432
  hidden_fields: hiddenFields,
389
433
  hooks: hooks,
390
434
  });
@@ -427,4 +471,4 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
427
471
  var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
428
472
 
429
473
  export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, surveyClose, surveyStart, targetingCheck, targetingDebug };
430
- CONSTANTS.version = '0.1.15'
474
+ CONSTANTS.version = '0.1.17'
@@ -15,6 +15,8 @@ export type ScreebOptions = {
15
15
  sdkVersion?: string;
16
16
  /** Please don't do this. */
17
17
  screebEndpoint?: string;
18
+ /** @hidden Use a specific platform */
19
+ platform?: string;
18
20
  };
19
21
  export type ScreebFunction = (..._: unknown[]) => void | Promise<unknown>;
20
22
  /** This is the Screeb object publicly exposed in browser `window`. */
package/docs/README.md CHANGED
@@ -88,7 +88,7 @@ ___
88
88
 
89
89
  ### HookOnQuestionReplied
90
90
 
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`
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`
92
92
 
93
93
  #### Type declaration
94
94
 
@@ -98,7 +98,7 @@ ___
98
98
 
99
99
  | Name | Type |
100
100
  | :------ | :------ |
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`` } } |
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`` } } |
102
102
 
103
103
  ##### Returns
104
104
 
@@ -108,7 +108,7 @@ ___
108
108
 
109
109
  ### HookOnReady
110
110
 
111
- Ƭ **HookOnReady**: (`data`: { `channel`: [`Channel`](README.md#channel) ; `user`: [`User`](README.md#user) }) => `void`
111
+ Ƭ **HookOnReady**: (`data`: \{ `channel`: [`Channel`](README.md#channel) ; `user`: [`User`](README.md#user) }) => `void`
112
112
 
113
113
  #### Type declaration
114
114
 
@@ -130,7 +130,7 @@ ___
130
130
 
131
131
  ### HookOnSurveyCompleted
132
132
 
133
- Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
133
+ Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
134
134
 
135
135
  #### Type declaration
136
136
 
@@ -140,7 +140,7 @@ ___
140
140
 
141
141
  | Name | Type |
142
142
  | :------ | :------ |
143
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
143
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
144
144
 
145
145
  ##### Returns
146
146
 
@@ -150,7 +150,7 @@ ___
150
150
 
151
151
  ### HookOnSurveyHidden
152
152
 
153
- Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
153
+ Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
154
154
 
155
155
  #### Type declaration
156
156
 
@@ -160,7 +160,7 @@ ___
160
160
 
161
161
  | Name | Type |
162
162
  | :------ | :------ |
163
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
163
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
164
164
 
165
165
  ##### Returns
166
166
 
@@ -170,7 +170,7 @@ ___
170
170
 
171
171
  ### HookOnSurveyShowed
172
172
 
173
- Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
173
+ Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
174
174
 
175
175
  #### Type declaration
176
176
 
@@ -180,7 +180,7 @@ ___
180
180
 
181
181
  | Name | Type |
182
182
  | :------ | :------ |
183
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
183
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
184
184
 
185
185
  ##### Returns
186
186
 
@@ -190,7 +190,7 @@ ___
190
190
 
191
191
  ### HookOnSurveyStarted
192
192
 
193
- Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` } }) => `void`
193
+ Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } }) => `void`
194
194
 
195
195
  #### Type declaration
196
196
 
@@ -200,7 +200,7 @@ ___
200
200
 
201
201
  | Name | Type |
202
202
  | :------ | :------ |
203
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & { `response`: { `id`: `string` } } |
203
+ | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } } |
204
204
 
205
205
  ##### Returns
206
206
 
@@ -269,7 +269,7 @@ ___
269
269
 
270
270
  | Name | Type |
271
271
  | :------ | :------ |
272
- | `fields?` | { `boolean?`: `boolean` ; `number?`: `number` ; `text?`: `string` ; `time?`: `string` ; `type`: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"none"`` \| ``"time"`` \| ``"file"`` }[] |
272
+ | `fields?` | \{ `boolean?`: `boolean` ; `number?`: `number` ; `text?`: `string` ; `time?`: `string` ; `type`: ``"string"`` \| ``"number"`` \| ``"boolean"`` \| ``"none"`` \| ``"time"`` \| ``"file"`` }[] |
273
273
  | `replied_at?` | `string` |
274
274
 
275
275
  ___
@@ -297,11 +297,11 @@ ___
297
297
 
298
298
  ### ScreebFunction
299
299
 
300
- Ƭ **ScreebFunction**: (...`_`: `unknown`[]) => `void` \| `Promise`<`unknown`\>
300
+ Ƭ **ScreebFunction**: (...`_`: `unknown`[]) => `void` \| `Promise`\<`unknown`\>
301
301
 
302
302
  #### Type declaration
303
303
 
304
- ▸ (`..._`): `void` \| `Promise`<`unknown`\>
304
+ ▸ (`..._`): `void` \| `Promise`\<`unknown`\>
305
305
 
306
306
  ##### Parameters
307
307
 
@@ -311,7 +311,7 @@ ___
311
311
 
312
312
  ##### Returns
313
313
 
314
- `void` \| `Promise`<`unknown`\>
314
+ `void` \| `Promise`\<`unknown`\>
315
315
 
316
316
  ___
317
317
 
@@ -337,7 +337,7 @@ ___
337
337
 
338
338
  ### ScreebObject
339
339
 
340
- Ƭ **ScreebObject**: [`ScreebFunction`](README.md#screebfunction) & { `q?`: { `args`: `unknown`[] ; `ko`: (`reason?`: `unknown`) => `void` ; `ok`: (`value?`: `unknown`) => `void` ; `v`: `number` }[] }
340
+ Ƭ **ScreebObject**: [`ScreebFunction`](README.md#screebfunction) & \{ `q?`: \{ `args`: `unknown`[] ; `ko`: (`reason?`: `unknown`) => `void` ; `ok`: (`value?`: `unknown`) => `void` ; `v`: `number` }[] }
341
341
 
342
342
  This is the Screeb object publicly exposed in browser `window`.
343
343
 
@@ -408,13 +408,13 @@ ___
408
408
 
409
409
  ### close
410
410
 
411
- ▸ **close**(): `void` \| `Promise`<`unknown`\>
411
+ ▸ **close**(): `void` \| `Promise`\<`unknown`\>
412
412
 
413
413
  Shutdowns current Screeb session.
414
414
 
415
415
  #### Returns
416
416
 
417
- `void` \| `Promise`<`unknown`\>
417
+ `void` \| `Promise`\<`unknown`\>
418
418
 
419
419
  **`Example`**
420
420
 
@@ -428,13 +428,13 @@ ___
428
428
 
429
429
  ### debug
430
430
 
431
- ▸ **debug**(): `void` \| `Promise`<`unknown`\>
431
+ ▸ **debug**(): `void` \| `Promise`\<`unknown`\>
432
432
 
433
433
  Prints the actual state information of Screeb tag.
434
434
 
435
435
  #### Returns
436
436
 
437
- `void` \| `Promise`<`unknown`\>
437
+ `void` \| `Promise`\<`unknown`\>
438
438
 
439
439
  **`Example`**
440
440
 
@@ -465,7 +465,7 @@ ___
465
465
 
466
466
  ### eventTrack
467
467
 
468
- ▸ **eventTrack**(`eventName`, `eventProperties?`): `void` \| `Promise`<`unknown`\>
468
+ ▸ **eventTrack**(`eventName`, `eventProperties?`): `void` \| `Promise`\<`unknown`\>
469
469
 
470
470
  Tracks a user event.
471
471
 
@@ -478,7 +478,7 @@ Tracks a user event.
478
478
 
479
479
  #### Returns
480
480
 
481
- `void` \| `Promise`<`unknown`\>
481
+ `void` \| `Promise`\<`unknown`\>
482
482
 
483
483
  **`Example`**
484
484
 
@@ -505,7 +505,7 @@ ___
505
505
 
506
506
  ### identity
507
507
 
508
- ▸ **identity**(`userId`, `userProperties?`): `void` \| `Promise`<`unknown`\>
508
+ ▸ **identity**(`userId`, `userProperties?`): `void` \| `Promise`\<`unknown`\>
509
509
 
510
510
  Change the current user identity.
511
511
  Warning: Running surveys will be closed.
@@ -519,7 +519,7 @@ Warning: Running surveys will be closed.
519
519
 
520
520
  #### Returns
521
521
 
522
- `void` \| `Promise`<`unknown`\>
522
+ `void` \| `Promise`\<`unknown`\>
523
523
 
524
524
  **`Example`**
525
525
 
@@ -542,13 +542,13 @@ ___
542
542
 
543
543
  ### identityGet
544
544
 
545
- ▸ **identityGet**(): `Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
545
+ ▸ **identityGet**(): `Promise`\<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
546
546
 
547
547
  Retrieves the current user identity.
548
548
 
549
549
  #### Returns
550
550
 
551
- `Promise`<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
551
+ `Promise`\<[`ScreebIdentityGetReturn`](README.md#screebidentitygetreturn)\>
552
552
 
553
553
  **`Example`**
554
554
 
@@ -571,7 +571,7 @@ ___
571
571
 
572
572
  ### identityGroupAssign
573
573
 
574
- ▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `void` \| `Promise`<`unknown`\>
574
+ ▸ **identityGroupAssign**(`groupName`, `groupType?`, `groupProperties?`): `void` \| `Promise`\<`unknown`\>
575
575
 
576
576
  Assigns the current user to a group.
577
577
 
@@ -585,7 +585,7 @@ Assigns the current user to a group.
585
585
 
586
586
  #### Returns
587
587
 
588
- `void` \| `Promise`<`unknown`\>
588
+ `void` \| `Promise`\<`unknown`\>
589
589
 
590
590
  **`Example`**
591
591
 
@@ -610,7 +610,7 @@ ___
610
610
 
611
611
  ### identityGroupUnassign
612
612
 
613
- ▸ **identityGroupUnassign**(`groupName`, `groupType?`): `void` \| `Promise`<`unknown`\>
613
+ ▸ **identityGroupUnassign**(`groupName`, `groupType?`): `void` \| `Promise`\<`unknown`\>
614
614
 
615
615
  Unassigns the current user to a group.
616
616
 
@@ -623,7 +623,7 @@ Unassigns the current user to a group.
623
623
 
624
624
  #### Returns
625
625
 
626
- `void` \| `Promise`<`unknown`\>
626
+ `void` \| `Promise`\<`unknown`\>
627
627
 
628
628
  **`Example`**
629
629
 
@@ -637,7 +637,7 @@ ___
637
637
 
638
638
  ### identityProperties
639
639
 
640
- ▸ **identityProperties**(`userProperties`): `void` \| `Promise`<`unknown`\>
640
+ ▸ **identityProperties**(`userProperties`): `void` \| `Promise`\<`unknown`\>
641
641
 
642
642
  Adds properties to the current user identity.
643
643
 
@@ -649,7 +649,7 @@ Adds properties to the current user identity.
649
649
 
650
650
  #### Returns
651
651
 
652
- `void` \| `Promise`<`unknown`\>
652
+ `void` \| `Promise`\<`unknown`\>
653
653
 
654
654
  **`Example`**
655
655
 
@@ -681,14 +681,14 @@ ___
681
681
 
682
682
  ### identityReset
683
683
 
684
- ▸ **identityReset**(): `void` \| `Promise`<`unknown`\>
684
+ ▸ **identityReset**(): `void` \| `Promise`\<`unknown`\>
685
685
 
686
686
  Resets the current user identity.
687
687
  Warning: This command must be called only once, since it creates a new identity on Screeb side.
688
688
 
689
689
  #### Returns
690
690
 
691
- `void` \| `Promise`<`unknown`\>
691
+ `void` \| `Promise`\<`unknown`\>
692
692
 
693
693
  **`Example`**
694
694
 
@@ -702,7 +702,7 @@ ___
702
702
 
703
703
  ### init
704
704
 
705
- ▸ **init**(`websiteId`, `userId?`, `userProperties?`, `hooks?`): `void` \| `Promise`<`unknown`\>
705
+ ▸ **init**(`websiteId`, `userId?`, `userProperties?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
706
706
 
707
707
  Initializes Screeb tag.
708
708
 
@@ -714,10 +714,11 @@ Initializes Screeb tag.
714
714
  | `userId?` | `string` | The unique identifier of your user. |
715
715
  | `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
716
  | `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. |
717
+ | `language?` | `string` | Force a specific language for the tag. eg: 'en'. default: browser language. |
717
718
 
718
719
  #### Returns
719
720
 
720
- `void` \| `Promise`<`unknown`\>
721
+ `void` \| `Promise`\<`unknown`\>
721
722
 
722
723
  **`Example`**
723
724
 
@@ -738,6 +739,7 @@ Screeb.init(
738
739
  version: "1.0.0",
739
740
  onReady: (payload) => console.log("Screeb SDK is ready!", payload),
740
741
  },
742
+ "en"
741
743
  );
742
744
  ```
743
745
 
@@ -767,7 +769,7 @@ ___
767
769
 
768
770
  ### load
769
771
 
770
- ▸ **load**(`options?`): `Promise`<`undefined`\>
772
+ ▸ **load**(`options?`): `Promise`\<`undefined`\>
771
773
 
772
774
  Appends Screeb tag into your dom.
773
775
 
@@ -779,7 +781,7 @@ Appends Screeb tag into your dom.
779
781
 
780
782
  #### Returns
781
783
 
782
- `Promise`<`undefined`\>
784
+ `Promise`\<`undefined`\>
783
785
 
784
786
  **`Example`**
785
787
 
@@ -793,13 +795,13 @@ ___
793
795
 
794
796
  ### surveyClose
795
797
 
796
- ▸ **surveyClose**(): `void` \| `Promise`<`unknown`\>
798
+ ▸ **surveyClose**(): `void` \| `Promise`\<`unknown`\>
797
799
 
798
800
  Interrupts a running survey.
799
801
 
800
802
  #### Returns
801
803
 
802
- `void` \| `Promise`<`unknown`\>
804
+ `void` \| `Promise`\<`unknown`\>
803
805
 
804
806
  **`Example`**
805
807
 
@@ -813,7 +815,7 @@ ___
813
815
 
814
816
  ### surveyStart
815
817
 
816
- ▸ **surveyStart**(`surveyId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`): `void` \| `Promise`<`unknown`\>
818
+ ▸ **surveyStart**(`surveyId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
817
819
 
818
820
  Starts a survey by its ID.
819
821
 
@@ -825,10 +827,11 @@ Starts a survey by its ID.
825
827
  | `allowMultipleResponses` | `boolean` | `true` |
826
828
  | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) | `{}` |
827
829
  | `hooks?` | [`Hooks`](README.md#hooks) | `undefined` |
830
+ | `language?` | `string` | `undefined` |
828
831
 
829
832
  #### Returns
830
833
 
831
- `void` \| `Promise`<`unknown`\>
834
+ `void` \| `Promise`\<`unknown`\>
832
835
 
833
836
  **`Example`**
834
837
 
@@ -846,6 +849,7 @@ Screeb.surveyStart(
846
849
  version: "1.0.0",
847
850
  onSurveyShowed: (payload) => console.log("Survey showed", payload),
848
851
  },
852
+ "en"
849
853
  );
850
854
  ```
851
855
 
@@ -853,13 +857,13 @@ ___
853
857
 
854
858
  ### targetingCheck
855
859
 
856
- ▸ **targetingCheck**(): `void` \| `Promise`<`unknown`\>
860
+ ▸ **targetingCheck**(): `void` \| `Promise`\<`unknown`\>
857
861
 
858
862
  Forces a targeting check.
859
863
 
860
864
  #### Returns
861
865
 
862
- `void` \| `Promise`<`unknown`\>
866
+ `void` \| `Promise`\<`unknown`\>
863
867
 
864
868
  **`Example`**
865
869
 
@@ -873,13 +877,13 @@ ___
873
877
 
874
878
  ### targetingDebug
875
879
 
876
- ▸ **targetingDebug**(): `void` \| `Promise`<`unknown`\>
880
+ ▸ **targetingDebug**(): `void` \| `Promise`\<`unknown`\>
877
881
 
878
882
  Prints the current state of the targeting engine.
879
883
 
880
884
  #### Returns
881
885
 
882
- `void` \| `Promise`<`unknown`\>
886
+ `void` \| `Promise`\<`unknown`\>
883
887
 
884
888
  **`Example`**
885
889
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -0,0 +1,15 @@
1
+ <svg width="773" height="366" viewBox="0 0 773 366" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_201_47)">
3
+ <path fill-rule="evenodd" clip-rule="evenodd"
4
+ d="M711.7 197.1C714.6 194.1 717.2 191.1 719.7 187.9C750.7 201 772.5 230.9 772.4 266.5V364.7L684.5 365.3H606.7C558.6 365.3 520.5 325.3 520.5 277.1C520.5 261.5 524.5 245.9 531.5 232H630.4C661.2 232 690.1 219.5 711.7 197.1ZM600.2 292.8C609.1 292.8 616.1 285.6 616.1 276.9C616.1 268.4 609 261.2 600.2 261.2C591.5 261.2 584.5 268.4 584.5 276.9C584.5 285.6 591.5 292.8 600.2 292.8ZM645.5 292.8C654.4 292.8 661.4 285.6 661.4 276.9C661.4 268.4 654.4 261.2 645.5 261.2C636.8 261.2 629.8 268.4 629.8 276.9C629.8 285.6 636.8 292.8 645.5 292.8ZM690.9 292.8C699.8 292.8 706.8 285.6 706.8 276.9C706.8 268.4 699.7 261.2 690.9 261.2C682.2 261.2 675.2 268.4 675.2 276.9C675.2 285.6 682.2 292.8 690.9 292.8Z"
5
+ fill="#5e21f1" />
6
+ <path fill-rule="evenodd" clip-rule="evenodd"
7
+ d="M626.5 213C682 213 725.9 166.6 725.9 111.1C725.9 55.6 682 0 626.4 0H102.7C47.2 0 0 42.7 0 98.3V211.8L102.7 213H626.5ZM98.8 147.6C98.8 151.7 100.9 155.4 103.8 157.5C117.2 167.1 133.1 171.9 148.6 171.7C174.4 171.7 192.5 158.4 192.5 134.6V134.3C192.5 113.4 178.9 104.7 154.6 98.4C133.9 93.1 128.8 90.6 128.8 82.7V82.4C128.8 76.6 134.1 72 144.2 72C152.4 72 160.6 74.9 169.3 80C171.4 81.2 173.4 81.9 176 81.9C182.8 81.9 188.3 76.6 188.3 69.8C188.3 64.7 185.4 61.1 182.5 59.4C171.8 52.6 159.1 48.8 144.6 48.8C120.1 48.8 102.7 63.2 102.7 84.9V85.2C102.7 109 118.3 115.6 142.4 121.8C162.4 126.9 166.5 130.3 166.5 137V137.4C166.5 144.4 160 148.7 149.2 148.7C137.6 148.7 127.7 144.6 118.6 137.9C116.9 136.7 114.5 135.5 111.1 135.5C104.3 135.5 98.8 140.8 98.8 147.6ZM200.8 124.9V124.6C200.8 98.4 220.8 76.9 248.8 76.9C262.6 76.9 272.4 80.7 280.1 87.2C281.8 88.6 284.2 91.6 284.2 96.1C284.2 102.6 278.9 107.7 272.4 107.7C269 107.7 266.4 106.3 264.9 105.1C260.3 101.5 255.5 99.3 248.7 99.3C235.7 99.3 226.5 110.8 226.5 124.3V124.6C226.5 138.6 235.6 149.9 249.7 149.9C256.5 149.9 261.8 147.5 266.8 143.6C268.2 142.6 270.7 141.2 273.8 141.2C280 141.2 284.7 146.2 284.7 152.3C284.7 155.7 283.2 158.5 280.9 160.5C273.2 167.5 263.5 172.3 248.4 172.3C220.9 172.2 200.8 151.1 200.8 124.9ZM308.1 77.5C300.9 77.5 295.1 83.3 295.1 90.5V158.1C295.1 165.3 300.9 171.1 308.1 171.1C315.3 171.1 321.1 165.3 321.1 158.1V133.8C321.1 115.4 328.4 105.3 341.6 102.2C346.9 101 351.3 96.9 351.3 90.1C351.3 82.8 346.7 77.5 338.7 77.5C331 77.5 324.9 85.7 321.1 94.6V90.5C321.1 83.3 315.3 77.5 308.1 77.5ZM521.3 121C521.3 102 507.8 76.9 477.2 76.9C458.9 76.9 444.3 87.1 437 101.9C430.9 88.5 418 76.9 397.2 76.9C370.5 76.9 351.9 98.4 351.9 124.6V124.9C351.9 152.9 372.2 172.3 399.8 172.3C413.1 172.3 423.6 168 431.6 161.2C433.5 159.5 435 156.9 435 153.5C435 147.7 430.7 143.2 424.9 143.2C422.2 143.2 420.5 143.9 418.6 145.3C413.3 149.2 407.3 151.5 400.1 151.5C388.5 151.5 380.3 145.3 377.7 133.6H432.561C436.215 156.976 455.14 172.4 479.8 172.4C493.1 172.4 503.6 168.1 511.6 161.3C513.5 159.6 515 157 515 153.6C515 147.8 510.7 143.3 504.9 143.3C502.2 143.3 500.5 144 498.6 145.4C493.3 149.3 487.3 151.6 480.1 151.6C468.5 151.6 460.3 145.4 457.7 133.7H509.2C516 133.4 521.3 128.5 521.3 121ZM432.5 133.2L432.522 133.349C432.308 133.302 432.246 133.251 432.5 133.2ZM377.4 117.2C379.5 105.4 386.5 97.7 397.2 97.7C408.1 97.7 415 105.6 416.5 117.2H377.4ZM457.4 117.2C459.5 105.4 466.5 97.7 477.2 97.7C488.1 97.7 495 105.6 496.5 117.2H457.4ZM546.4 44.4C539.2 44.4 533.4 50.2 533.4 57.4V158.3C533.4 165.5 539.2 171.3 546.4 171.3C553.6 171.3 559.4 165.5 559.4 158.5V158.3C565.5 165.7 574.1 172 587.9 172C609.6 172 629.6 155.2 629.6 124.6V124.3C629.6 93.7 609.3 76.9 587.9 76.9C574.4 76.9 565.7 83.3 559.4 91.8V57.4C559.4 50.2 553.6 44.4 546.4 44.4ZM603.7 124.3V124.6C603.7 139.9 593.4 149.9 581.3 149.9C569.2 149.9 559.1 139.8 559.1 124.6V124.3C559.1 109.1 569.2 99 581.3 99C593.4 99 603.7 109.1 603.7 124.3Z"
8
+ fill="#5e21f1" />
9
+ </g>
10
+ <defs>
11
+ <clipPath id="clip0_201_47">
12
+ <rect width="772.5" height="365.4" fill="#5e21f1" />
13
+ </clipPath>
14
+ </defs>
15
+ </svg>