@screeb/sdk-react 0.1.14 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +3 -3
- package/dist/cjs/types.d.ts +6 -5
- package/dist/es/index.mjs +3 -3
- package/dist/es/types.d.ts +6 -5
- package/docs/README.md +10 -8
- package/package.json +2 -3
package/dist/cjs/index.cjs
CHANGED
|
@@ -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, language) { return __awaiter(void 0, void 0, void 0, function () {
|
|
302
|
+
var surveyStart = React__namespace.useCallback(function (surveyId, distributionId, 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, language);
|
|
306
|
+
return Screeb__namespace.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language);
|
|
307
307
|
})];
|
|
308
308
|
case 1: return [2 /*return*/, _a.sent()];
|
|
309
309
|
}
|
|
@@ -394,4 +394,4 @@ var useScreeb = function () {
|
|
|
394
394
|
|
|
395
395
|
exports.ScreebProvider = ScreebProvider;
|
|
396
396
|
exports.useScreeb = useScreeb;
|
|
397
|
-
CONSTANTS.version = '0.1
|
|
397
|
+
CONSTANTS.version = '0.2.1'
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
|
|
2
2
|
/** Properties of Screeb provider */
|
|
3
3
|
export type ScreebProps = {
|
|
4
4
|
/** Your website/channel id. */
|
|
@@ -8,7 +8,7 @@ export type ScreebProps = {
|
|
|
8
8
|
/** The properties of your user. */
|
|
9
9
|
userProperties?: PropertyRecord;
|
|
10
10
|
/** Hooks to define callback for various event */
|
|
11
|
-
hooks?:
|
|
11
|
+
hooks?: HooksInit;
|
|
12
12
|
/** The language you want to force */
|
|
13
13
|
language?: string;
|
|
14
14
|
};
|
|
@@ -256,7 +256,7 @@ export type IdentityResetFunction = () => Promise<unknown>;
|
|
|
256
256
|
* );
|
|
257
257
|
* ```
|
|
258
258
|
*/
|
|
259
|
-
export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?:
|
|
259
|
+
export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => Promise<void>;
|
|
260
260
|
/**
|
|
261
261
|
* Appends Screeb tag into your dom.
|
|
262
262
|
*
|
|
@@ -292,6 +292,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
292
292
|
*
|
|
293
293
|
* surveyStart(
|
|
294
294
|
* '<UUID>',
|
|
295
|
+
* '<UUID>',
|
|
295
296
|
* false,
|
|
296
297
|
* {
|
|
297
298
|
* color: "green",
|
|
@@ -300,7 +301,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
300
301
|
* );
|
|
301
302
|
* ```
|
|
302
303
|
*/
|
|
303
|
-
export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?:
|
|
304
|
+
export type SurveyStartFunction = (surveyId: string, distributionId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
|
|
304
305
|
/**
|
|
305
306
|
* Interrupts a running message.
|
|
306
307
|
*
|
|
@@ -329,7 +330,7 @@ export type MessageCloseFunction = () => Promise<unknown>;
|
|
|
329
330
|
* );
|
|
330
331
|
* ```
|
|
331
332
|
*/
|
|
332
|
-
export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?:
|
|
333
|
+
export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
|
|
333
334
|
/**
|
|
334
335
|
* Forces a targeting check.
|
|
335
336
|
*
|
package/dist/es/index.mjs
CHANGED
|
@@ -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, language) { return __awaiter(void 0, void 0, void 0, function () {
|
|
280
|
+
var surveyStart = React.useCallback(function (surveyId, distributionId, 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, language);
|
|
284
|
+
return Screeb.surveyStart(surveyId, distributionId, allowMultipleResponses, hiddenFields, hooks, language);
|
|
285
285
|
})];
|
|
286
286
|
case 1: return [2 /*return*/, _a.sent()];
|
|
287
287
|
}
|
|
@@ -371,4 +371,4 @@ var useScreeb = function () {
|
|
|
371
371
|
};
|
|
372
372
|
|
|
373
373
|
export { ScreebProvider, useScreeb };
|
|
374
|
-
CONSTANTS.version = '0.1
|
|
374
|
+
CONSTANTS.version = '0.2.1'
|
package/dist/es/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HooksInit, HooksMessageStart, HooksSurveyStart, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
|
|
2
2
|
/** Properties of Screeb provider */
|
|
3
3
|
export type ScreebProps = {
|
|
4
4
|
/** Your website/channel id. */
|
|
@@ -8,7 +8,7 @@ export type ScreebProps = {
|
|
|
8
8
|
/** The properties of your user. */
|
|
9
9
|
userProperties?: PropertyRecord;
|
|
10
10
|
/** Hooks to define callback for various event */
|
|
11
|
-
hooks?:
|
|
11
|
+
hooks?: HooksInit;
|
|
12
12
|
/** The language you want to force */
|
|
13
13
|
language?: string;
|
|
14
14
|
};
|
|
@@ -256,7 +256,7 @@ export type IdentityResetFunction = () => Promise<unknown>;
|
|
|
256
256
|
* );
|
|
257
257
|
* ```
|
|
258
258
|
*/
|
|
259
|
-
export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?:
|
|
259
|
+
export type InitFunction = (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => Promise<void>;
|
|
260
260
|
/**
|
|
261
261
|
* Appends Screeb tag into your dom.
|
|
262
262
|
*
|
|
@@ -292,6 +292,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
292
292
|
*
|
|
293
293
|
* surveyStart(
|
|
294
294
|
* '<UUID>',
|
|
295
|
+
* '<UUID>',
|
|
295
296
|
* false,
|
|
296
297
|
* {
|
|
297
298
|
* color: "green",
|
|
@@ -300,7 +301,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
|
|
|
300
301
|
* );
|
|
301
302
|
* ```
|
|
302
303
|
*/
|
|
303
|
-
export type SurveyStartFunction = (surveyId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?:
|
|
304
|
+
export type SurveyStartFunction = (surveyId: string, distributionId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
|
|
304
305
|
/**
|
|
305
306
|
* Interrupts a running message.
|
|
306
307
|
*
|
|
@@ -329,7 +330,7 @@ export type MessageCloseFunction = () => Promise<unknown>;
|
|
|
329
330
|
* );
|
|
330
331
|
* ```
|
|
331
332
|
*/
|
|
332
|
-
export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?:
|
|
333
|
+
export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
|
|
333
334
|
/**
|
|
334
335
|
* Forces a targeting check.
|
|
335
336
|
*
|
package/docs/README.md
CHANGED
|
@@ -366,7 +366,7 @@ ___
|
|
|
366
366
|
|
|
367
367
|
### InitFunction
|
|
368
368
|
|
|
369
|
-
Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`, `hooks?`: `
|
|
369
|
+
Ƭ **InitFunction**: (`websiteId`: `string`, `userId?`: `string`, `userProperties?`: `PropertyRecord`, `hooks?`: `HooksInit`, `language?`: `string`) => `Promise`\<`void`\>
|
|
370
370
|
|
|
371
371
|
Initializes Screeb tag.
|
|
372
372
|
|
|
@@ -400,7 +400,7 @@ init(
|
|
|
400
400
|
| `websiteId` | `string` | Your website/channel id. |
|
|
401
401
|
| `userId?` | `string` | The unique identifier of your user. |
|
|
402
402
|
| `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 ``` |
|
|
403
|
-
| `hooks?` | `
|
|
403
|
+
| `hooks?` | `HooksInit` | - |
|
|
404
404
|
| `language?` | `string` | Force a specific language for the tag. eg: 'en'. default: browser language. |
|
|
405
405
|
|
|
406
406
|
##### Returns
|
|
@@ -465,7 +465,7 @@ ___
|
|
|
465
465
|
|
|
466
466
|
### MessageStartFunction
|
|
467
467
|
|
|
468
|
-
Ƭ **MessageStartFunction**: (`messageId`: `string`, `hiddenFields`: `PropertyRecord`, `hooks?`: `
|
|
468
|
+
Ƭ **MessageStartFunction**: (`messageId`: `string`, `hiddenFields`: `PropertyRecord`, `hooks?`: `HooksMessageStart`, `language?`: `string`) => `Promise`\<`unknown`\>
|
|
469
469
|
|
|
470
470
|
Starts a message by its ID.
|
|
471
471
|
|
|
@@ -494,7 +494,7 @@ messageStart(
|
|
|
494
494
|
| :------ | :------ |
|
|
495
495
|
| `messageId` | `string` |
|
|
496
496
|
| `hiddenFields` | `PropertyRecord` |
|
|
497
|
-
| `hooks?` | `
|
|
497
|
+
| `hooks?` | `HooksMessageStart` |
|
|
498
498
|
| `language?` | `string` |
|
|
499
499
|
|
|
500
500
|
##### Returns
|
|
@@ -543,7 +543,7 @@ Properties of Screeb provider
|
|
|
543
543
|
|
|
544
544
|
| Name | Type | Description |
|
|
545
545
|
| :------ | :------ | :------ |
|
|
546
|
-
| `hooks?` | `
|
|
546
|
+
| `hooks?` | `HooksInit` | Hooks to define callback for various event |
|
|
547
547
|
| `language?` | `string` | The language you want to force |
|
|
548
548
|
| `userId?` | `string` | The unique identifier of your user. |
|
|
549
549
|
| `userProperties?` | `PropertyRecord` | The properties of your user. |
|
|
@@ -585,7 +585,7 @@ ___
|
|
|
585
585
|
|
|
586
586
|
### SurveyStartFunction
|
|
587
587
|
|
|
588
|
-
Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks?`: `
|
|
588
|
+
Ƭ **SurveyStartFunction**: (`surveyId`: `string`, `distributionId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks?`: `HooksSurveyStart`, `language?`: `string`) => `Promise`\<`unknown`\>
|
|
589
589
|
|
|
590
590
|
Starts a survey by its ID.
|
|
591
591
|
|
|
@@ -595,6 +595,7 @@ Starts a survey by its ID.
|
|
|
595
595
|
const { surveyStart } = useScreeb();
|
|
596
596
|
|
|
597
597
|
surveyStart(
|
|
598
|
+
'<UUID>',
|
|
598
599
|
'<UUID>',
|
|
599
600
|
false,
|
|
600
601
|
{
|
|
@@ -606,16 +607,17 @@ surveyStart(
|
|
|
606
607
|
|
|
607
608
|
#### Type declaration
|
|
608
609
|
|
|
609
|
-
▸ (`surveyId`, `allowMultipleResponses`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
|
|
610
|
+
▸ (`surveyId`, `distributionId`, `allowMultipleResponses`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
|
|
610
611
|
|
|
611
612
|
##### Parameters
|
|
612
613
|
|
|
613
614
|
| Name | Type |
|
|
614
615
|
| :------ | :------ |
|
|
615
616
|
| `surveyId` | `string` |
|
|
617
|
+
| `distributionId` | `string` |
|
|
616
618
|
| `allowMultipleResponses` | `boolean` |
|
|
617
619
|
| `hiddenFields` | `PropertyRecord` |
|
|
618
|
-
| `hooks?` | `
|
|
620
|
+
| `hooks?` | `HooksSurveyStart` |
|
|
619
621
|
| `language?` | `string` |
|
|
620
622
|
|
|
621
623
|
##### Returns
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@screeb/sdk-react",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Screeb's browser sdk, optimized for React.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"product discovery",
|
|
@@ -41,11 +41,10 @@
|
|
|
41
41
|
"test": "echo '@TODO'"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@screeb/sdk-browser": "^0.1
|
|
44
|
+
"@screeb/sdk-browser": "^0.2.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@screeb/eslint-config": "^0.1.6",
|
|
48
|
-
"@screeb/sdk-browser": "^0.1.6",
|
|
49
48
|
"@screeb/typescript-config": "^0.1.10",
|
|
50
49
|
"@types/jest": "^29.5.5",
|
|
51
50
|
"@types/node": "^20.8.4",
|