@screeb/sdk-react 0.1.10 → 0.1.11

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.
@@ -141,7 +141,7 @@ var isSSR = typeof window === "undefined";
141
141
  var CONSTANTS = { version: "0.0.0-dev" };
142
142
  var isInitialized = false;
143
143
  var ScreebProvider = function (_a) {
144
- var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "hooks", "children", "shouldLoad", "autoInit", "options"]);
144
+ var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, language = _a.language, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "hooks", "language", "children", "shouldLoad", "autoInit", "options"]);
145
145
  var isLoaded = React__namespace.useRef(Screeb__namespace.isLoaded());
146
146
  // Allow data-x attributes, see https://github.com/devrnt/react-use-screeb/issues/478
147
147
  var invalidPropKeys = Object.keys(rest).filter(function (key) { return !key.startsWith("data-"); });
@@ -258,12 +258,12 @@ var ScreebProvider = function (_a) {
258
258
  case 1: return [2 /*return*/, _a.sent()];
259
259
  }
260
260
  }); }); }, []);
261
- var init = React__namespace.useCallback(function (websiteId, userId, userProperties, hooks) { return __awaiter(void 0, void 0, void 0, function () {
261
+ var init = React__namespace.useCallback(function (websiteId, userId, userProperties, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
262
262
  return __generator(this, function (_a) {
263
263
  switch (_a.label) {
264
264
  case 0: return [4 /*yield*/, ensureScreeb("init", function () {
265
265
  if (!isInitialized) {
266
- Screeb__namespace.init(websiteId, userId, userProperties, hooks);
266
+ Screeb__namespace.init(websiteId, userId, userProperties, hooks, language);
267
267
  isInitialized = true;
268
268
  }
269
269
  }, true)];
@@ -282,7 +282,7 @@ var ScreebProvider = function (_a) {
282
282
  isLoaded.current = true;
283
283
  if (!autoInit) return [3 /*break*/, 3];
284
284
  if (!websiteId) return [3 /*break*/, 2];
285
- return [4 /*yield*/, init(websiteId, userId, userProperties, hooks)];
285
+ return [4 /*yield*/, init(websiteId, userId, userProperties, hooks, language)];
286
286
  case 1:
287
287
  _a.sent();
288
288
  return [3 /*break*/, 3];
@@ -299,11 +299,11 @@ var ScreebProvider = function (_a) {
299
299
  case 1: return [2 /*return*/, _a.sent()];
300
300
  }
301
301
  }); }); }, []);
302
- var surveyStart = React__namespace.useCallback(function (surveyId, allowMultipleResponses, hiddenFields, hooks) { return __awaiter(void 0, void 0, void 0, function () {
302
+ var surveyStart = React__namespace.useCallback(function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
303
303
  return __generator(this, function (_a) {
304
304
  switch (_a.label) {
305
305
  case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
306
- return Screeb__namespace.surveyStart(surveyId, allowMultipleResponses, hiddenFields, hooks);
306
+ return Screeb__namespace.surveyStart(surveyId, allowMultipleResponses, hiddenFields, hooks, language);
307
307
  })];
308
308
  case 1: return [2 /*return*/, _a.sent()];
309
309
  }
@@ -374,4 +374,4 @@ var useScreeb = function () {
374
374
 
375
375
  exports.ScreebProvider = ScreebProvider;
376
376
  exports.useScreeb = useScreeb;
377
- CONSTANTS.version = '0.1.10'
377
+ CONSTANTS.version = '0.1.11'
@@ -9,6 +9,8 @@ export type ScreebProps = {
9
9
  userProperties?: PropertyRecord;
10
10
  /** Hooks to define callback for various event */
11
11
  hooks?: Hooks;
12
+ /** The language you want to force */
13
+ language?: string;
12
14
  };
13
15
  /**
14
16
  * Shutdowns current Screeb session.
@@ -234,6 +236,7 @@ export type IdentityResetFunction = () => Promise<unknown>;
234
236
  * - No more than 1000 attributes
235
237
  * - Supported types for values: string, number, boolean and Date
236
238
  * ```
239
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
237
240
  *
238
241
  * @example
239
242
  * ```ts
@@ -248,11 +251,12 @@ export type IdentityResetFunction = () => Promise<unknown>;
248
251
  * plan: '<user-plan>',
249
252
  * last_seen_at: new Date(),
250
253
  * authenticated: true
251
- * }
254
+ * },
255
+ * "en"
252
256
  * );
253
257
  * ```
254
258
  */
255
- export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord) => Promise<void>;
259
+ export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => Promise<void>;
256
260
  /**
257
261
  * Appends Screeb tag into your dom.
258
262
  *
@@ -296,7 +300,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
296
300
  * );
297
301
  * ```
298
302
  */
299
- export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord) => Promise<unknown>;
303
+ export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks: Hooks, language: string) => Promise<unknown>;
300
304
  /**
301
305
  * Forces a targeting check.
302
306
  *
package/dist/es/index.mjs CHANGED
@@ -119,7 +119,7 @@ var isSSR = typeof window === "undefined";
119
119
  var CONSTANTS = { version: "0.0.0-dev" };
120
120
  var isInitialized = false;
121
121
  var ScreebProvider = function (_a) {
122
- var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "hooks", "children", "shouldLoad", "autoInit", "options"]);
122
+ var websiteId = _a.websiteId, userId = _a.userId, userProperties = _a.userProperties, hooks = _a.hooks, language = _a.language, children = _a.children, _b = _a.shouldLoad, shouldLoad = _b === void 0 ? !isSSR : _b, _c = _a.autoInit, autoInit = _c === void 0 ? false : _c, options = _a.options, rest = __rest(_a, ["websiteId", "userId", "userProperties", "hooks", "language", "children", "shouldLoad", "autoInit", "options"]);
123
123
  var isLoaded = React.useRef(Screeb.isLoaded());
124
124
  // Allow data-x attributes, see https://github.com/devrnt/react-use-screeb/issues/478
125
125
  var invalidPropKeys = Object.keys(rest).filter(function (key) { return !key.startsWith("data-"); });
@@ -236,12 +236,12 @@ var ScreebProvider = function (_a) {
236
236
  case 1: return [2 /*return*/, _a.sent()];
237
237
  }
238
238
  }); }); }, []);
