@screeb/sdk-browser 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.
@@ -16,6 +16,10 @@ export type Survey = {
16
16
  survey_format: SurveyFormat;
17
17
  survey_size: 100;
18
18
  };
19
+ export type Message = {
20
+ id: string;
21
+ messagey_size: 100;
22
+ };
19
23
  export type ResponseStatus = "displayed" | "started" | "ended" | "closed" | "interrupted";
20
24
  export type ResponseItemQuestion = {
21
25
  id: string;
@@ -40,42 +44,110 @@ export type ResponseItem = {
40
44
  export type HookCommonProperties = {
41
45
  channel: Channel;
42
46
  user: User;
47
+ };
48
+ export type HookCommonPropertiesSurvey = HookCommonProperties & {
43
49
  survey: Survey;
44
50
  };
51
+ export type HookCommonPropertiesMessage = HookCommonProperties & {
52
+ message: Message;
53
+ };
45
54
  export type HookOnReady = (data: {
46
55
  channel: Channel;
47
56
  user: User;
48
57
  }) => void;
49
- export type HookOnSurveyShowed = (data: HookCommonProperties & {
58
+ export type HookOnSurveyDisplayAllowed = (data: HookCommonPropertiesSurvey) => boolean;
59
+ export type HookOnMessageDisplayAllowed = (data: HookCommonPropertiesSurvey) => boolean;
60
+ export type HookOnSurveyShowed = (data: HookCommonPropertiesSurvey & {
50
61
  response: {
51
62
  id: string;
52
63
  items: ResponseItem[];
53
64
  };
54
65
  }) => void;
55
- export type HookOnSurveyStarted = (data: HookCommonProperties & {
66
+ export type HookOnSurveyStarted = (data: HookCommonPropertiesSurvey & {
56
67
  response: {
57
68
  id: string;
58
69
  };
59
70
  }) => void;
60
- export type HookOnQuestionReplied = (data: HookCommonProperties & {
71
+ export type HookOnSurveyCompleted = (data: HookCommonPropertiesSurvey & {
61
72
  response: {
62
73
  id: string;
63
- status: null;
64
- question: ResponseItemQuestion;
65
- answer: ResponseItemAnswer;
66
74
  items: ResponseItem[];
67
75
  };
68
76
  }) => void;
69
- export type HookOnSurveyCompleted = (data: HookCommonProperties & {
77
+ export type HookOnSurveyHidden = (data: HookCommonPropertiesSurvey & {
70
78
  response: {
71
79
  id: string;
72
80
  items: ResponseItem[];
81
+ hide_reason: ResponseStatus;
82
+ };
83
+ }) => void;
84
+ export type HookOnMessageShowed = (data: HookCommonPropertiesMessage & {
85
+ response: {
86
+ id: string;
87
+ items: ResponseItem[];
88
+ };
89
+ }) => void;
90
+ export type HookOnMessageStarted = (data: HookCommonPropertiesMessage & {
91
+ response: {
92
+ id: string;
73
93
  };
74
94
  }) => void;
75
- export type HookOnSurveyHidden = (data: HookCommonProperties & {
95
+ export type HookOnMessageCompleted = (data: HookCommonPropertiesMessage & {
96
+ response: {
97
+ id: string;
98
+ items: ResponseItem[];
99
+ };
100
+ }) => void;
101
+ export type HookOnMessageHidden = (data: HookCommonPropertiesMessage & {
76
102
  response: {
77
103
  id: string;
78
104
  items: ResponseItem[];
79
105
  hide_reason: ResponseStatus;
80
106
  };
81
107
  }) => void;
108
+ export type HookOnQuestionReplied = (data: HookCommonPropertiesSurvey & {
109
+ response: {
110
+ id: string;
111
+ status: null;
112
+ question: ResponseItemQuestion;
113
+ answer: ResponseItemAnswer;
114
+ items: ResponseItem[];
115
+ };
116
+ }) => void;
117
+ /** This is the Screeb tag hooks object available on `survey.start` command. */
118
+ export type HooksSurveyStart = {
119
+ /** This hook is triggered when a survey is displayed on screen (also triggered when page is reloaded) */
120
+ onSurveyShowed?: HookOnSurveyShowed;
121
+ /** This hook is triggered when a survey is started */
122
+ onSurveyStarted?: HookOnSurveyStarted;
123
+ /** This hook is triggered when a survey is completed */
124
+ onSurveyCompleted?: HookOnSurveyCompleted;
125
+ /** This hook is triggered when a survey is hidden */
126
+ onSurveyHidden?: HookOnSurveyHidden;
127
+ /** This hook is triggered when a question is answered */
128
+ onQuestionReplied?: HookOnQuestionReplied;
129
+ };
130
+ /** This is the Screeb tag hooks object available on `message.start` command. */
131
+ export type HooksMessageStart = {
132
+ /** This hook is triggered when a message is displayed on screen (also triggered when page is reloaded) */
133
+ onMessageShowed?: HookOnMessageShowed;
134
+ /** This hook is triggered when a message is started */
135
+ onMessageStarted?: HookOnMessageStarted;
136
+ /** This hook is triggered when a message is completed */
137
+ onMessageCompleted?: HookOnMessageCompleted;
138
+ /** This hook is triggered when a message is hidden */
139
+ onMessageHidden?: HookOnMessageHidden;
140
+ /** This hook is triggered when a question is answered */
141
+ onQuestionReplied?: HookOnQuestionReplied;
142
+ };
143
+ /** This is the Screeb tag hooks object available on `init` command. */
144
+ export type HooksInit = HooksSurveyStart & HooksMessageStart & {
145
+ /** This defines the version of hooks and their data */
146
+ version: string;
147
+ /** This hook is triggered when Screeb SD is loaded, initialized and ready to rock */
148
+ onReady?: HookOnReady;
149
+ /** This hook is triggered before a survey displays to allow it or not. */
150
+ onSurveyDisplayAllowed?: HookOnSurveyDisplayAllowed;
151
+ /** This hook is triggered before a message displays to allow it or not. */
152
+ onMessageDisplayAllowed?: HookOnMessageDisplayAllowed;
153
+ };
@@ -533,4 +533,4 @@ exports.surveyClose = surveyClose;
533
533
  exports.surveyStart = surveyStart;
534
534
  exports.targetingCheck = targetingCheck;
535
535
  exports.targetingDebug = targetingDebug;
536
- CONSTANTS.version = '0.2.0'
536
+ CONSTANTS.version = '0.2.2'
@@ -1,4 +1,5 @@
1
- import { Hooks, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "./types";
1
+ import { HooksInit, HooksMessageStart, HooksSurveyStart } from "./hooks.types";
2
+ import { PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "./types";
2
3
  export * from "./types";
3
4
  export * from "./hooks.types";
4
5
  /**
@@ -54,7 +55,7 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
54
55
  * );
55
56
  * ```
56
57
  */
57
- export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
58
+ export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => void | Promise<unknown>;
58
59
  /**
59
60
  * Checks if Screeb tag has been loaded.
60
61
  *
@@ -315,7 +316,7 @@ export declare const surveyClose: () => void | Promise<unknown>;
315
316
  * );
316
317
  * ```
317
318
  */
318
- export declare const surveyStart: (surveyId: string, distributionId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
319
+ export declare const surveyStart: (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => void | Promise<unknown>;
319
320
  /**
320
321
  * Interrupts a running message.
321
322
  *
@@ -349,7 +350,7 @@ export declare const messageClose: () => void | Promise<unknown>;
349
350
  * );
350
351
  * ```
351
352
  */
352
- export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
353
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => void | Promise<unknown>;
353
354
  /**
354
355
  * Forces a targeting check.
355
356
  *
@@ -1,4 +1,3 @@
1
- import { HookOnQuestionReplied, HookOnReady, HookOnSurveyCompleted, HookOnSurveyHidden, HookOnSurveyShowed, HookOnSurveyStarted } from "./hooks.types";
2
1
  /** This is property types that are supported by Screeb. */
3
2
  export type PropertyType = number | boolean | string | Date | PropertyRecord;
4
3
  /** This is a property object that are supported by Screeb. */
@@ -45,20 +44,3 @@ export type ScreebIdentityGetReturn = {
45
44
  /** `true` if the tag is loaded, initialized and ready to rock */
46
45
  is_ready: boolean;
47
46
  };
48
- /** This is the Screeb tag hooks object. */
49
- export type Hooks = {
50
- /** This defines the version of hooks and their data */
51
- version: string;
52
- /** This hook is triggered when Screeb SD is loaded, initialized and ready to rock */
53
- onReady?: HookOnReady;
54
- /** This hook is triggered when a survey is displayed on screen (also triggered when page is reloaded) */
55
- onSurveyShowed?: HookOnSurveyShowed;
56
- /** This hook is triggered when a survey is started */
57
- onSurveyStarted?: HookOnSurveyStarted;
58
- /** This hook is triggered when a question is answered */
59
- onQuestionReplied?: HookOnQuestionReplied;
60
- /** This hook is triggered when a survey is completed */
61
- onSurveyCompleted?: HookOnSurveyCompleted;
62
- /** This hook is triggered when a survey is hidden */
63
- onSurveyHidden?: HookOnSurveyHidden;
64
- };
@@ -16,6 +16,10 @@ export type Survey = {
16
16
  survey_format: SurveyFormat;
17
17
  survey_size: 100;
18
18
  };
19
+ export type Message = {
20
+ id: string;
21
+ messagey_size: 100;
22
+ };
19
23
  export type ResponseStatus = "displayed" | "started" | "ended" | "closed" | "interrupted";
20
24
  export type ResponseItemQuestion = {
21
25
  id: string;
@@ -40,42 +44,110 @@ export type ResponseItem = {
40
44
  export type HookCommonProperties = {
41
45
  channel: Channel;
42
46
  user: User;
47
+ };
48
+ export type HookCommonPropertiesSurvey = HookCommonProperties & {
43
49
  survey: Survey;
44
50
  };
51
+ export type HookCommonPropertiesMessage = HookCommonProperties & {
52
+ message: Message;
53
+ };
45
54
  export type HookOnReady = (data: {
46
55
  channel: Channel;
47
56
  user: User;
48
57
  }) => void;
49
- export type HookOnSurveyShowed = (data: HookCommonProperties & {
58
+ export type HookOnSurveyDisplayAllowed = (data: HookCommonPropertiesSurvey) => boolean;
59
+ export type HookOnMessageDisplayAllowed = (data: HookCommonPropertiesSurvey) => boolean;
60
+ export type HookOnSurveyShowed = (data: HookCommonPropertiesSurvey & {
50
61
  response: {
51
62
  id: string;
52
63
  items: ResponseItem[];
53
64
  };
54
65
  }) => void;
55
- export type HookOnSurveyStarted = (data: HookCommonProperties & {
66
+ export type HookOnSurveyStarted = (data: HookCommonPropertiesSurvey & {
56
67
  response: {
57
68
  id: string;
58
69
  };
59
70
  }) => void;
60
- export type HookOnQuestionReplied = (data: HookCommonProperties & {
71
+ export type HookOnSurveyCompleted = (data: HookCommonPropertiesSurvey & {
61
72
  response: {
62
73
  id: string;
63
- status: null;
64
- question: ResponseItemQuestion;
65
- answer: ResponseItemAnswer;
66
74
  items: ResponseItem[];
67
75
  };
68
76
  }) => void;
69
- export type HookOnSurveyCompleted = (data: HookCommonProperties & {
77
+ export type HookOnSurveyHidden = (data: HookCommonPropertiesSurvey & {
70
78
  response: {
71
79
  id: string;
72
80
  items: ResponseItem[];
81
+ hide_reason: ResponseStatus;
82
+ };
83
+ }) => void;
84
+ export type HookOnMessageShowed = (data: HookCommonPropertiesMessage & {
85
+ response: {
86
+ id: string;
87
+ items: ResponseItem[];
88
+ };
89
+ }) => void;
90
+ export type HookOnMessageStarted = (data: HookCommonPropertiesMessage & {
91
+ response: {
92
+ id: string;
73
93
  };
74
94
  }) => void;
75
- export type HookOnSurveyHidden = (data: HookCommonProperties & {
95
+ export type HookOnMessageCompleted = (data: HookCommonPropertiesMessage & {
96
+ response: {
97
+ id: string;
98
+ items: ResponseItem[];
99
+ };
100
+ }) => void;
101
+ export type HookOnMessageHidden = (data: HookCommonPropertiesMessage & {
76
102
  response: {
77
103
  id: string;
78
104
  items: ResponseItem[];
79
105
  hide_reason: ResponseStatus;
80
106
  };
81
107
  }) => void;
108
+ export type HookOnQuestionReplied = (data: HookCommonPropertiesSurvey & {
109
+ response: {
110
+ id: string;
111
+ status: null;
112
+ question: ResponseItemQuestion;
113
+ answer: ResponseItemAnswer;
114
+ items: ResponseItem[];
115
+ };
116
+ }) => void;
117
+ /** This is the Screeb tag hooks object available on `survey.start` command. */
118
+ export type HooksSurveyStart = {
119
+ /** This hook is triggered when a survey is displayed on screen (also triggered when page is reloaded) */
120
+ onSurveyShowed?: HookOnSurveyShowed;
121
+ /** This hook is triggered when a survey is started */
122
+ onSurveyStarted?: HookOnSurveyStarted;
123
+ /** This hook is triggered when a survey is completed */
124
+ onSurveyCompleted?: HookOnSurveyCompleted;
125
+ /** This hook is triggered when a survey is hidden */
126
+ onSurveyHidden?: HookOnSurveyHidden;
127
+ /** This hook is triggered when a question is answered */
128
+ onQuestionReplied?: HookOnQuestionReplied;
129
+ };
130
+ /** This is the Screeb tag hooks object available on `message.start` command. */
131
+ export type HooksMessageStart = {
132
+ /** This hook is triggered when a message is displayed on screen (also triggered when page is reloaded) */
133
+ onMessageShowed?: HookOnMessageShowed;
134
+ /** This hook is triggered when a message is started */
135
+ onMessageStarted?: HookOnMessageStarted;
136
+ /** This hook is triggered when a message is completed */
137
+ onMessageCompleted?: HookOnMessageCompleted;
138
+ /** This hook is triggered when a message is hidden */
139
+ onMessageHidden?: HookOnMessageHidden;
140
+ /** This hook is triggered when a question is answered */
141
+ onQuestionReplied?: HookOnQuestionReplied;
142
+ };
143
+ /** This is the Screeb tag hooks object available on `init` command. */
144
+ export type HooksInit = HooksSurveyStart & HooksMessageStart & {
145
+ /** This defines the version of hooks and their data */
146
+ version: string;
147
+ /** This hook is triggered when Screeb SD is loaded, initialized and ready to rock */
148
+ onReady?: HookOnReady;
149
+ /** This hook is triggered before a survey displays to allow it or not. */
150
+ onSurveyDisplayAllowed?: HookOnSurveyDisplayAllowed;
151
+ /** This hook is triggered before a message displays to allow it or not. */
152
+ onMessageDisplayAllowed?: HookOnMessageDisplayAllowed;
153
+ };
@@ -1,4 +1,5 @@
1
- import { Hooks, PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "./types";
1
+ import { HooksInit, HooksMessageStart, HooksSurveyStart } from "./hooks.types";
2
+ import { PropertyRecord, ScreebIdentityGetReturn, ScreebOptions } from "./types";
2
3
  export * from "./types";
3
4
  export * from "./hooks.types";
4
5
  /**
@@ -54,7 +55,7 @@ export declare const load: (options?: ScreebOptions) => Promise<undefined>;
54
55
  * );
55
56
  * ```
56
57
  */
57
- export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
58
+ export declare const init: (websiteId: string, userId?: string, userProperties?: PropertyRecord, hooks?: HooksInit, language?: string) => void | Promise<unknown>;
58
59
  /**
59
60
  * Checks if Screeb tag has been loaded.
60
61
  *
@@ -315,7 +316,7 @@ export declare const surveyClose: () => void | Promise<unknown>;
315
316
  * );
316
317
  * ```
317
318
  */
318
- export declare const surveyStart: (surveyId: string, distributionId: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
319
+ export declare const surveyStart: (surveyId: string, distributionId?: string, allowMultipleResponses?: boolean, hiddenFields?: PropertyRecord, hooks?: HooksSurveyStart, language?: string) => void | Promise<unknown>;
319
320
  /**
320
321
  * Interrupts a running message.
321
322
  *
@@ -349,7 +350,7 @@ export declare const messageClose: () => void | Promise<unknown>;
349
350
  * );
350
351
  * ```
351
352
  */
352
- export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: Hooks, language?: string) => void | Promise<unknown>;
353
+ export declare const messageStart: (messageId: string, hiddenFields?: PropertyRecord, hooks?: HooksMessageStart, language?: string) => void | Promise<unknown>;
353
354
  /**
354
355
  * Forces a targeting check.
355
356
  *
package/dist/es/index.mjs CHANGED
@@ -514,4 +514,4 @@ var targetingCheck = function () { return callScreebCommand("targeting.check");
514
514
  var targetingDebug = function () { return callScreebCommand("targeting.debug"); };
515
515
 
516
516
  export { close, debug, eventTrack, identity, identityGet, identityGroupAssign, identityGroupUnassign, identityProperties, identityReset, init, isLoaded, load, messageClose, messageStart, surveyClose, surveyStart, targetingCheck, targetingDebug };
517
- CONSTANTS.version = '0.2.0'
517
+ CONSTANTS.version = '0.2.2'
@@ -1,4 +1,3 @@
1
- import { HookOnQuestionReplied, HookOnReady, HookOnSurveyCompleted, HookOnSurveyHidden, HookOnSurveyShowed, HookOnSurveyStarted } from "./hooks.types";
2
1
  /** This is property types that are supported by Screeb. */
3
2
  export type PropertyType = number | boolean | string | Date | PropertyRecord;
4
3
  /** This is a property object that are supported by Screeb. */
@@ -45,20 +44,3 @@ export type ScreebIdentityGetReturn = {
45
44
  /** `true` if the tag is loaded, initialized and ready to rock */
46
45
  is_ready: boolean;
47
46
  };
48
- /** This is the Screeb tag hooks object. */
49
- export type Hooks = {
50
- /** This defines the version of hooks and their data */
51
- version: string;
52
- /** This hook is triggered when Screeb SD is loaded, initialized and ready to rock */
53
- onReady?: HookOnReady;
54
- /** This hook is triggered when a survey is displayed on screen (also triggered when page is reloaded) */
55
- onSurveyShowed?: HookOnSurveyShowed;
56
- /** This hook is triggered when a survey is started */
57
- onSurveyStarted?: HookOnSurveyStarted;
58
- /** This hook is triggered when a question is answered */
59
- onQuestionReplied?: HookOnQuestionReplied;
60
- /** This hook is triggered when a survey is completed */
61
- onSurveyCompleted?: HookOnSurveyCompleted;
62
- /** This hook is triggered when a survey is hidden */
63
- onSurveyHidden?: HookOnSurveyHidden;
64
- };
package/docs/README.md CHANGED
@@ -9,13 +9,24 @@
9
9
  - [Channel](README.md#channel)
10
10
  - [ChannelType](README.md#channeltype)
11
11
  - [HookCommonProperties](README.md#hookcommonproperties)
12
+ - [HookCommonPropertiesMessage](README.md#hookcommonpropertiesmessage)
13
+ - [HookCommonPropertiesSurvey](README.md#hookcommonpropertiessurvey)
14
+ - [HookOnMessageCompleted](README.md#hookonmessagecompleted)
15
+ - [HookOnMessageDisplayAllowed](README.md#hookonmessagedisplayallowed)
16
+ - [HookOnMessageHidden](README.md#hookonmessagehidden)
17
+ - [HookOnMessageShowed](README.md#hookonmessageshowed)
18
+ - [HookOnMessageStarted](README.md#hookonmessagestarted)
12
19
  - [HookOnQuestionReplied](README.md#hookonquestionreplied)
13
20
  - [HookOnReady](README.md#hookonready)
14
21
  - [HookOnSurveyCompleted](README.md#hookonsurveycompleted)
22
+ - [HookOnSurveyDisplayAllowed](README.md#hookonsurveydisplayallowed)
15
23
  - [HookOnSurveyHidden](README.md#hookonsurveyhidden)
16
24
  - [HookOnSurveyShowed](README.md#hookonsurveyshowed)
17
25
  - [HookOnSurveyStarted](README.md#hookonsurveystarted)
18
- - [Hooks](README.md#hooks)
26
+ - [HooksInit](README.md#hooksinit)
27
+ - [HooksMessageStart](README.md#hooksmessagestart)
28
+ - [HooksSurveyStart](README.md#hookssurveystart)
29
+ - [Message](README.md#message)
19
30
  - [PropertyRecord](README.md#propertyrecord)
20
31
  - [PropertyType](README.md#propertytype)
21
32
  - [ResponseItem](README.md#responseitem)
@@ -83,14 +94,125 @@ ___
83
94
  | Name | Type |
84
95
  | :------ | :------ |
85
96
  | `channel` | [`Channel`](README.md#channel) |
86
- | `survey` | [`Survey`](README.md#survey) |
87
97
  | `user` | [`User`](README.md#user) |
88
98
 
89
99
  ___
90
100
 
101
+ ### HookCommonPropertiesMessage
102
+
103
+ Ƭ **HookCommonPropertiesMessage**: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `message`: [`Message`](README.md#message) }
104
+
105
+ ___
106
+
107
+ ### HookCommonPropertiesSurvey
108
+
109
+ Ƭ **HookCommonPropertiesSurvey**: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `survey`: [`Survey`](README.md#survey) }
110
+
111
+ ___
112
+
113
+ ### HookOnMessageCompleted
114
+
115
+ Ƭ **HookOnMessageCompleted**: (`data`: [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
116
+
117
+ #### Type declaration
118
+
119
+ ▸ (`data`): `void`
120
+
121
+ ##### Parameters
122
+
123
+ | Name | Type |
124
+ | :------ | :------ |
125
+ | `data` | [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
126
+
127
+ ##### Returns
128
+
129
+ `void`
130
+
131
+ ___
132
+
133
+ ### HookOnMessageDisplayAllowed
134
+
135
+ Ƭ **HookOnMessageDisplayAllowed**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey)) => `boolean`
136
+
137
+ #### Type declaration
138
+
139
+ ▸ (`data`): `boolean`
140
+
141
+ ##### Parameters
142
+
143
+ | Name | Type |
144
+ | :------ | :------ |
145
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) |
146
+
147
+ ##### Returns
148
+
149
+ `boolean`
150
+
151
+ ___
152
+
153
+ ### HookOnMessageHidden
154
+
155
+ Ƭ **HookOnMessageHidden**: (`data`: [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
156
+
157
+ #### Type declaration
158
+
159
+ ▸ (`data`): `void`
160
+
161
+ ##### Parameters
162
+
163
+ | Name | Type |
164
+ | :------ | :------ |
165
+ | `data` | [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
166
+
167
+ ##### Returns
168
+
169
+ `void`
170
+
171
+ ___
172
+
173
+ ### HookOnMessageShowed
174
+
175
+ Ƭ **HookOnMessageShowed**: (`data`: [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
176
+
177
+ #### Type declaration
178
+
179
+ ▸ (`data`): `void`
180
+
181
+ ##### Parameters
182
+
183
+ | Name | Type |
184
+ | :------ | :------ |
185
+ | `data` | [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
186
+
187
+ ##### Returns
188
+
189
+ `void`
190
+
191
+ ___
192
+
193
+ ### HookOnMessageStarted
194
+
195
+ Ƭ **HookOnMessageStarted**: (`data`: [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` } }) => `void`
196
+
197
+ #### Type declaration
198
+
199
+ ▸ (`data`): `void`
200
+
201
+ ##### Parameters
202
+
203
+ | Name | Type |
204
+ | :------ | :------ |
205
+ | `data` | [`HookCommonPropertiesMessage`](README.md#hookcommonpropertiesmessage) & \{ `response`: \{ `id`: `string` } } |
206
+
207
+ ##### Returns
208
+
209
+ `void`
210
+
211
+ ___
212
+
91
213
  ### HookOnQuestionReplied
92
214
 
93
- Ƭ **HookOnQuestionReplied**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } }) => `void`
215
+ Ƭ **HookOnQuestionReplied**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } }) => `void`
94
216
 
95
217
  #### Type declaration
96
218
 
@@ -100,7 +222,7 @@ ___
100
222
 
101
223
  | Name | Type |
102
224
  | :------ | :------ |
103
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } } |
225
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `answer`: [`ResponseItemAnswer`](README.md#responseitemanswer) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] ; `question`: [`ResponseItemQuestion`](README.md#responseitemquestion) ; `status`: ``null`` } } |
104
226
 
105
227
  ##### Returns
106
228
 
@@ -132,7 +254,7 @@ ___
132
254
 
133
255
  ### HookOnSurveyCompleted
134
256
 
135
- Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
257
+ Ƭ **HookOnSurveyCompleted**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
136
258
 
137
259
  #### Type declaration
138
260
 
@@ -142,7 +264,7 @@ ___
142
264
 
143
265
  | Name | Type |
144
266
  | :------ | :------ |
145
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
267
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
146
268
 
147
269
  ##### Returns
148
270
 
@@ -150,9 +272,29 @@ ___
150
272
 
151
273
  ___
152
274
 
275
+ ### HookOnSurveyDisplayAllowed
276
+
277
+ Ƭ **HookOnSurveyDisplayAllowed**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey)) => `boolean`
278
+
279
+ #### Type declaration
280
+
281
+ ▸ (`data`): `boolean`
282
+
283
+ ##### Parameters
284
+
285
+ | Name | Type |
286
+ | :------ | :------ |
287
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) |
288
+
289
+ ##### Returns
290
+
291
+ `boolean`
292
+
293
+ ___
294
+
153
295
  ### HookOnSurveyHidden
154
296
 
155
- Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
297
+ Ƭ **HookOnSurveyHidden**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
156
298
 
157
299
  #### Type declaration
158
300
 
@@ -162,7 +304,7 @@ ___
162
304
 
163
305
  | Name | Type |
164
306
  | :------ | :------ |
165
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
307
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `hide_reason`: [`ResponseStatus`](README.md#responsestatus) ; `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
166
308
 
167
309
  ##### Returns
168
310
 
@@ -172,7 +314,7 @@ ___
172
314
 
173
315
  ### HookOnSurveyShowed
174
316
 
175
- Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
317
+ Ƭ **HookOnSurveyShowed**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } }) => `void`
176
318
 
177
319
  #### Type declaration
178
320
 
@@ -182,7 +324,7 @@ ___
182
324
 
183
325
  | Name | Type |
184
326
  | :------ | :------ |
185
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
327
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` ; `items`: [`ResponseItem`](README.md#responseitem)[] } } |
186
328
 
187
329
  ##### Returns
188
330
 
@@ -192,7 +334,7 @@ ___
192
334
 
193
335
  ### HookOnSurveyStarted
194
336
 
195
- Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } }) => `void`
337
+ Ƭ **HookOnSurveyStarted**: (`data`: [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` } }) => `void`
196
338
 
197
339
  #### Type declaration
198
340
 
@@ -202,7 +344,7 @@ ___
202
344
 
203
345
  | Name | Type |
204
346
  | :------ | :------ |
205
- | `data` | [`HookCommonProperties`](README.md#hookcommonproperties) & \{ `response`: \{ `id`: `string` } } |
347
+ | `data` | [`HookCommonPropertiesSurvey`](README.md#hookcommonpropertiessurvey) & \{ `response`: \{ `id`: `string` } } |
206
348
 
207
349
  ##### Returns
208
350
 
@@ -210,23 +352,60 @@ ___
210
352
 
211
353
  ___
212
354
 
213
- ### Hooks
355
+ ### HooksInit
214
356
 
215
- Ƭ **Hooks**: `Object`
357
+ Ƭ **HooksInit**: [`HooksSurveyStart`](README.md#hookssurveystart) & [`HooksMessageStart`](README.md#hooksmessagestart) & \{ `onMessageDisplayAllowed?`: [`HookOnMessageDisplayAllowed`](README.md#hookonmessagedisplayallowed) ; `onReady?`: [`HookOnReady`](README.md#hookonready) ; `onSurveyDisplayAllowed?`: [`HookOnSurveyDisplayAllowed`](README.md#hookonsurveydisplayallowed) ; `version`: `string` }
216
358
 
217
- This is the Screeb tag hooks object.
359
+ This is the Screeb tag hooks object available on `init` command.
360
+
361
+ ___
362
+
363
+ ### HooksMessageStart
364
+
365
+ Ƭ **HooksMessageStart**: `Object`
366
+
367
+ This is the Screeb tag hooks object available on `message.start` command.
368
+
369
+ #### Type declaration
370
+
371
+ | Name | Type | Description |
372
+ | :------ | :------ | :------ |
373
+ | `onMessageCompleted?` | [`HookOnMessageCompleted`](README.md#hookonmessagecompleted) | This hook is triggered when a message is completed |
374
+ | `onMessageHidden?` | [`HookOnMessageHidden`](README.md#hookonmessagehidden) | This hook is triggered when a message is hidden |
375
+ | `onMessageShowed?` | [`HookOnMessageShowed`](README.md#hookonmessageshowed) | This hook is triggered when a message is displayed on screen (also triggered when page is reloaded) |
376
+ | `onMessageStarted?` | [`HookOnMessageStarted`](README.md#hookonmessagestarted) | This hook is triggered when a message is started |
377
+ | `onQuestionReplied?` | [`HookOnQuestionReplied`](README.md#hookonquestionreplied) | This hook is triggered when a question is answered |
378
+
379
+ ___
380
+
381
+ ### HooksSurveyStart
382
+
383
+ Ƭ **HooksSurveyStart**: `Object`
384
+
385
+ This is the Screeb tag hooks object available on `survey.start` command.
218
386
 
219
387
  #### Type declaration
220
388
 
221
389
  | Name | Type | Description |
222
390
  | :------ | :------ | :------ |
223
391
  | `onQuestionReplied?` | [`HookOnQuestionReplied`](README.md#hookonquestionreplied) | This hook is triggered when a question is answered |
224
- | `onReady?` | [`HookOnReady`](README.md#hookonready) | This hook is triggered when Screeb SD is loaded, initialized and ready to rock |
225
392
  | `onSurveyCompleted?` | [`HookOnSurveyCompleted`](README.md#hookonsurveycompleted) | This hook is triggered when a survey is completed |
226
393
  | `onSurveyHidden?` | [`HookOnSurveyHidden`](README.md#hookonsurveyhidden) | This hook is triggered when a survey is hidden |
227
394
  | `onSurveyShowed?` | [`HookOnSurveyShowed`](README.md#hookonsurveyshowed) | This hook is triggered when a survey is displayed on screen (also triggered when page is reloaded) |
228
395
  | `onSurveyStarted?` | [`HookOnSurveyStarted`](README.md#hookonsurveystarted) | This hook is triggered when a survey is started |
229
- | `version` | `string` | This defines the version of hooks and their data |
396
+
397
+ ___
398
+
399
+ ### Message
400
+
401
+ Ƭ **Message**: `Object`
402
+
403
+ #### Type declaration
404
+
405
+ | Name | Type |
406
+ | :------ | :------ |
407
+ | `id` | `string` |
408
+ | `messagey_size` | ``100`` |
230
409
 
231
410
  ___
232
411
 
@@ -715,7 +894,7 @@ Initializes Screeb tag.
715
894
  | `websiteId` | `string` | Your website/channel id. |
716
895
  | `userId?` | `string` | The unique identifier of your user. |
717
896
  | `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 ``` |
718
- | `hooks?` | [`Hooks`](README.md#hooks) | Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden or when a question is replied. |
897
+ | `hooks?` | [`HooksInit`](README.md#hooksinit) | Hooks to be called when SDK is ready or a survey is showed, started, completed, hidden or when a question is replied. |
719
898
  | `language?` | `string` | Force a specific language for the tag. eg: 'en'. default: browser language. |
720
899
 
721
900
  #### Returns
@@ -827,7 +1006,7 @@ Starts a message by its ID.
827
1006
  | :------ | :------ |
828
1007
  | `messageId` | `string` |
829
1008
  | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) |
830
- | `hooks?` | [`Hooks`](README.md#hooks) |
1009
+ | `hooks?` | [`HooksMessageStart`](README.md#hooksmessagestart) |
831
1010
  | `language?` | `string` |
832
1011
 
833
1012
  #### Returns
@@ -878,7 +1057,7 @@ ___
878
1057
 
879
1058
  ### surveyStart
880
1059
 
881
- ▸ **surveyStart**(`surveyId`, `distributionId`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
1060
+ ▸ **surveyStart**(`surveyId`, `distributionId?`, `allowMultipleResponses?`, `hiddenFields?`, `hooks?`, `language?`): `void` \| `Promise`\<`unknown`\>
882
1061
 
883
1062
  Starts a survey by its ID.
884
1063
 
@@ -887,10 +1066,10 @@ Starts a survey by its ID.
887
1066
  | Name | Type | Default value |
888
1067
  | :------ | :------ | :------ |
889
1068
  | `surveyId` | `string` | `undefined` |
890
- | `distributionId` | `string` | `undefined` |
1069
+ | `distributionId?` | `string` | `undefined` |
891
1070
  | `allowMultipleResponses` | `boolean` | `true` |
892
1071
  | `hiddenFields` | [`PropertyRecord`](README.md#propertyrecord) | `{}` |
893
- | `hooks?` | [`Hooks`](README.md#hooks) | `undefined` |
1072
+ | `hooks?` | [`HooksSurveyStart`](README.md#hookssurveystart) | `undefined` |
894
1073
  | `language?` | `string` | `undefined` |
895
1074
 
896
1075
  #### Returns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screeb/sdk-browser",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Screeb's browser sdk.",
5
5
  "keywords": [
6
6
  "product discovery",