@screeb/react-native 3.1.1 → 3.3.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/README.md +91 -24
- package/lib/module/NativeScreebReactNative.js +3 -3
- package/lib/module/NativeScreebReactNative.js.map +1 -1
- package/lib/module/index.js +17 -17
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeScreebReactNative.d.ts +1 -1
- package/lib/typescript/src/NativeScreebReactNative.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +16 -21
- package/src/NativeScreebReactNative.ts +72 -72
- package/src/index.tsx +232 -230
package/README.md
CHANGED
|
@@ -1,38 +1,93 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<a href="https://screeb.app" alt="Screeb">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/ScreebApp/sdk/master/packages/sdk-reactnative/readme/screeb-logo.svg" alt="Logo" height="120px" style="margin-top: 20px;"/>
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">@screeb/react-native</h1>
|
|
7
|
+
<p align="center">
|
|
8
|
+
Screeb's mobile sdk for React Native (Android & iOS).
|
|
9
|
+
|
|
10
|
+
<b>Continuous Product Discovery, Without the Time Sink.</b>
|
|
11
|
+
|
|
12
|
+
<a href="https://screeb.app" alt="Screeb">Screeb</a> is the only Continuous Product Discovery platform that lets you analyse users' behaviour, ask in-app questions, recruit people for interviews and analyse data in a blink with AI.
|
|
6
13
|
</p>
|
|
7
14
|
|
|
8
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://github.com/ScreebApp/sdk/actions/workflows/ci.yml" alt="ci">
|
|
17
|
+
<img alt="ci" src="https://github.com/ScreebApp/sdk/actions/workflows/ci.yml/badge.svg">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@screeb/react-native" alt="version">
|
|
20
|
+
<img alt="npm screeb/react-native" src="https://img.shields.io/npm/v/@screeb/react-native">
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://cocoapods.org/pods/Screeb" alt="CocoaPods">
|
|
23
|
+
<img src="https://img.shields.io/cocoapods/v/Screeb.svg?style=flat" alt="Cocoapods">
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://search.maven.org/search?q=g:%22app.screeb.sdk%22%20AND%20a:%22survey%22" alt="Maven Central">
|
|
26
|
+
<img src="https://img.shields.io/maven-central/v/app.screeb.sdk/survey.svg?label=Maven%20Central" alt="Maven Central">
|
|
27
|
+
</a>
|
|
28
|
+
<a href="https://opensource.org/licenses/MIT">
|
|
29
|
+
<img src="https://img.shields.io/badge/license-MIT-purple.svg" alt="License: MIT">
|
|
30
|
+
</a>
|
|
31
|
+
<img alt="downloads" src="https://badgen.net/npm/dw/@screeb/react-native" />
|
|
32
|
+
</p>
|
|
9
33
|
|
|
10
|
-
A react-native module to integrate Screeb mobile sdk for Android and/or iOS.
|
|
11
34
|
|
|
12
|
-
##
|
|
35
|
+
## Installation
|
|
13
36
|
|
|
14
|
-
|
|
37
|
+
This library is published in the NPM registry and can be installed using any compatible package manager.
|
|
15
38
|
|
|
16
|
-
|
|
39
|
+
```bash
|
|
40
|
+
npm install @screeb/react-native --save
|
|
17
41
|
|
|
18
|
-
|
|
42
|
+
# For Yarn, use the command below.
|
|
43
|
+
yarn add @screeb/react-native
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For iOS, also run:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cd ios && pod install
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
Basic usage:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
import { Screeb } from '@screeb/react-native';
|
|
58
|
+
|
|
59
|
+
// Initialize Screeb SDK
|
|
60
|
+
Screeb.initSdk("<channel-id>");
|
|
61
|
+
|
|
62
|
+
// Optional: identify visitor
|
|
63
|
+
Screeb.setIdentity("<user-id>", {
|
|
64
|
+
firstname: "<user-firstname>",
|
|
65
|
+
lastname: "<user-lastname>",
|
|
66
|
+
plan: "<user-plan>",
|
|
67
|
+
age: 42,
|
|
68
|
+
authenticated: true,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For working examples, see:
|
|
73
|
+
- [React Native CLI example](https://github.com/ScreebApp/sdk/tree/master/examples/example-reactnative)
|
|
74
|
+
- [Expo example](https://github.com/ScreebApp/sdk/tree/master/examples/example-expo)
|
|
75
|
+
|
|
76
|
+
For further information, see [our developer documentation](https://developers.screeb.app/sdk-react-native/install).
|
|
19
77
|
|
|
20
78
|
## Run examples
|
|
21
79
|
|
|
22
80
|
### React Native CLI example
|
|
23
81
|
|
|
24
82
|
```sh
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
cd example/
|
|
28
|
-
yarn install
|
|
83
|
+
npm install
|
|
29
84
|
|
|
30
|
-
cd ios
|
|
85
|
+
cd examples/example-reactnative/ios
|
|
31
86
|
pod install
|
|
32
|
-
cd
|
|
87
|
+
cd ../../..
|
|
33
88
|
|
|
34
|
-
|
|
35
|
-
|
|
89
|
+
npm run android --workspace=example-reactnative
|
|
90
|
+
npm run ios --workspace=example-reactnative
|
|
36
91
|
```
|
|
37
92
|
|
|
38
93
|
### Expo example
|
|
@@ -40,17 +95,29 @@ yarn ios
|
|
|
40
95
|
The Expo project lives in `example-expo`. It builds a full native binary (Expo Go will not load custom native modules).
|
|
41
96
|
|
|
42
97
|
```sh
|
|
43
|
-
|
|
98
|
+
npm install
|
|
44
99
|
|
|
45
|
-
|
|
46
|
-
|
|
100
|
+
npm run prebuild --workspace=example-expo
|
|
101
|
+
npm run ios --workspace=example-expo # or android
|
|
47
102
|
|
|
48
103
|
# in another terminal, from the repo root
|
|
49
|
-
|
|
104
|
+
npm run example:expo --workspace=@screeb/react-native
|
|
50
105
|
```
|
|
51
106
|
|
|
52
|
-
Re-run `prebuild` whenever native configuration changes
|
|
107
|
+
Re-run `prebuild` whenever native configuration changes. Use `npm run prebuild --workspace=example-expo -- --clean` if you need to fully regenerate the iOS/Android projects.
|
|
108
|
+
|
|
109
|
+
## Changelog
|
|
110
|
+
|
|
111
|
+
[See here.](https://www.notion.so/screeb/ReactNative-SDK-30e8dc27fa7a4dea979084d83e5140c3)
|
|
112
|
+
|
|
113
|
+
## Support
|
|
114
|
+
|
|
115
|
+
For any issues, please contact our support team at support@screeb.com.
|
|
116
|
+
|
|
117
|
+
## Contributing
|
|
118
|
+
|
|
119
|
+
All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under.
|
|
53
120
|
|
|
54
121
|
## License
|
|
55
122
|
|
|
56
|
-
MIT
|
|
123
|
+
Released under [MIT License](https://github.com/ScreebApp/sdk/blob/master/LICENSE).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { TurboModuleRegistry } from
|
|
4
|
-
const module = TurboModuleRegistry.get(
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
const module = TurboModuleRegistry.get('ScreebReactNative');
|
|
5
5
|
if (!module) {
|
|
6
|
-
const LINKING_ERROR = `The native module "ScreebReactNative" could not be found.\n` + "- Ensure the iOS/Android native code is compiled (iOS: run 'pod install' in the example app, then rebuild).\n" + "- If you're developing locally, run 'yarn prepare' to rebuild the JS output.\n" +
|
|
6
|
+
const LINKING_ERROR = `The native module "ScreebReactNative" could not be found.\n` + "- Ensure the iOS/Android native code is compiled (iOS: run 'pod install' in the example app, then rebuild).\n" + "- If you're developing locally, run 'yarn prepare' to rebuild the JS output.\n" + '- On iOS, make sure the podspec is included and the app is rebuilt (not just reloaded).';
|
|
7
7
|
throw new Error(LINKING_ERROR);
|
|
8
8
|
}
|
|
9
9
|
export default module;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","module","get","LINKING_ERROR","Error"],"sourceRoot":"../../src","sources":["NativeScreebReactNative.ts"],"mappings":";;AAAA,SAA2BA,mBAAmB,QAAQ,cAAc;AAyEpE,MAAMC,MAAM,GAAGD,mBAAmB,CAACE,GAAG,CAAO,mBAAmB,CAAC;AACjE,IAAI,CAACD,MAAM,EAAE;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","module","get","LINKING_ERROR","Error"],"sourceRoot":"../../src","sources":["NativeScreebReactNative.ts"],"mappings":";;AAAA,SAA2BA,mBAAmB,QAAQ,cAAc;AAyEpE,MAAMC,MAAM,GAAGD,mBAAmB,CAACE,GAAG,CAAO,mBAAmB,CAAC;AACjE,IAAI,CAACD,MAAM,EAAE;EACX,MAAME,aAAa,GACjB,6DAA6D,GAC7D,+GAA+G,GAC/G,gFAAgF,GAChF,yFAAyF;EAC3F,MAAM,IAAIC,KAAK,CAACD,aAAa,CAAC;AAChC;AAEA,eAAeF,MAAM","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from
|
|
3
|
+
import { DeviceEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
4
4
|
import ScreebReactNative from "./NativeScreebReactNative.js";
|
|
5
5
|
|
|
6
6
|
// biome-ignore lint/suspicious/noExplicitAny: .
|
|
@@ -9,17 +9,17 @@ let emitter;
|
|
|
9
9
|
export function initSdk(channelId, userId, properties, hooks, initOptions, language) {
|
|
10
10
|
// Use NativeEventEmitter on both platforms; pass the native module on iOS
|
|
11
11
|
// and rely on the default emitter on Android.
|
|
12
|
-
if (Platform.OS ===
|
|
12
|
+
if (Platform.OS === 'ios') {
|
|
13
13
|
emitter = new NativeEventEmitter(NativeModules.ScreebReactNative);
|
|
14
14
|
} else {
|
|
15
15
|
emitter = DeviceEventEmitter;
|
|
16
16
|
}
|
|
17
|
-
emitter.addListener(
|
|
17
|
+
emitter.addListener('ScreebEvent', handleEvent);
|
|
18
18
|
let mapHooksId;
|
|
19
19
|
if (hooks != null) {
|
|
20
20
|
mapHooksId = {};
|
|
21
21
|
Object.keys(hooks).forEach(key => {
|
|
22
|
-
if (key ===
|
|
22
|
+
if (key === 'version') {
|
|
23
23
|
const v = hooks.version ?? undefined;
|
|
24
24
|
if (v) mapHooksId = {
|
|
25
25
|
...mapHooksId,
|
|
@@ -28,7 +28,7 @@ export function initSdk(channelId, userId, properties, hooks, initOptions, langu
|
|
|
28
28
|
} else {
|
|
29
29
|
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
30
30
|
const fn = hooks[key];
|
|
31
|
-
if (typeof fn ===
|
|
31
|
+
if (typeof fn === 'function') {
|
|
32
32
|
hooksRegistry.set(uuid, fn);
|
|
33
33
|
}
|
|
34
34
|
mapHooksId = {
|
|
@@ -77,7 +77,7 @@ export function startSurvey(surveyId, allowMultipleResponses, hiddenFields, igno
|
|
|
77
77
|
if (hooks !== undefined) {
|
|
78
78
|
mapHooksId = {};
|
|
79
79
|
Object.keys(hooks).forEach(key => {
|
|
80
|
-
if (key ===
|
|
80
|
+
if (key === 'version') {
|
|
81
81
|
const v = hooks.version ?? undefined;
|
|
82
82
|
if (v) mapHooksId = {
|
|
83
83
|
...mapHooksId,
|
|
@@ -86,7 +86,7 @@ export function startSurvey(surveyId, allowMultipleResponses, hiddenFields, igno
|
|
|
86
86
|
} else {
|
|
87
87
|
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
88
88
|
const fn = hooks[key];
|
|
89
|
-
if (typeof fn ===
|
|
89
|
+
if (typeof fn === 'function') {
|
|
90
90
|
hooksRegistry.set(uuid, fn);
|
|
91
91
|
}
|
|
92
92
|
mapHooksId = {
|
|
@@ -105,7 +105,7 @@ export function startMessage(messageId, allowMultipleResponses, hiddenFields, ig
|
|
|
105
105
|
if (hooks !== undefined) {
|
|
106
106
|
mapHooksId = {};
|
|
107
107
|
Object.keys(hooks).forEach(key => {
|
|
108
|
-
if (key ===
|
|
108
|
+
if (key === 'version') {
|
|
109
109
|
const v = hooks.version ?? undefined;
|
|
110
110
|
if (v) mapHooksId = {
|
|
111
111
|
...mapHooksId,
|
|
@@ -114,7 +114,7 @@ export function startMessage(messageId, allowMultipleResponses, hiddenFields, ig
|
|
|
114
114
|
} else {
|
|
115
115
|
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
116
116
|
const fn = hooks[key];
|
|
117
|
-
if (typeof fn ===
|
|
117
|
+
if (typeof fn === 'function') {
|
|
118
118
|
hooksRegistry.set(uuid, fn);
|
|
119
119
|
}
|
|
120
120
|
mapHooksId = {
|
|
@@ -160,7 +160,7 @@ export function getIdentity() {
|
|
|
160
160
|
// closeSdk
|
|
161
161
|
export function closeSdk() {
|
|
162
162
|
if (emitter) {
|
|
163
|
-
emitter.removeAllListeners(
|
|
163
|
+
emitter.removeAllListeners('ScreebEvent');
|
|
164
164
|
emitter = undefined;
|
|
165
165
|
}
|
|
166
166
|
return ScreebReactNative.closeSdk();
|
|
@@ -180,15 +180,15 @@ function handleEvent(event) {
|
|
|
180
180
|
if (event?.hookId != null) {
|
|
181
181
|
const hook = hooksRegistry.get(event.hookId);
|
|
182
182
|
if (hook != null) {
|
|
183
|
-
const payload = event.payload ? typeof event.payload !==
|
|
183
|
+
const payload = event.payload ? typeof event.payload !== 'string' ? JSON.stringify(event.payload) : event.payload : '{}';
|
|
184
184
|
const result = hook(payload);
|
|
185
185
|
const parsedPayload = JSON.parse(payload);
|
|
186
186
|
const originalHookId = parsedPayload?.hook_id;
|
|
187
187
|
if (originalHookId) {
|
|
188
188
|
if (result instanceof Promise) {
|
|
189
|
-
result.then(
|
|
189
|
+
result.then(hookResult => {
|
|
190
190
|
ScreebReactNative.onHookResult(originalHookId, {
|
|
191
|
-
result
|
|
191
|
+
result: hookResult
|
|
192
192
|
});
|
|
193
193
|
}).catch(error => {
|
|
194
194
|
console.error(error);
|
|
@@ -219,7 +219,7 @@ function normalizeValue(value) {
|
|
|
219
219
|
if (value instanceof Map) {
|
|
220
220
|
return normalizeValue(Object.fromEntries(value));
|
|
221
221
|
}
|
|
222
|
-
if (value != null && typeof value ===
|
|
222
|
+
if (value != null && typeof value === 'object') {
|
|
223
223
|
return Object.entries(value).reduce((acc, [key, nestedValue]) => {
|
|
224
224
|
acc[key] = normalizeValue(nestedValue);
|
|
225
225
|
return acc;
|
|
@@ -231,9 +231,9 @@ function normalizeValue(value) {
|
|
|
231
231
|
// Format payloads so DateTime properties are correctly interpreted by the SDK
|
|
232
232
|
function formatDateValue(value) {
|
|
233
233
|
const timezoneOffsetHours = -value.getTimezoneOffset() / 60;
|
|
234
|
-
const sign = timezoneOffsetHours >= 0 ?
|
|
235
|
-
const offset = Math.abs(timezoneOffsetHours).toString().padStart(2,
|
|
236
|
-
const pad = (n, l = 2) => n.toString().padStart(l,
|
|
234
|
+
const sign = timezoneOffsetHours >= 0 ? '+' : '-';
|
|
235
|
+
const offset = Math.abs(timezoneOffsetHours).toString().padStart(2, '0');
|
|
236
|
+
const pad = (n, l = 2) => n.toString().padStart(l, '0');
|
|
237
237
|
const isoWithoutTimezone = `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}T${pad(value.getHours())}:${pad(value.getMinutes())}:${pad(value.getSeconds())}.${pad(value.getMilliseconds(), 3)}`;
|
|
238
238
|
return `${isoWithoutTimezone}${sign}${offset}:00`;
|
|
239
239
|
}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","ScreebReactNative","emitter","initSdk","channelId","userId","properties","hooks","initOptions","language","OS","addListener","handleEvent","mapHooksId","Object","keys","forEach","key","v","version","undefined","uuid","Date","now","toString","Math","random","fn","hooksRegistry","set","toObject","setIdentity","setProperties","assignGroup","type","name","unassignGroup","trackEvent","trackScreen","startSurvey","surveyId","allowMultipleResponses","hiddenFields","ignoreSurveyStatus","distributionId","startMessage","messageId","ignoreMessageStatus","debug","debugTargeting","sessionReplayStart","sessionReplayStop","resetIdentity","getIdentity","closeSdk","removeAllListeners","closeSurvey","closeMessage","Map","event","hookId","hook","get","payload","JSON","stringify","result","parsedPayload","parse","originalHookId","hook_id","Promise","then","onHookResult","catch","error","console","value","normalizeValue","fromEntries","formatDateValue","Array","isArray","map","item","entries","reduce","acc","nestedValue","timezoneOffsetHours","getTimezoneOffset","sign","offset","abs","padStart","pad","n","l","isoWithoutTimezone","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"names":["DeviceEventEmitter","NativeEventEmitter","NativeModules","Platform","ScreebReactNative","emitter","initSdk","channelId","userId","properties","hooks","initOptions","language","OS","addListener","handleEvent","mapHooksId","Object","keys","forEach","key","v","version","undefined","uuid","Date","now","toString","Math","random","fn","hooksRegistry","set","toObject","setIdentity","setProperties","assignGroup","type","name","unassignGroup","trackEvent","trackScreen","startSurvey","surveyId","allowMultipleResponses","hiddenFields","ignoreSurveyStatus","distributionId","startMessage","messageId","ignoreMessageStatus","debug","debugTargeting","sessionReplayStart","sessionReplayStop","resetIdentity","getIdentity","closeSdk","removeAllListeners","closeSurvey","closeMessage","Map","event","hookId","hook","get","payload","JSON","stringify","result","parsedPayload","parse","originalHookId","hook_id","Promise","then","hookResult","onHookResult","catch","error","console","value","normalizeValue","fromEntries","formatDateValue","Array","isArray","map","item","entries","reduce","acc","nestedValue","timezoneOffsetHours","getTimezoneOffset","sign","offset","abs","padStart","pad","n","l","isoWithoutTimezone","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,kBAAkB,EAClBC,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,QACH,cAAc;AACrB,OAAOC,iBAAiB,MAAM,8B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|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeScreebReactNative.d.ts","sourceRoot":"","sources":["../../../src/NativeScreebReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AAErE,KAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAC5C,KAAK,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"NativeScreebReactNative.d.ts","sourceRoot":"","sources":["../../../src/NativeScreebReactNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAuB,MAAM,cAAc,CAAC;AAErE,KAAK,UAAU,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAC5C,KAAK,WAAW,GAAG;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,EAC9C,KAAK,CAAC,EAAE,UAAU,EAClB,WAAW,CAAC,EAAE,WAAW,EACzB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,WAAW,CACT,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,GAC7C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,aAAa,CAAC,UAAU,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,GAAG,OAAO,CAAC,I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CAAC,EAAE,OAAO,EAC7B,KAAK,CAAC,EAAE,UAAU,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IACzB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,WAAW,IAAI,OAAO,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC1D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,WAAW,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,YAAY,CACV,MAAM,EAAE,MAAM,EACd,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;wBAYwB,IAAI;AAA7B,wBAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAYA,KAAK,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAYA,KAAK,OAAO,GAAG;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAGF,KAAK,WAAW,GAA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"name": "@screeb/react-native",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Continuous Product Discovery",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -32,11 +32,12 @@
|
|
|
32
32
|
"!**/.*"
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
|
-
"
|
|
36
|
-
"example
|
|
35
|
+
"build": "bob build",
|
|
36
|
+
"example": "npm run start --workspace=example-reactnative",
|
|
37
|
+
"example:expo": "npm run start --workspace=example-expo",
|
|
37
38
|
"typecheck": "tsc",
|
|
38
|
-
"lint": "eslint . --ext .js,.ts,.tsx
|
|
39
|
-
"clean": "del-cli android/build example/android/build example/
|
|
39
|
+
"lint": "eslint . --ext .js,.ts,.tsx",
|
|
40
|
+
"clean": "del-cli --force android/build ../../examples/example-reactnative/android/build ../../examples/example-reactnative/ios/build ../../examples/example-expo/android ../../examples/example-expo/ios lib",
|
|
40
41
|
"prepare": "bob build",
|
|
41
42
|
"release": "release-it --only-version"
|
|
42
43
|
},
|
|
@@ -47,49 +48,43 @@
|
|
|
47
48
|
],
|
|
48
49
|
"repository": {
|
|
49
50
|
"type": "git",
|
|
50
|
-
"url": "git+https://github.com/ScreebApp/sdk
|
|
51
|
+
"url": "git+https://github.com/ScreebApp/sdk.git"
|
|
51
52
|
},
|
|
52
53
|
"author": "Alexis <alexis@screeb.app> (https://github.com/Alexays)",
|
|
53
54
|
"license": "MIT",
|
|
54
55
|
"bugs": {
|
|
55
|
-
"url": "https://github.com/ScreebApp/sdk
|
|
56
|
+
"url": "https://github.com/ScreebApp/sdk/issues"
|
|
56
57
|
},
|
|
57
|
-
"homepage": "https://github.com/ScreebApp/sdk
|
|
58
|
+
"homepage": "https://github.com/ScreebApp/sdk#readme",
|
|
58
59
|
"publishConfig": {
|
|
59
60
|
"registry": "https://registry.npmjs.org/"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@commitlint/config-conventional": "^19.8.1",
|
|
63
64
|
"@eslint/compat": "^1.3.2",
|
|
64
|
-
"@eslint/eslintrc": "^3.3.
|
|
65
|
+
"@eslint/eslintrc": "^3.3.5",
|
|
65
66
|
"@eslint/js": "^9.35.0",
|
|
66
|
-
"@react-native-community/cli": "20.0.
|
|
67
|
+
"@react-native-community/cli": "20.0.2",
|
|
67
68
|
"@react-native/babel-preset": "0.81.1",
|
|
68
69
|
"@react-native/eslint-config": "^0.81.1",
|
|
69
|
-
"@release-it/conventional-changelog": "^10.0.
|
|
70
|
-
"@types/react": "^19.1.
|
|
70
|
+
"@release-it/conventional-changelog": "^10.0.6",
|
|
71
|
+
"@types/react": "^19.1.17",
|
|
71
72
|
"commitlint": "^19.8.1",
|
|
72
73
|
"del-cli": "^6.0.0",
|
|
73
74
|
"eslint": "^9.35.0",
|
|
74
75
|
"eslint-config-prettier": "^10.1.8",
|
|
75
|
-
"eslint-plugin-prettier": "^5.5.
|
|
76
|
+
"eslint-plugin-prettier": "^5.5.6",
|
|
76
77
|
"prettier": "^3.6.2",
|
|
77
78
|
"react": "19.1.0",
|
|
78
79
|
"react-native": "0.81.1",
|
|
79
80
|
"react-native-builder-bob": "^0.40.13",
|
|
80
|
-
"release-it": "^19.0.
|
|
81
|
-
"
|
|
82
|
-
"typescript": "^5.9.2"
|
|
81
|
+
"release-it": "^19.0.6",
|
|
82
|
+
"typescript": "^5.9.3"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"react": "*",
|
|
86
86
|
"react-native": "*"
|
|
87
87
|
},
|
|
88
|
-
"workspaces": [
|
|
89
|
-
"example",
|
|
90
|
-
"example-expo"
|
|
91
|
-
],
|
|
92
|
-
"packageManager": "yarn@3.6.1",
|
|
93
88
|
"commitlint": {
|
|
94
89
|
"extends": [
|
|
95
90
|
"@commitlint/config-conventional"
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
import { type TurboModule, TurboModuleRegistry } from
|
|
1
|
+
import { type TurboModule, TurboModuleRegistry } from 'react-native';
|
|
2
2
|
|
|
3
3
|
type HookIdsMap = { [key: string]: string };
|
|
4
4
|
type InitOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
isDebugMode?: boolean;
|
|
6
|
+
disableMirror?: boolean;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export interface Spec extends TurboModule {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
10
|
+
initSdk(
|
|
11
|
+
channelId: string,
|
|
12
|
+
userId?: string,
|
|
13
|
+
properties?: { [key: string]: unknown } | null,
|
|
14
|
+
hooks?: HookIdsMap,
|
|
15
|
+
initOptions?: InitOptions,
|
|
16
|
+
language?: string
|
|
17
|
+
): Promise<void>;
|
|
18
|
+
setIdentity(
|
|
19
|
+
userId: string,
|
|
20
|
+
properties?: { [key: string]: unknown } | null
|
|
21
|
+
): Promise<void>;
|
|
22
|
+
setProperties(properties?: { [key: string]: unknown } | null): Promise<void>;
|
|
23
|
+
assignGroup(
|
|
24
|
+
type: string | null,
|
|
25
|
+
name: string,
|
|
26
|
+
properties?: { [key: string]: unknown } | null
|
|
27
|
+
): Promise<void>;
|
|
28
|
+
unassignGroup(
|
|
29
|
+
type: string | null,
|
|
30
|
+
name: string,
|
|
31
|
+
properties?: { [key: string]: unknown } | null
|
|
32
|
+
): Promise<void>;
|
|
33
|
+
trackEvent(
|
|
34
|
+
name: string,
|
|
35
|
+
properties?: { [key: string]: unknown } | null
|
|
36
|
+
): Promise<void>;
|
|
37
|
+
trackScreen(
|
|
38
|
+
name: string,
|
|
39
|
+
properties?: { [key: string]: unknown } | null
|
|
40
|
+
): Promise<void>;
|
|
41
|
+
startSurvey(
|
|
42
|
+
surveyId: string,
|
|
43
|
+
allowMultipleResponses?: boolean,
|
|
44
|
+
hiddenFields?: { [key: string]: unknown } | null,
|
|
45
|
+
ignoreSurveyStatus?: boolean,
|
|
46
|
+
hooks?: HookIdsMap,
|
|
47
|
+
language?: string,
|
|
48
|
+
distributionId?: string
|
|
49
|
+
): Promise<void>;
|
|
50
|
+
startMessage(
|
|
51
|
+
messageId: string,
|
|
52
|
+
allowMultipleResponses?: boolean,
|
|
53
|
+
hiddenFields?: { [key: string]: unknown } | null,
|
|
54
|
+
ignoreMessageStatus?: boolean,
|
|
55
|
+
hooks?: HookIdsMap,
|
|
56
|
+
language?: string,
|
|
57
|
+
distributionId?: string
|
|
58
|
+
): Promise<void>;
|
|
59
|
+
debug(): Promise<string>;
|
|
60
|
+
debugTargeting(): Promise<string>;
|
|
61
|
+
sessionReplayStart(): Promise<void>;
|
|
62
|
+
sessionReplayStop(): Promise<void>;
|
|
63
|
+
resetIdentity(): Promise<void>;
|
|
64
|
+
getIdentity(): Promise<{ [key: string]: unknown } | null>;
|
|
65
|
+
closeSdk(): Promise<void>;
|
|
66
|
+
closeSurvey(surveyId?: string): Promise<void>;
|
|
67
|
+
closeMessage(messageId?: string): Promise<void>;
|
|
68
|
+
onHookResult(
|
|
69
|
+
hookId: string,
|
|
70
|
+
result: { [key: string]: unknown }
|
|
71
|
+
): Promise<void>;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
const module = TurboModuleRegistry.get<Spec>(
|
|
74
|
+
const module = TurboModuleRegistry.get<Spec>('ScreebReactNative');
|
|
75
75
|
if (!module) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
const LINKING_ERROR =
|
|
77
|
+
`The native module "ScreebReactNative" could not be found.\n` +
|
|
78
|
+
"- Ensure the iOS/Android native code is compiled (iOS: run 'pod install' in the example app, then rebuild).\n" +
|
|
79
|
+
"- If you're developing locally, run 'yarn prepare' to rebuild the JS output.\n" +
|
|
80
|
+
'- On iOS, make sure the podspec is included and the app is rebuilt (not just reloaded).';
|
|
81
|
+
throw new Error(LINKING_ERROR);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export default module as Spec;
|
package/src/index.tsx
CHANGED
|
@@ -1,340 +1,342 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from
|
|
7
|
-
import ScreebReactNative from
|
|
2
|
+
DeviceEventEmitter,
|
|
3
|
+
NativeEventEmitter,
|
|
4
|
+
NativeModules,
|
|
5
|
+
Platform,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import ScreebReactNative from './NativeScreebReactNative';
|
|
8
8
|
|
|
9
9
|
// biome-ignore lint/suspicious/noExplicitAny: .
|
|
10
10
|
let emitter: any;
|
|
11
11
|
|
|
12
12
|
type HookFn = (payload: string) => unknown | Promise<unknown>;
|
|
13
13
|
type HookMap = {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
version?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
type HookIdsMap = { [key: string]: string };
|
|
19
19
|
type InitOptions = {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
isDebugMode?: boolean;
|
|
21
|
+
disableMirror?: boolean;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
// initSdk
|
|
25
25
|
export function initSdk(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
channelId: string,
|
|
27
|
+
userId?: string,
|
|
28
|
+
properties?: Record<string, unknown> | Map<string, unknown>,
|
|
29
|
+
hooks?: HookMap,
|
|
30
|
+
initOptions?: InitOptions,
|
|
31
|
+
language?: string
|
|
32
32
|
) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
33
|
+
// Use NativeEventEmitter on both platforms; pass the native module on iOS
|
|
34
|
+
// and rely on the default emitter on Android.
|
|
35
|
+
if (Platform.OS === 'ios') {
|
|
36
|
+
emitter = new NativeEventEmitter(NativeModules.ScreebReactNative);
|
|
37
|
+
} else {
|
|
38
|
+
emitter = DeviceEventEmitter;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
emitter.addListener('ScreebEvent', handleEvent);
|
|
42
|
+
|
|
43
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
44
|
+
if (hooks != null) {
|
|
45
|
+
mapHooksId = {};
|
|
46
|
+
Object.keys(hooks).forEach((key) => {
|
|
47
|
+
if (key === 'version') {
|
|
48
|
+
const v = hooks.version ?? undefined;
|
|
49
|
+
if (v)
|
|
50
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
51
|
+
[key: string]: string;
|
|
52
|
+
};
|
|
53
|
+
} else {
|
|
54
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
55
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
56
|
+
if (typeof fn === 'function') {
|
|
57
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
58
|
+
}
|
|
59
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return ScreebReactNative.initSdk(
|
|
65
|
+
channelId,
|
|
66
|
+
userId,
|
|
67
|
+
toObject(properties),
|
|
68
|
+
mapHooksId,
|
|
69
|
+
initOptions,
|
|
70
|
+
language
|
|
71
|
+
);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// setIdentity
|
|
75
75
|
export function setIdentity(
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
userId: string,
|
|
77
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
78
78
|
) {
|
|
79
|
-
|
|
79
|
+
return ScreebReactNative.setIdentity(userId, toObject(properties));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// setProperties
|
|
83
83
|
export function setProperties(
|
|
84
|
-
|
|
84
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
85
85
|
) {
|
|
86
|
-
|
|
86
|
+
return ScreebReactNative.setProperties(toObject(properties));
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
// assignGroup
|
|
90
90
|
export function assignGroup(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
type: string | null,
|
|
92
|
+
name: string,
|
|
93
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
94
94
|
) {
|
|
95
|
-
|
|
95
|
+
return ScreebReactNative.assignGroup(type, name, toObject(properties));
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// unassignGroup
|
|
99
99
|
export function unassignGroup(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
type: string | null,
|
|
101
|
+
name: string,
|
|
102
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
103
103
|
) {
|
|
104
|
-
|
|
104
|
+
return ScreebReactNative.unassignGroup(type, name, toObject(properties));
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// trackEvent
|
|
108
108
|
export function trackEvent(
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
name: string,
|
|
110
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
111
111
|
) {
|
|
112
|
-
|
|
112
|
+
return ScreebReactNative.trackEvent(name, toObject(properties));
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
// trackScreen
|
|
116
116
|
export function trackScreen(
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
name: string,
|
|
118
|
+
properties?: Record<string, unknown> | Map<string, unknown> | null
|
|
119
119
|
) {
|
|
120
|
-
|
|
120
|
+
return ScreebReactNative.trackScreen(name, toObject(properties));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// startSurvey
|
|
124
124
|
export function startSurvey(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
surveyId: string,
|
|
126
|
+
allowMultipleResponses?: boolean,
|
|
127
|
+
hiddenFields?: Record<string, unknown> | Map<string, unknown> | null,
|
|
128
|
+
ignoreSurveyStatus?: boolean,
|
|
129
|
+
hooks?: HookMap,
|
|
130
|
+
language?: string,
|
|
131
|
+
distributionId?: string
|
|
132
132
|
) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
133
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
134
|
+
if (hooks !== undefined) {
|
|
135
|
+
mapHooksId = {};
|
|
136
|
+
Object.keys(hooks).forEach((key) => {
|
|
137
|
+
if (key === 'version') {
|
|
138
|
+
const v = hooks.version ?? undefined;
|
|
139
|
+
if (v)
|
|
140
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
141
|
+
[key: string]: string;
|
|
142
|
+
};
|
|
143
|
+
} else {
|
|
144
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
145
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
146
|
+
if (typeof fn === 'function') {
|
|
147
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
148
|
+
}
|
|
149
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
return ScreebReactNative.startSurvey(
|
|
154
|
+
surveyId,
|
|
155
|
+
allowMultipleResponses ?? true,
|
|
156
|
+
toObject(hiddenFields),
|
|
157
|
+
ignoreSurveyStatus ?? true,
|
|
158
|
+
mapHooksId,
|
|
159
|
+
language,
|
|
160
|
+
distributionId
|
|
161
|
+
);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
// startMessage
|
|
165
165
|
export function startMessage(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
166
|
+
messageId: string,
|
|
167
|
+
allowMultipleResponses?: boolean,
|
|
168
|
+
hiddenFields?: Record<string, unknown> | Map<string, unknown> | null,
|
|
169
|
+
ignoreMessageStatus?: boolean,
|
|
170
|
+
hooks?: HookMap,
|
|
171
|
+
language?: string,
|
|
172
|
+
distributionId?: string
|
|
173
173
|
) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
174
|
+
let mapHooksId: HookIdsMap | undefined;
|
|
175
|
+
if (hooks !== undefined) {
|
|
176
|
+
mapHooksId = {};
|
|
177
|
+
Object.keys(hooks).forEach((key) => {
|
|
178
|
+
if (key === 'version') {
|
|
179
|
+
const v = hooks.version ?? undefined;
|
|
180
|
+
if (v)
|
|
181
|
+
mapHooksId = { ...mapHooksId, version: v } as {
|
|
182
|
+
[key: string]: string;
|
|
183
|
+
};
|
|
184
|
+
} else {
|
|
185
|
+
const uuid = Date.now().toString() + Math.random().toString() + key;
|
|
186
|
+
const fn = (hooks as Record<string, unknown>)[key];
|
|
187
|
+
if (typeof fn === 'function') {
|
|
188
|
+
hooksRegistry.set(uuid, fn as HookFn);
|
|
189
|
+
}
|
|
190
|
+
mapHooksId = { ...mapHooksId, [key]: uuid };
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return ScreebReactNative.startMessage(
|
|
195
|
+
messageId,
|
|
196
|
+
allowMultipleResponses ?? true,
|
|
197
|
+
toObject(hiddenFields),
|
|
198
|
+
ignoreMessageStatus ?? true,
|
|
199
|
+
mapHooksId,
|
|
200
|
+
language,
|
|
201
|
+
distributionId
|
|
202
|
+
);
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
// debug
|
|
206
206
|
export function debug() {
|
|
207
|
-
|
|
207
|
+
return ScreebReactNative.debug();
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
// debugTargeting
|
|
211
211
|
export function debugTargeting() {
|
|
212
|
-
|
|
212
|
+
return ScreebReactNative.debugTargeting();
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// sessionReplayStart
|
|
216
216
|
export function sessionReplayStart() {
|
|
217
|
-
|
|
217
|
+
return ScreebReactNative.sessionReplayStart();
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
// sessionReplayStop
|
|
221
221
|
export function sessionReplayStop() {
|
|
222
|
-
|
|
222
|
+
return ScreebReactNative.sessionReplayStop();
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
// resetIdentity
|
|
226
226
|
export function resetIdentity() {
|
|
227
|
-
|
|
227
|
+
return ScreebReactNative.resetIdentity();
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// getIdentity
|
|
231
231
|
export function getIdentity() {
|
|
232
|
-
|
|
232
|
+
return ScreebReactNative.getIdentity();
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
// closeSdk
|
|
236
236
|
export function closeSdk() {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
237
|
+
if (emitter) {
|
|
238
|
+
emitter.removeAllListeners('ScreebEvent');
|
|
239
|
+
emitter = undefined;
|
|
240
|
+
}
|
|
241
|
+
return ScreebReactNative.closeSdk();
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
// closeSurvey
|
|
245
245
|
export function closeSurvey(surveyId?: string) {
|
|
246
|
-
|
|
246
|
+
return ScreebReactNative.closeSurvey(surveyId);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
// closeMessage
|
|
250
250
|
export function closeMessage(messageId?: string) {
|
|
251
|
-
|
|
251
|
+
return ScreebReactNative.closeMessage(messageId);
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
const hooksRegistry = new Map<
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
string,
|
|
256
|
+
(payload: string) => unknown | Promise<unknown>
|
|
257
257
|
>();
|
|
258
258
|
|
|
259
259
|
function handleEvent(event: { hookId?: string; payload?: unknown }) {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
260
|
+
if (event?.hookId != null) {
|
|
261
|
+
const hook = hooksRegistry.get(event.hookId);
|
|
262
|
+
if (hook != null) {
|
|
263
|
+
const payload = event.payload
|
|
264
|
+
? typeof event.payload !== 'string'
|
|
265
|
+
? JSON.stringify(event.payload)
|
|
266
|
+
: event.payload
|
|
267
|
+
: '{}';
|
|
268
|
+
const result = hook(payload);
|
|
269
|
+
const parsedPayload = JSON.parse(payload);
|
|
270
|
+
const originalHookId = parsedPayload?.hook_id;
|
|
271
|
+
if (originalHookId) {
|
|
272
|
+
if (result instanceof Promise) {
|
|
273
|
+
result
|
|
274
|
+
.then((hookResult) => {
|
|
275
|
+
ScreebReactNative.onHookResult(originalHookId, {
|
|
276
|
+
result: hookResult,
|
|
277
|
+
});
|
|
278
|
+
})
|
|
279
|
+
.catch((error) => {
|
|
280
|
+
console.error(error);
|
|
281
|
+
});
|
|
282
|
+
} else {
|
|
283
|
+
ScreebReactNative.onHookResult(originalHookId, { result });
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
286
288
|
}
|
|
287
289
|
|
|
288
290
|
function toObject(
|
|
289
|
-
|
|
291
|
+
value?: Record<string, unknown> | Map<string, unknown> | null
|
|
290
292
|
): { [key: string]: unknown } | undefined {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
293
|
+
if (value == null) return undefined;
|
|
294
|
+
if (value instanceof Map) {
|
|
295
|
+
return normalizeValue(
|
|
296
|
+
Object.fromEntries(value as Map<string, unknown>)
|
|
297
|
+
) as {
|
|
298
|
+
[key: string]: unknown;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
return normalizeValue(value) as { [key: string]: unknown };
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
function normalizeValue(value: unknown): unknown {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
305
|
+
if (value instanceof Date) {
|
|
306
|
+
return formatDateValue(value);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
if (Array.isArray(value)) {
|
|
310
|
+
return value.map((item) => normalizeValue(item));
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
if (value instanceof Map) {
|
|
314
|
+
return normalizeValue(Object.fromEntries(value as Map<string, unknown>));
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
if (value != null && typeof value === 'object') {
|
|
318
|
+
return Object.entries(value as Record<string, unknown>).reduce(
|
|
319
|
+
(acc, [key, nestedValue]) => {
|
|
320
|
+
acc[key] = normalizeValue(nestedValue);
|
|
321
|
+
return acc;
|
|
322
|
+
},
|
|
323
|
+
{} as Record<string, unknown>
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return value;
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
// Format payloads so DateTime properties are correctly interpreted by the SDK
|
|
329
331
|
function formatDateValue(value: Date): string {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
332
|
+
const timezoneOffsetHours = -value.getTimezoneOffset() / 60;
|
|
333
|
+
const sign = timezoneOffsetHours >= 0 ? '+' : '-';
|
|
334
|
+
const offset = Math.abs(timezoneOffsetHours).toString().padStart(2, '0');
|
|
335
|
+
const pad = (n: number, l = 2) => n.toString().padStart(l, '0');
|
|
336
|
+
const isoWithoutTimezone = `${value.getFullYear()}-${pad(
|
|
337
|
+
value.getMonth() + 1
|
|
338
|
+
)}-${pad(value.getDate())}T${pad(value.getHours())}:${pad(
|
|
339
|
+
value.getMinutes()
|
|
340
|
+
)}:${pad(value.getSeconds())}.${pad(value.getMilliseconds(), 3)}`;
|
|
341
|
+
return `${isoWithoutTimezone}${sign}${offset}:00`;
|
|
340
342
|
}
|