import React, { useMemo } from 'react';
import { loadStripe } from '@stripe/stripe-js';
import { Elements } from '@stripe/react-stripe-js';
import useEngineContext from "../../../../../../../hooks/useEngineContext";
var StripeSDK = function StripeSDK(_ref) {
  var public_key = _ref.public_key,
    client_secret = _ref.client_secret,
    children = _ref.children,
    lang = _ref.lang;
  var context = useEngineContext();
  var getStore = context.appHelper.utils.getStore;
  var stripePromise = loadStripe(public_key);
  console.log('getState,', context);
  var locale = useMemo(function () {
    var _locale = 'en-US';
    return lang || (_locale === 'en-US' ? 'en' : _locale === 'zh-CN' ? 'zh' : 'zh-HK');
  }, []);
  var options = useMemo(function () {
    return {
      locale: locale,
      // passing the client secret obtained in step 2
      clientSecret: client_secret,
      // Fully customizable with appearance API.
      appearance: {
        theme: 'stripe',
        variables: {
          colorPrimary: '#0088cc'
        }
      }
    };
  }, [locale]);
  return /*#__PURE__*/React.createElement(Elements, {
    stripe: stripePromise,
    options: options
  }, children);
};
export default StripeSDK;