@forstaglobal/react-native-mobilesdk 3.12.0 → 3.13.0
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 +3 -3
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/mobilesdk/MobileSdkModule.kt +25 -4
- package/android/src/main/java/com/mobilesdk/MobileSdkPackage.kt +1 -1
- package/android/src/main/java/com/mobilesdk/MobileSdkSurveyModule.kt +296 -0
- package/android/src/main/java/com/mobilesdk/module/TriggerCallback.kt +31 -1
- package/android/src/main/java/com/mobilesdk/survey/MobileSdkSurveyManager.kt +23 -0
- package/android/src/main/java/com/mobilesdk/survey/MobileSdkSurveyWrapper.kt +104 -0
- package/ios/MobileSdk.mm +8 -1
- package/ios/MobileSdk.swift +15 -2
- package/ios/MobileSdkSurvey-Bridging-Header.h +2 -0
- package/ios/MobileSdkSurvey.mm +111 -0
- package/ios/MobileSdkSurvey.swift +274 -0
- package/ios/Mobilesdk.xcodeproj/project.pbxproj +0 -2
- package/ios/Module/MobileTriggerCallback.swift +31 -1
- package/ios/Module/SdkEmitter.swift +1 -1
- package/ios/Podfile +1 -1
- package/ios/Podfile.lock +1 -1
- package/ios/Survey/MobileSdkSurveyManager.swift +21 -0
- package/ios/Survey/MobileSdkSurveyWrapper.swift +79 -0
- package/lib/commonjs/confirmitSdk.js +29 -0
- package/lib/commonjs/confirmitSdk.js.map +1 -0
- package/lib/commonjs/index.js +48 -140
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/models.js +24 -0
- package/lib/commonjs/models/models.js.map +1 -1
- package/lib/commonjs/program/triggerCallback.js +9 -21
- package/lib/commonjs/program/triggerCallback.js.map +1 -1
- package/lib/commonjs/serverSdk.js +83 -0
- package/lib/commonjs/serverSdk.js.map +1 -0
- package/lib/commonjs/survey/pageControl.js +72 -0
- package/lib/commonjs/survey/pageControl.js.map +1 -0
- package/lib/commonjs/survey/surveyFrameCallback.js +28 -0
- package/lib/commonjs/survey/surveyFrameCallback.js.map +1 -0
- package/lib/commonjs/surveySdk.js +23 -0
- package/lib/commonjs/surveySdk.js.map +1 -0
- package/lib/commonjs/triggerSdk.js +50 -0
- package/lib/commonjs/triggerSdk.js.map +1 -0
- package/lib/commonjs/views/surveyWebView.js +42 -42
- package/lib/commonjs/views/surveyWebView.js.map +1 -1
- package/lib/module/confirmitSdk.js +23 -0
- package/lib/module/confirmitSdk.js.map +1 -0
- package/lib/module/index.js +7 -113
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/models.js +19 -1
- package/lib/module/models/models.js.map +1 -1
- package/lib/module/program/triggerCallback.js +9 -21
- package/lib/module/program/triggerCallback.js.map +1 -1
- package/lib/module/serverSdk.js +77 -0
- package/lib/module/serverSdk.js.map +1 -0
- package/lib/module/survey/pageControl.js +65 -0
- package/lib/module/survey/pageControl.js.map +1 -0
- package/lib/module/survey/surveyFrameCallback.js +22 -0
- package/lib/module/survey/surveyFrameCallback.js.map +1 -0
- package/lib/module/surveySdk.js +17 -0
- package/lib/module/surveySdk.js.map +1 -0
- package/lib/module/triggerSdk.js +44 -0
- package/lib/module/triggerSdk.js.map +1 -0
- package/lib/module/views/surveyWebView.js +43 -42
- package/lib/module/views/surveyWebView.js.map +1 -1
- package/lib/typescript/confirmitSdk.d.ts +8 -0
- package/lib/typescript/confirmitSdk.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +8 -36
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/models.d.ts +91 -0
- package/lib/typescript/models/models.d.ts.map +1 -1
- package/lib/typescript/program/triggerCallback.d.ts +5 -13
- package/lib/typescript/program/triggerCallback.d.ts.map +1 -1
- package/lib/typescript/serverSdk.d.ts +24 -0
- package/lib/typescript/serverSdk.d.ts.map +1 -0
- package/lib/typescript/survey/pageControl.d.ts +27 -0
- package/lib/typescript/survey/pageControl.d.ts.map +1 -0
- package/lib/typescript/survey/surveyFrameCallback.d.ts +15 -0
- package/lib/typescript/survey/surveyFrameCallback.d.ts.map +1 -0
- package/lib/typescript/surveySdk.d.ts +10 -0
- package/lib/typescript/surveySdk.d.ts.map +1 -0
- package/lib/typescript/triggerSdk.d.ts +23 -0
- package/lib/typescript/triggerSdk.d.ts.map +1 -0
- package/lib/typescript/views/surveyWebView.d.ts +4 -13
- package/lib/typescript/views/surveyWebView.d.ts.map +1 -1
- package/package.json +4 -3
- package/react-native-mobilesdk.podspec +1 -1
- package/src/confirmitSdk.ts +34 -0
- package/src/index.tsx +45 -152
- package/src/models/models.ts +96 -0
- package/src/program/triggerCallback.ts +10 -27
- package/src/serverSdk.ts +105 -0
- package/src/survey/pageControl.ts +97 -0
- package/src/survey/surveyFrameCallback.ts +28 -0
- package/src/surveySdk.ts +32 -0
- package/src/triggerSdk.ts +62 -0
- package/src/views/surveyWebView.tsx +46 -44
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { EmitterSubscription, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
3
3
|
import type { WebViewMessageEvent, WebViewProps } from 'react-native-webview';
|
|
4
4
|
import { WebView } from 'react-native-webview';
|
|
5
|
-
import {
|
|
5
|
+
import { ConfirmitSdk } from '../confirmitSdk';
|
|
6
6
|
|
|
7
|
-
interface
|
|
7
|
+
interface ISurveyWebViewProps extends WebViewProps {
|
|
8
8
|
onSurveyClosed?: () => void;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
private triggerManagerEmitter = new NativeEventEmitter(this.sdkEmitter);
|
|
11
|
+
const sdkEmitter = NativeModules.SdkEmitter;
|
|
12
|
+
const triggerManagerEmitter = new NativeEventEmitter(sdkEmitter);
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
const SurveyWebView = (props: ISurveyWebViewProps) => {
|
|
15
|
+
let loaded = false;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const pageReady: EmitterSubscription = triggerManagerEmitter.addListener('__mobileOnSurveyClosed', onSurveyClosed);
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
return () => {
|
|
21
|
+
pageReady.remove();
|
|
22
|
+
};
|
|
23
|
+
});
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
const onSurveyClosed = () => {
|
|
26
|
+
props.onSurveyClosed?.();
|
|
25
27
|
};
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.loaded = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private onMessage = (event: WebViewMessageEvent) => {
|
|
35
|
-
this.__onSurveyClosed();
|
|
36
|
-
this.props.onMessage?.(event);
|
|
29
|
+
const onMessage = (event: WebViewMessageEvent) => {
|
|
30
|
+
onSurveyClosed();
|
|
31
|
+
props.onMessage?.(event);
|
|
37
32
|
};
|
|
38
33
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
injectedJavaScriptBeforeContentLoaded += ` \nwindow['mobileBridge'] = { onSurveyEnd: function() { window.ReactNativeWebView?.postMessage(''); } };`;
|
|
34
|
+
const load = () => {
|
|
35
|
+
if (!loaded) {
|
|
36
|
+
ConfirmitSdk.injectWebView();
|
|
37
|
+
loaded = true;
|
|
44
38
|
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
let { injectedJavaScriptBeforeContentLoaded } = props;
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
nativeID={'surveyWebViews'}
|
|
49
|
-
{...this.props}
|
|
50
|
-
domStorageEnabled={true}
|
|
51
|
-
javaScriptEnabled={true}
|
|
52
|
-
onLoad={() => {
|
|
53
|
-
this.load();
|
|
54
|
-
}}
|
|
55
|
-
injectedJavaScriptForMainFrameOnly={false}
|
|
56
|
-
injectedJavaScriptBeforeContentLoaded={injectedJavaScriptBeforeContentLoaded}
|
|
57
|
-
onMessage={this.onMessage}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
43
|
+
if (Platform.OS === 'ios') {
|
|
44
|
+
injectedJavaScriptBeforeContentLoaded += " \nwindow['mobileBridge'] = { onSurveyEnd: function() { window.ReactNativeWebView?.postMessage(''); } };";
|
|
60
45
|
}
|
|
61
|
-
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<WebView
|
|
49
|
+
nativeID={'surveyWebViews'}
|
|
50
|
+
{...props}
|
|
51
|
+
domStorageEnabled={true}
|
|
52
|
+
javaScriptEnabled={true}
|
|
53
|
+
onLoad={() => {
|
|
54
|
+
load();
|
|
55
|
+
}}
|
|
56
|
+
injectedJavaScriptForMainFrameOnly={false}
|
|
57
|
+
injectedJavaScriptBeforeContentLoaded={injectedJavaScriptBeforeContentLoaded}
|
|
58
|
+
onMessage={onMessage}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default SurveyWebView;
|