@screeb/sdk-react 0.2.0 → 0.2.2

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.
@@ -394,4 +394,4 @@ var useScreeb = function () {
394
394
 
395
395
  exports.ScreebProvider = ScreebProvider;
396
396
  exports.useScreeb = useScreeb;
397
- CONSTANTS.version = '0.2.0'
397
+ CONSTANTS.version = '0.2.2'
@@ -1,4 +1,4 @@
1
- import { Hooks, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
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?: 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?: Hooks, language?: string) => Promise<void>;
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
  *
@@ -301,7 +301,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
301
301
  * );
302
302
  * ```
303
303
  */
304
- export type SurveyStartFunction = (surveyId: string, distributionId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
305
305
  /**
306
306
  * Interrupts a running message.
307
307
  *
@@ -330,7 +330,7 @@ export type MessageCloseFunction = () => Promise<unknown>;
330
330
  * );
331
331
  * ```
332
332
  */
333
- export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
333
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
334
334
  /**
335
335
  * Forces a targeting check.
336
336
  *
package/dist/es/index.mjs CHANGED
@@ -371,4 +371,4 @@ var useScreeb = function () {
371
371
  };
372
372
 
373
373
  export { ScreebProvider, useScreeb };
374
- CONSTANTS.version = '0.2.0'
374
+ CONSTANTS.version = '0.2.2'
@@ -1,4 +1,4 @@
1
- import { Hooks, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "@screeb/sdk-browser";
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?: 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?: Hooks, language?: string) => Promise<void>;
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
  *
@@ -301,7 +301,7 @@ export type SurveyCloseFunction = () => Promise<unknown>;
301
301
  * );
302
302
  * ```
303
303
  */
304
- export type SurveyStartFunction = (surveyId: string, distributionId: string, allowMultipleResponses: boolean, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
304
+ export type SurveyStartFunction = (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => Promise<unknown>;
305
305
  /**
306
306
  * Interrupts a running message.
307
307
  *
@@ -330,7 +330,7 @@ export type MessageCloseFunction = () => Promise<unknown>;
330
330
  * );
331
331
  * ```
332
332
  */
333
- export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: Hooks, language?: string) => Promise<unknown>;
333
+ export type MessageStartFunction = (messageId: string, hiddenFields: PropertyRecord, hooks?: HooksMessageStart, language?: string) => Promise<unknown>;
334
334
  /**
335
335
  * Forces a targeting check.
336
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?`: `Hooks`, `language?`: `string`) => `Promise`\<`void`\>
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?` | `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?`: `Hooks`, `language?`: `string`) => `Promise`\<`unknown`\>
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?` | `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?` | `Hooks` | Hooks to define callback for various event |
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`, `distributionId`: `string`, `allowMultipleResponses`: `boolean`, `hiddenFields`: `PropertyRecord`, `hooks?`: `Hooks`, `language?`: `string`) => `Promise`\<`unknown`\>
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
 
@@ -607,17 +607,17 @@ surveyStart(
607
607
 
608
608
  #### Type declaration
609
609
 
610
- ▸ (`surveyId`, `distributionId`, `allowMultipleResponses`, `hiddenFields`, `hooks?`, `language?`): `Promise`\<`unknown`\>
610
+ ▸ (`surveyId`, `distributionId?`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `Promise`\<`unknown`\>
611
611
 
612
612
  ##### Parameters
613
613
 
614
614
  | Name | Type |
615
615
  | :------ | :------ |
616
616
  | `surveyId` | `string` |
617
- | `distributionId` | `string` |
618
- | `allowMultipleResponses` | `boolean` |
619
- | `hiddenFields` | `PropertyRecord` |
620
- | `hooks?` | `Hooks` |
617
+ | `distributionId?` | `string` |
618
+ | `allowMultipleResponses?` | `boolean` |
619
+ | `hiddenFields?` | `PropertyRecord` |
620
+ | `hooks?` | `HooksSurveyStart` |
621
621
  | `language?` | `string` |
622
622
 
623
623
  ##### Returns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-react",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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.2.0"
44
+ "@screeb/sdk-browser": "^0.2.2"
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",