52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
// Metro module 15749 (f15750).
|
|
import { useEffect } from "react";
|
|
import SurveyStore from "../stores/SurveyStore";
|
|
import { AnalyticEvents } from "../Constants";
|
|
import { createStyles } from "../design/components/Styles/native/createStyles";
|
|
import { useStateFromStores } from "../_bundle/Module589";
|
|
import AnalyticsUtils from "../utils/AnalyticsUtils";
|
|
import { surveySeen, surveyHide } from "../actions/SurveyActionCreators";
|
|
import Alert from "./common/Alert";
|
|
import { intl, t } from "../intl/index.native";
|
|
import Linking from "../lib/native/Linking";
|
|
import { Icon } from "../design/void/native";
|
|
import Module712 from "../_bundle/Module712";
|
|
import Module9035 from "../_bundle/Module9035";
|
|
const useStyles = createStyles({
|
|
confirmIcon: {
|
|
marginLeft: 4
|
|
}
|
|
});
|
|
export default function MobileSurvey() {
|
|
const styles = useStyles();
|
|
const stateFromStores = useStateFromStores([SurveyStore], () => SurveyStore.getCurrentSurvey());
|
|
useEffect(() => {
|
|
if (stateFromStores != null) {
|
|
let _setSurveySeen2 = function _setSurveySeen() {
|
|
const r9 = async () => {
|
|
L11: {
|
|
if (stateFromStores != null) {
|
|
await surveySeen(stateFromStores.key);
|
|
break L11;
|
|
}
|
|
return void 0;
|
|
}
|
|
};
|
|
_setSurveySeen2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
|
|
type: "survey",
|
|
promotion_id: stateFromStores.id
|
|
});
|
|
(function setSurveySeen() {
|
|
return _setSurveySeen2.apply(this, arguments);
|
|
})();
|
|
}
|
|
}, [stateFromStores]);
|
|
return stateFromStores != null ? <Alert body={stateFromStores.prompt} confirmText={stateFromStores.cta} cancelText={intl.string(t.f3Pet9)} onConfirm={() => {
|
|
Linking.openURL(stateFromStores.url);
|
|
surveyHide(stateFromStores.key, false);
|
|
}} onCancel={() => surveyHide(stateFromStores.key, true)} renderConfirmRightIcon={() => <Icon style={styles.confirmIcon} color={Module712.unsafe_rawColors.WHITE} size={Icon.Sizes.SMALL} source={Module9035} />} /> : null;
|
|
};
|