"use strict";

exports.__esModule = true;
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _reactNative = require("react-native");
var _reactNativeModal = _interopRequireDefault(require("react-native-modal"));
var _novaIcons = require("@coorpacademy/nova-icons");
var _templateContext = require("../../template/app-review/template-context");
var _index = _interopRequireDefault(require("../../hoc/touchable/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 createStyleSheet = (brandTheme, theme) => _reactNative.StyleSheet.create({
  popin: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    justifyContent: 'center',
    alignItems: 'center'
  },
  content: {
    backgroundColor: '#fff',
    justifyContent: 'space-between',
    alignItems: 'center',
    borderRadius: 8,
    paddingVertical: 24
  },
  iconWrapper: {
    width: 100,
    height: 100,
    backgroundColor: '#FFEFEB',
    justifyContent: 'center',
    borderRadius: 60,
    marginBottom: 12
  },
  icon: {
    alignSelf: 'center',
    width: 60,
    height: 60,
    fill: brandTheme.colors?.primary
  },
  title: {
    textAlign: 'center',
    lineHeight: 24,
    fontWeight: '700',
    fontSize: 20,
    marginHorizontal: 24,
    marginVertical: 12
  },
  description1: {
    textAlign: 'center',
    lineHeight: 19,
    fontWeight: '300',
    fontSize: 14,
    marginHorizontal: 24,
    marginVertical: 12
  },
  description2: {
    textAlign: 'center',
    lineHeight: 19,
    fontWeight: '700',
    fontSize: 16,
    paddingHorizontal: 48,
    marginVertical: 12
  },
  button: {
    height: 44,
    backgroundColor: brandTheme.colors?.primary,
    borderRadius: 7,
    justifyContent: 'center',
    padding: 12,
    paddingVertical: 12,
    marginTop: 12
  },
  buttonText: {
    alignSelf: 'center',
    color: '#FFFFFF',
    fontWeight: theme.fontWeight.bold,
    fontFamily: 'System',
    fontSize: 14,
    lineHeight: 20
  },
  closeButton: {
    position: 'absolute',
    top: 0,
    right: 0,
    width: 45,
    height: 45,
    padding: 10,
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
  closeIcon: {
    width: '100%',
    height: '100%',
    fill: '#aeaeae'
  }
});
const PopinIntro = props => {
  const templateContext = (0, _templateContext.useTemplateContext)();
  const [styleSheet, setStylesheet] = (0, _react.useState)(null);
  const {
    brandTheme,
    theme
  } = templateContext;
  const {
    isVisible,
    onValidate,
    onCancel,
    locales,
    Icon
  } = props;
  (0, _react.useEffect)(() => {
    const _stylesheet = createStyleSheet(brandTheme, theme);
    setStylesheet(_stylesheet);
  }, [brandTheme, theme]);
  if (!styleSheet) {
    return null;
  }
  return /*#__PURE__*/_react.default.createElement(_reactNativeModal.default, {
    isVisible: isVisible,
    style: styleSheet.popin,
    testID: "intro-popin"
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.content
  }, Icon ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
    style: styleSheet.iconWrapper
  }, /*#__PURE__*/_react.default.createElement(Icon, {
    style: styleSheet.icon
  })) : null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: styleSheet.title
  }, locales.title), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: styleSheet.description1
  }, locales.description1), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: styleSheet.description2
  }, locales.description2), /*#__PURE__*/_react.default.createElement(_index.default, {
    style: styleSheet.button,
    onPress: onValidate,
    testID: "intro-popin-validate-button"
  }, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
    style: styleSheet.buttonText
  }, locales.cta)), /*#__PURE__*/_react.default.createElement(_index.default, {
    style: styleSheet.closeButton,
    onPress: onCancel,
    testID: "intro-popin-cancel-button"
  }, /*#__PURE__*/_react.default.createElement(_novaIcons.NovaSolidStatusClose, {
    style: styleSheet.closeIcon
  }))));
};
var _default = exports.default = PopinIntro;
//# sourceMappingURL=index.native.js.map