239
- var init = React.useCallback(function (websiteId, userId, userProperties, hooks) { return __awaiter(void 0, void 0, void 0, function () {
239
+ var init = React.useCallback(function (websiteId, userId, userProperties, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
240
240
  return __generator(this, function (_a) {
241
241
  switch (_a.label) {
242
242
  case 0: return [4 /*yield*/, ensureScreeb("init", function () {
243
243
  if (!isInitialized) {
244
- Screeb.init(websiteId, userId, userProperties, hooks);
244
+ Screeb.init(websiteId, userId, userProperties, hooks, language);
245
245
  isInitialized = true;
246
246
  }
247
247
  }, true)];
@@ -260,7 +260,7 @@ var ScreebProvider = function (_a) {
260
260
  isLoaded.current = true;
261
261
  if (!autoInit) return [3 /*break*/, 3];
262
262
  if (!websiteId) return [3 /*break*/, 2];
263
- return [4 /*yield*/, init(websiteId, userId, userProperties, hooks)];
263
+ return [4 /*yield*/, init(websiteId, userId, userProperties, hooks, language)];
264
264
  case 1:
265
265
  _a.sent();
266
266
  return [3 /*break*/, 3];
@@ -277,11 +277,11 @@ var ScreebProvider = function (_a) {
277
277
  case 1: return [2 /*return*/, _a.sent()];
278
278
  }
279
279
  }); }); }, []);
280
- var surveyStart = React.useCallback(function (surveyId, allowMultipleResponses, hiddenFields, hooks) { return __awaiter(void 0, void 0, void 0, function () {
280
+ var surveyStart = React.useCallback(function (surveyId, allowMultipleResponses, hiddenFields, hooks, language) { return __awaiter(void 0, void 0, void 0, function () {
281
281
  return __generator(this, function (_a) {
282
282
  switch (_a.label) {
283
283
  case 0: return [4 /*yield*/, ensureScreeb("surveyStart", function () {
284
- return Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields, hooks);
284
+ return Screeb.surveyStart(surveyId, allowMultipleResponses, hiddenFields, hooks, language);
285
285
  })];
286
286
  case 1: return [2 /*return*/, _a.sent()];
287
287
  }
@@ -351,4 +351,4 @@ var useScreeb = function () {
351
351
  };
352
352
 
353
353
  export { ScreebProvider, useScreeb };
354
- CONSTANTS.version = '0.1.10'
354
+ CONSTANTS.version = '0.1.11'
@@ -9,6 +9,8 @@ export type ScreebProps = {
9
9
  userProperties?: PropertyRecord;
10
10
  /** Hooks to define callback for various event */
11
11
  hooks?: Hooks;
12
+ /** The language you want to force */
13
+ language?: string;
12
14
  };
13
15
  /**
14
16
  * Shutdowns current Screeb session.
@@ -234,6 +236,7 @@ export type IdentityResetFunction = () => Promise<unknown>;
234
236
  * - No more than 1000 attributes
235
237
  * - Supported types for values: string, number, boolean and Date
236
238
  * ```
239
+ * @param language Force a specific language for the tag. eg: 'en'. default: browser language.
237
240
  *
238
241
  * @example
239
242
  * ```ts
@@ -248,11 +251,12 @@ export type IdentityResetFunction = () => Promise<unknown>;
248
251
  * plan: '<user-plan>',
249
252
  * last_seen_at: new Date(),
250
253
  * authenticated: true
251
- * }
254
+ * },
255
+ * "en"
252
256
  * );
253
257
  * ```
254
258
  */
255
- export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord) => Promise<void>;
259
+ export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => Promise<void>;
256
260
  /**
257
261
  * Appends Screeb tag into your dom.
258
262
  *
@@ -296,7 +300,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
296
300
  * );
297
301
  * ```
298
302
  */
299
- export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord) => Promise<unknown>;
303
+ export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks: Hooks, language: string) => Promise<unknown>;
300
304
  /**
301
305
  * Forces a targeting check.
302
306
  *
package/docs/README.md CHANGED
@@ -34,18 +34,10 @@
34
34
 
35
35
  ### CloseFunction
36
36
 
37
- Ƭ **CloseFunction**: () => `Promise`<`void`\>
38
-
39
- #### Type declaration
40
-
41
- ▸ (): `Promise`<`void`\>
37
+ Ƭ **CloseFunction**: () => `Promise`\<`void`\>
42
38
 
43
39
  Shutdowns current Screeb session.
44
40
 
45
- ##### Returns
46
-
47
- `Promise`<`void`\>
48
-
49
41
  **`Example`**
50
42
 
51
43
  ```ts
@@ -54,21 +46,21 @@ const { close } = useScreeb();
54
46
  close();
55
47
  ```
56
48
 
57
- ___
49
+ #### Type declaration
58
50
 
59
- ### DebugFunction
51
+ (): `Promise`\<`void`\>
60
52
 
61
- Ƭ **DebugFunction**: () => `Promise`<`unknown`\>
53
+ ##### Returns
62
54
 
63
- #### Type declaration
55
+ `Promise`\<`void`\>
64
56
 
65
- ▸ (): `Promise`<`unknown`\>
57
+ ___
66
58
 
67
- Prints the actual state information of Screeb tag.
59
+ ### DebugFunction
68
60
 
69
- ##### Returns
61
+ Ƭ **DebugFunction**: () => `Promise`\<`unknown`\>
70
62
 
71
- `Promise`<`unknown`\>
63
+ Prints the actual state information of Screeb tag.
72
64
 
73
65
  **`Example`**
74
66
 
@@ -95,28 +87,21 @@ debug();
95
87
  // **************************************************************
96
88
  ```
97
89
 
98
- ___
99
-
100
- ### EventTrackFunction
101
-
102
- Ƭ **EventTrackFunction**: (`eventName`: `string`, `eventProperties?`: `PropertyRecord`) => `Promise`<`unknown`\>
103
-
104
90
  #### Type declaration
105
91
 
106
- ▸ (`eventName`, `eventProperties?`): `Promise`<`unknown`\>
92
+ ▸ (): `Promise`\<`unknown`\>
107
93
 
108
- Tracks a user event.
94
+ ##### Returns
109
95
 
110
- ##### Parameters
96
+ `Promise`\<`unknown`\>
111
97
 
112
- | Name | Type | Description |
113
- | :------ | :------ | :------ |
114
- | `eventName` | `string` | The event name. |
115
- | `eventProperties?` | `PropertyRecord` | The properties of your event. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
98
+ ___
116
99
 
117
- ##### Returns
100
+ ### EventTrackFunction
101
+
102
+ Ƭ **EventTrackFunction**: (`eventName`: `string`, `eventProperties?`: `PropertyRecord`) => `Promise`\<`unknown`\>
118
103
 
119
- `Promise`<`unknown`\>
104
+ Tracks a user event.
120
105
 
121
106
  **`Example`**
122
107
 
@@ -139,29 +124,29 @@ eventTrack(
139
124
  );
140
125
  ```
141
126
 
142
- ___
143
-
144
- ### IdentityFunction
145
-
146
- Ƭ **IdentityFunction**: (`userId`: `string`, `userProperties?`: `PropertyRecord`) => `Promise`<`unknown`\>
147
-
148
127
  #### Type declaration
149
128
 
150
- ▸ (`userId`, `userProperties?`): `Promise`<`unknown`\>
151
-
152
- Change the current user identity.
153
- Warning: Running surveys will be closed.
129
+ ▸ (`eventName`, `eventProperties?`): `Promise`\<`unknown`\>
154
130
 
155
131
  ##### Parameters
156
132
 
157
133
  | Name | Type | Description |
158
134
  | :------ | :------ | :------ |
159
- | `userId` | `string` | The unique identifier of your user. |
160
- | `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
135
+ | `eventName` | `string` | The event name. |
136
+ | `eventProperties?` | `PropertyRecord` | The properties of your event. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
161
137
 
162
138
  ##### Returns
163
139
 
164
- `Promise`<`unknown`\>
140
+ `Promise`\<`unknown`\>
141
+
142
+ ___
143
+
144
+ ### IdentityFunction
145
+
146
+ Ƭ **IdentityFunction**: (`userId`: `string`, `userProperties?`: `PropertyRecord`) => `Promise`\<`unknown`\>
147
+
148
+ Change the current user identity.
149
+ Warning: Running surveys will be closed.
165
150
 
166
151
  **`Example`**
167
152
 
@@ -180,21 +165,28 @@ identity(
180
165
  );
181
166
  ```
182
167
 
183
- ___
168
+ #### Type declaration
184
169
 
185
- ### IdentityGetFunction
170
+ (`userId`, `userProperties?`): `Promise`\<`unknown`\>
186
171
 
187
- Ƭ **IdentityGetFunction**: () => `Promise`<`ScreebIdentityGetReturn`\>
172
+ ##### Parameters
188
173
 
189
- #### Type declaration
174
+ | Name | Type | Description |
175
+ | :------ | :------ | :------ |
176
+ | `userId` | `string` | The unique identifier of your user. |
177
+ | `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
190
178
 
191
- (): `Promise`<`ScreebIdentityGetReturn`\>
179
+ ##### Returns
192
180
 
193
- Retrieves the current user identity.
181
+ `Promise`\<`unknown`\>
194
182
 
195
- ##### Returns
183
+ ___
184
+
185
+ ### IdentityGetFunction
196
186
 
197
- `Promise`<`ScreebIdentityGetReturn`\>
187
+ Ƭ **IdentityGetFunction**: () => `Promise`\<`ScreebIdentityGetReturn`\>
188
+
189
+ Retrieves the current user identity.
198
190
 
199
191
  **`Example`**
200
192
 
@@ -213,29 +205,21 @@ console.log(await identityGet());
213
205
  // }
214
206
  ```
215
207
 
216
- ___
217
-
218
- ### IdentityGroupAssignFunction
219
-
220
- Ƭ **IdentityGroupAssignFunction**: (`groupName`: `string`, `groupType?`: `string`, `groupProperties?`: `PropertyRecord`) => `Promise`<`unknown`\>
221
-
222
208
  #### Type declaration
223
209
 
224
- ▸ (`groupName`, `groupType?`, `groupProperties?`): `Promise`<`unknown`\>
210
+ ▸ (): `Promise`\<`ScreebIdentityGetReturn`\>
225
211
 
226
- Assigns the current user to a group.
212
+ ##### Returns
227
213
 
228
- ##### Parameters
214
+ `Promise`\<`ScreebIdentityGetReturn`\>
229
215
 
230
- | Name | Type | Description |
231
- | :------ | :------ | :------ |
232
- | `groupName` | `string` | |
233
- | `groupType?` | `string` | |
234
- | `groupProperties?` | `PropertyRecord` | The properties of your user group. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
216
+ ___
235
217
 
236
- ##### Returns
218
+ ### IdentityGroupAssignFunction
237
219
 
238
- `Promise`<`unknown`\>
220
+ Ƭ **IdentityGroupAssignFunction**: (`groupName`: `string`, `groupType?`: `string`, `groupProperties?`: `PropertyRecord`) => `Promise`\<`unknown`\>
221
+
222
+ Assigns the current user to a group.
239
223
 
240
224
  **`Example`**
241
225
 
@@ -256,28 +240,29 @@ identityGroupAssign(
256
240
  );
257
241
  ```
258
242
 
259
- ___
260
-
261
- ### IdentityGroupUnassignFunction
262
-
263
- Ƭ **IdentityGroupUnassignFunction**: (`groupName`: `string`, `groupType?`: `string`) => `Promise`<`unknown`\>
264
-
265
243
  #### Type declaration
266
244
 
267
- ▸ (`groupName`, `groupType?`): `Promise`<`unknown`\>
268
-
269
- Unassigns the current user to a group.
245
+ ▸ (`groupName`, `groupType?`, `groupProperties?`): `Promise`\<`unknown`\>
270
246
 
271
247
  ##### Parameters
272
248
 
273
249
  | Name | Type | Description |
274
250
  | :------ | :------ | :------ |
275
- | `groupName` | `string` | The name of your user group. |
276
- | `groupType?` | `string` | The type of your user group. |
251
+ | `groupName` | `string` | |
252
+ | `groupType?` | `string` | |
253
+ | `groupProperties?` | `PropertyRecord` | The properties of your user group. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
277
254
 
278
255
  ##### Returns
279
256
 
280
- `Promise`<`unknown`\>
257
+ `Promise`\<`unknown`\>
258
+
259
+ ___
260
+
261
+ ### IdentityGroupUnassignFunction
262
+
263
+ Ƭ **IdentityGroupUnassignFunction**: (`groupName`: `string`, `groupType?`: `string`) => `Promise`\<`unknown`\>
264
+
265
+ Unassigns the current user to a group.
281
266
 
282
267
  **`Example`**
283
268
 
@@ -287,27 +272,28 @@ const { identityGroupUnassign } = useScreeb();
287
272
  identityGroupUnassign('company', 'Apple');
288
273
  ```
289
274
 
290
- ___
291
-
292
- ### IdentityPropertiesFunction
293
-
294
- Ƭ **IdentityPropertiesFunction**: (`userProperties`: `PropertyRecord`) => `Promise`<`unknown`\>
295
-
296
275
  #### Type declaration
297
276
 
298
- ▸ (`userProperties`): `Promise`<`unknown`\>
299
-
300
- Adds properties to the current user identity.
277
+ ▸ (`groupName`, `groupType?`): `Promise`\<`unknown`\>
301
278
 
302
279
  ##### Parameters
303
280
 
304
281
  | Name | Type | Description |
305
282
  | :------ | :------ | :------ |
306
- | `userProperties` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
283
+ | `groupName` | `string` | The name of your user group. |
284
+ | `groupType?` | `string` | The type of your user group. |
307
285
 
308
286
  ##### Returns
309
287
 
310
- `Promise`<`unknown`\>
288
+ `Promise`\<`unknown`\>
289
+
290
+ ___
291
+
292
+ ### IdentityPropertiesFunction
293
+
294
+ Ƭ **IdentityPropertiesFunction**: (`userProperties`: `PropertyRecord`) => `Promise`\<`unknown`\>
295
+
296
+ Adds properties to the current user identity.
311
297
 
312
298
  **`Example`**
313
299
 
@@ -335,22 +321,28 @@ identityProperties(
335
321
  );
336
322
  ```
337
323
 
338
- ___
324
+ #### Type declaration
339
325
 
340
- ### IdentityResetFunction
326
+ (`userProperties`): `Promise`\<`unknown`\>
341
327
 
342
- Ƭ **IdentityResetFunction**: () => `Promise`<`unknown`\>
328
+ ##### Parameters
343
329
 
344
- #### Type declaration
330
+ | Name | Type | Description |
331
+ | :------ | :------ | :------ |
332
+ | `userProperties` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date. ``` |
345
333
 
346
- (): `Promise`<`unknown`\>
334
+ ##### Returns
347
335
 
348
- Resets the current user identity.
349
- Warning: This command must be called only once, since it creates a new identity on Screeb side.
336
+ `Promise`\<`unknown`\>
350
337
 
351
- ##### Returns
338
+ ___
339
+
340
+ ### IdentityResetFunction
352
341
 
353
- `Promise`<`unknown`\>
342
+ Ƭ **IdentityResetFunction**: () => `Promise`\<`unknown`\>
343
+
344
+ Resets the current user identity.
345
+ Warning: This command must be called only once, since it creates a new identity on Screeb side.
354
346
 
355
347
  **`Example`**
356
348
 
@@ -360,29 +352,21 @@ const { identityReset } = useScreeb();
360
352
  identityReset();
361
353
  ```
362
354
 
363
- ___
364
-
365
- ### InitFunction
366
-
367
- Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`) => `Promise`<`void`\>
368
-
369
355
  #### Type declaration
370
356
 
371
- ▸ (`websiteId`, `userId?`, `userProperties?`): `Promise`<`void`\>
357
+ ▸ (): `Promise`\<`unknown`\>
372
358
 
373
- Initializes Screeb tag.
359
+ ##### Returns
374
360
 
375
- ##### Parameters
361
+ `Promise`\<`unknown`\>
376
362
 
377
- | Name | Type | Description |
378
- | :------ | :------ | :------ |
379
- | `websiteId` | `string` | Your website/channel id. |
380
- | `userId?` | `string` | The unique identifier of your user. |
381
- | `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date ``` |
363
+ ___
382
364
 
383
- ##### Returns
365
+ ### InitFunction
384
366
 
385
- `Promise`<`void`\>
367
+ Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`, `hooks?`: `Hooks`, `language?`: `string`) => `Promise`\<`void`\>
368
+
369
+ Initializes Screeb tag.
386
370
 
387
371
  **`Example`**
388
372
 
@@ -398,31 +382,36 @@ init(
398
382
  plan: '<user-plan>',
399
383
  last_seen_at: new Date(),
400
384
  authenticated: true
401
- }
385
+ },
386
+ "en"
402
387
  );
403
388
  ```
404
389
 
405
- ___
406
-
407
- ### LoadFunction
408
-
409
- Ƭ **LoadFunction**: (`options?`: `ScreebOptions`) => `Promise`<`void`\>
410
-
411
390
  #### Type declaration
412
391
 
413
- ▸ (`options?`): `Promise`<`void`\>
414
-
415
- Appends Screeb tag into your dom.
392
+ ▸ (`websiteId`, `userId?`, `userProperties?`, `hooks?`, `language?`): `Promise`\<`void`\>
416
393
 
417
394
  ##### Parameters
418
395
 
419
396
  | Name | Type | Description |
420
397
  | :------ | :------ | :------ |
421
- | `options?` | `ScreebOptions` | Screeb module options. |
398
+ | `websiteId` | `string` | Your website/channel id. |
399
+ | `userId?` | `string` | The unique identifier of your user. |
400
+ | `userProperties?` | `PropertyRecord` | The properties of your user. ```text Requirements: - Property names must be limited to 128 characters - No more than 1000 attributes - Supported types for values: string, number, boolean and Date ``` |
401
+ | `hooks?` | `Hooks` | - |
402
+ | `language?` | `string` | Force a specific language for the tag. eg: 'en'. default: browser language. |
422
403
 
423
404
  ##### Returns
424
405
 
425
- `Promise`<`void`\>
406
+ `Promise`\<`void`\>
407
+
408
+ ___
409
+
410
+ ### LoadFunction
411
+
412
+ Ƭ **LoadFunction**: (`options?`: `ScreebOptions`) => `Promise`\<`void`\>
413
+
414
+ Appends Screeb tag into your dom.
426
415
 
427
416
  **`Example`**
428
417
 
@@ -432,6 +421,20 @@ const { load } = useScreeb();
432
421
  load();
433
422
  ```
434
423
 
424
+ #### Type declaration
425
+
426
+ ▸ (`options?`): `Promise`\<`void`\>
427
+
428
+ ##### Parameters
429
+
430
+ | Name | Type | Description |
431
+ | :------ | :------ | :------ |
432
+ | `options?` | `ScreebOptions` | Screeb module options. |
433
+
434
+ ##### Returns
435
+
436
+ `Promise`\<`void`\>
437
+
435
438
  ___
436
439
 
437
440
  ### ScreebContextValues
@@ -473,6 +476,7 @@ Properties of Screeb provider
473
476
  | Name | Type | Description |
474
477
  | :------ | :------ | :------ |
475
478
  | `hooks?` | `Hooks` | Hooks to define callback for various event |
479
+ | `language?` | `string` | The language you want to force |
476
480
  | `userId?` | `string` | The unique identifier of your user. |
477
481
  | `userProperties?` | `PropertyRecord` | The properties of your user. |
478
482
  | `websiteId` | `string` | Your website/channel id. |
@@ -481,7 +485,7 @@ ___
481
485
 
482
486
  ### ScreebProviderProps
483
487
 
484
- Ƭ **ScreebProviderProps**: { `autoInit?`: `boolean` ; `options?`: `ScreebOptions` ; `shouldLoad?`: `boolean` } & `Partial`<[`ScreebProps`](README.md#screebprops)\>
488
+ Ƭ **ScreebProviderProps**: \{ `autoInit?`: `boolean` ; `options?`: `ScreebOptions` ; `shouldLoad?`: `boolean` } & `Partial`\<[`ScreebProps`](README.md#screebprops)\>
485
489
 
486
490
  Properties of Screeb provider
487
491
 
@@ -489,18 +493,10 @@ ___
489
493
 
490
494
  ### SurveyCloseFunction
491
495
 
492
- Ƭ **SurveyCloseFunction**: () => `Promise`<`unknown`\>
493
-
494
- #### Type declaration
495
-
496
- ▸ (): `Promise`<`unknown`\>
496
+ Ƭ **SurveyCloseFunction**: () => `Promise`\<`unknown`\>
497
497
 
498
498
  Interrupts a running survey.
499
499
 
500
- ##### Returns
501
-
502
- `Promise`<`unknown`\>
503
-
504
500
  **`Example`**
505
501
 
506
502
  ```ts
@@ -509,29 +505,21 @@ const { surveyClose } = useScreeb();
509
505
  surveyClose();
510
506
  ```
511
507
 
512
- ___
513
-
514
- ### SurveyStartFunction
515
-
516
- Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`) => `Promise`<`unknown`\>
517
-
518
508
  #### Type declaration
519
509
 
520
- ▸ (`surveyId`, `allowMultipleResponses`, `hiddenFields`): `Promise`<`unknown`\>
510
+ ▸ (): `Promise`\<`unknown`\>
521
511
 
522
- Starts a survey by its ID.
512
+ ##### Returns
523
513
 
524
- ##### Parameters
514
+ `Promise`\<`unknown`\>
525
515
 
526
- | Name | Type |
527
- | :------ | :------ |
528
- | `surveyId` | `string` |
529
- | `allowMultipleResponses` | `boolean` |
530
- | `hiddenFields` | `PropertyRecord` |
516
+ ___
531
517
 
532
- ##### Returns
518
+ ### SurveyStartFunction
519
+
520
+ Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks`: `Hooks`, `language`: `string`) => `Promise`\<`unknown`\>
533
521
 
534
- `Promise`<`unknown`\>
522
+ Starts a survey by its ID.
535
523
 
536
524
  **`Example`**
537
525
 
@@ -548,21 +536,31 @@ surveyStart(
548
536
  );
549
537
  ```
550
538
 
551
- ___
539
+ #### Type declaration
552
540
 
553
- ### TargetingCheckFunction
541
+ (`surveyId`, `allowMultipleResponses`, `hiddenFields`, `hooks`, `language`): `Promise`\<`unknown`\>
554
542
 
555
- Ƭ **TargetingCheckFunction**: () => `Promise`<`unknown`\>
543
+ ##### Parameters
556
544
 
557
- #### Type declaration
545
+ | Name | Type |
546
+ | :------ | :------ |
547
+ | `surveyId` | `string` |
548
+ | `allowMultipleResponses` | `boolean` |
549
+ | `hiddenFields` | `PropertyRecord` |
550
+ | `hooks` | `Hooks` |
551
+ | `language` | `string` |
552
+
553
+ ##### Returns
558
554
 
559
- ▸ (): `Promise`<`unknown`\>
555
+ `Promise`\<`unknown`\>
560
556
 
561
- Forces a targeting check.
557
+ ___
562
558
 
563
- ##### Returns
559
+ ### TargetingCheckFunction
560
+
561
+ Ƭ **TargetingCheckFunction**: () => `Promise`\<`unknown`\>
564
562
 
565
- `Promise`<`unknown`\>
563
+ Forces a targeting check.
566
564
 
567
565
  **`Example`**
568
566
 
@@ -572,21 +570,21 @@ const { targetingCheck } = useScreeb();
572
570
  targetingCheck();
573
571
  ```
574
572
 
575
- ___
573
+ #### Type declaration
576
574
 
577
- ### TargetingDebugFunction
575
+ (): `Promise`\<`unknown`\>
578
576
 
579
- Ƭ **TargetingDebugFunction**: () => `Promise`<`unknown`\>
577
+ ##### Returns
580
578
 
581
- #### Type declaration
579
+ `Promise`\<`unknown`\>
582
580
 
583
- ▸ (): `Promise`<`unknown`\>
581
+ ___
584
582
 
585
- Prints the current state of the targeting engine.
583
+ ### TargetingDebugFunction
586
584
 
587
- ##### Returns
585
+ Ƭ **TargetingDebugFunction**: () => `Promise`\<`unknown`\>
588
586
 
589
- `Promise`<`unknown`\>
587
+ Prints the current state of the targeting engine.
590
588
 
591
589
  **`Example`**
592
590
 
@@ -610,18 +608,26 @@ console.log(await targetingDebug());
610
608
  // - Rule of type "Capping per respondent display count": false 🔴
611
609
  ```
612
610
 
611
+ #### Type declaration
612
+
613
+ ▸ (): `Promise`\<`unknown`\>
614
+
615
+ ##### Returns
616
+
617
+ `Promise`\<`unknown`\>
618
+
613
619
  ## Functions
614
620
 
615
621
  ### ScreebProvider
616
622
 
617
- ▸ **ScreebProvider**(`props`, `context?`): `ReactNode`
623
+ ▸ **ScreebProvider**(`props`, `deprecatedLegacyContext?`): `ReactNode`
618
624
 
619
625
  #### Parameters
620
626
 
621
- | Name | Type |
622
- | :------ | :------ |
623
- | `props` | `PropsWithChildren`<[`ScreebProviderProps`](README.md#screebproviderprops)\> |
624
- | `context?` | `any` |
627
+ | Name | Type | Description |
628
+ | :------ | :------ | :------ |
629
+ | `props` | `PropsWithChildren`\<[`ScreebProviderProps`](README.md#screebproviderprops)\> | - |
630
+ | `deprecatedLegacyContext?` | `any` | **`Deprecated`** **`See`** [React Docs](https://legacy.reactjs.org/docs/legacy-context.html#referencing-context-in-lifecycle-methods) |
625
631
 
626
632
  #### Returns
627
633
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-react",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Screeb's browser sdk, optimized for React.",
5
5
  "keywords": [
6
6
  "product discovery",
@@ -41,7 +41,7 @@
41
41
  "test": "echo '@TODO'"
42
42
  },
43
43
  "dependencies": {
44
- "@screeb/sdk-browser": "^0.1.16"
44
+ "@screeb/sdk-browser": "^0.1.17"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@screeb/eslint-config": "^0.1.6",
@@ -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>