"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _reactNativeLinearGradient = _interopRequireDefault(require("react-native-linear-gradient"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _reactNativeAnimation = require("@coorpacademy/react-native-animation");
var _index = _interopRequireDefault(require("../../../hoc/touchable/index.native"));
var _templateContext = require("../../app-review/template-context");
var _index2 = _interopRequireDefault(require("../../../atom/text/index.native"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const SCREEN = _reactNative.Dimensions.get('screen');
const createStyleSheet = theme => _reactNative.StyleSheet.create({
  wrapper: {
    top: 0,
    bottom: 0,
    left: 0,
    right: 0,
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    paddingHorizontal: 24
  },
  backButton: {
    position: 'absolute',
    top: 60,
    left: 30
  },
  closeIcon: {
    fill: '#515161',
    width: 20,
    height: 20
  },
  gradients: {
    position: 'absolute',
    top: 0,
    height: SCREEN.height,
    left: 0,
    right: 0,
    flex: 1
  },
  gradient: {
    position: 'absolute',
    top: -80,
    bottom: 400,
    left: -180,
    right: -180,
    opacity: 1,
    transform: [{
      rotate: '15deg'
    }]
  },
  gradient2: {
    position: 'absolute',
    top: -30,
    bottom: 0,
    left: 0,
    right: 0,
    opacity: 0.6
  },
  content: {
    width: '100%',
    justifyContent: 'space-around',
    alignItems: 'center'
  },
  checkIconWrapper: {
    backgroundColor: '#E8FCF8',
    width: 64,
    height: 64,
    marginVertical: 12,
    borderRadius: 16,
    justifyContent: 'center',
    alignItems: 'center'
  },
  checkIconInnerWrapper: {
    backgroundColor: '#18BB98',
    width: 24,
    height: 24,
    padding: 4,
    borderRadius: 50,
    justifyContent: 'center',
    alignItems: 'center'
  },
  checkIcon: {
    fill: '#fff',
    width: 12,
    height: 12
  },
  title: {
    color: '#1D1D2B',
    fontWeight: '600',
    textAlign: 'center',
    fontSize: 28,
    lineHeight: 36,
    paddingVertical: 8
  },
  description: {
    color: '#1D1D2B',
    fontWeight: '400',
    textAlign: 'center',
    fontSize: 17,
    lineHeight: 24,
    paddingVertical: 8
  },
  ctaWrapper: {
    position: 'absolute',
    width: '100%',
    bottom: 60
  },
  ctaOpenInbox: {
    paddingVertical: 12,
    marginVertical: 4,
    flexDirection: 'row',
    justifyContent: 'center',
    borderRadius: 12,
    alignItems: 'center',
    overflow: 'hidden',
    backgroundColor: theme.colors.cta
  },
  ctaOpenInboxText: {
    marginLeft: 8,
    color: '#fff',
    fontWeight: '700',
    fontSize: 14,
    lineHeight: 24
  },
  mailIcon: {
    fill: '#fff',
    height: 14,
    width: 14
  }
});
const ConfirmEmailSent = props => {
  const {
    locales,
    onClose,
    onOpenInbox
  } = props;
  const {
    theme
  } = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)(null);
  const translateGradients = (0, _reactNativeAnimation.useTranslateY)({
    fromValue: 50,
    toValue: -SCREEN.height * 0.4,
    duration: 250,
    delay: 650
  });
  const fadeInContent = (0, _reactNativeAnimation.useAnimateProp)({
    property: 'opacity',
    fromValue: 0,
    toValue: 1,
    duration: 650,
    delay: 750
  });
  (0, _react.useEffect)(() => {
    const _stylesheet = createStyleSheet(theme);
    setStylesheet(_stylesheet);
  }, [theme]);
  (0, _react.useEffect)(() => {
    fadeInContent.start();
    translateGradients.start();
    // on mount only
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);
  if (!styleSheet) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: styleSheet.wrapper
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: [styleSheet.gradients, translateGradients.animatedStyle]
  }, /*#__PURE__*/_react.default.createElement(_reactNativeLinearGradient.default, {
    colors: ['#179c57', '#fff0'],
    locations: [0, 0.5],
    style: styleSheet.gradient
  }), /*#__PURE__*/_react.default.createElement(_reactNativeLinearGradient.default, {
    colors: ['#18BB98', '#18BB9800'],
    locations: [0, 1],
    style: styleSheet.gradient2
  })), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: [styleSheet.content, fadeInContent.animatedStyle]
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.checkIconWrapper
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.checkIconInnerWrapper
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyCheck, {
    style: styleSheet.checkIcon
  }))), /*#__PURE__*/_react.default.createElement(_index2.default, {
    style: styleSheet.title
  }, locales.successTitle), /*#__PURE__*/_react.default.createElement(_index2.default, {
    style: styleSheet.description
  }, locales.successDescription)), /*#__PURE__*/_react.default.createElement(_index.default, {
    style: styleSheet.backButton,
    onPress: onClose,
    testID: "close-button"
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusClose, {
    style: styleSheet.closeIcon
  })), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
    style: [styleSheet.ctaWrapper, fadeInContent.animatedStyle]
  }, /*#__PURE__*/_react.default.createElement(_index.default, {
    style: styleSheet.ctaOpenInbox,
    onPress: onOpenInbox,
    testID: "open-inbox-button"
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaCompositionCoorpacademyEmail, {
    style: styleSheet.mailIcon
  }), /*#__PURE__*/_react.default.createElement(_index2.default, {
    style: styleSheet.ctaOpenInboxText
  }, locales.successCta))));
};
var _default = exports.default = ConfirmEmailSent;
//# sourceMappingURL=index.native.js.map