authscape 1.0.136 → 1.0.138

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/index.js CHANGED
@@ -681,11 +681,7 @@ var FileUploader = function FileUploader(_ref) {
681
681
  },
682
682
  "aria-labelledby": "alert-dialog-title",
683
683
  "aria-describedby": "alert-dialog-description"
684
- }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
685
- id: "alert-dialog-title"
686
- }, "Remove File"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
687
- id: "alert-dialog-description"
688
- }, "Are you sure you want to remove this file?")), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
684
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, "Remove File"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], null, "Are you sure you want to remove this file?")), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
689
685
  onClick: function onClick() {
690
686
  setViewDeleteDialog(false);
691
687
  }
@@ -717,6 +713,141 @@ var FileUploader = function FileUploader(_ref) {
717
713
  exports.FileUploader = FileUploader;
718
714
  "use strict";
719
715
 
716
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
717
+ Object.defineProperty(exports, "__esModule", {
718
+ value: true
719
+ });
720
+ exports["default"] = GooglePlacesModal;
721
+ var _react = _interopRequireWildcard(require("react"));
722
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
723
+ var _system = require("@mui/system");
724
+ var _PlacesAutocomplete = _interopRequireDefault(require("../modals/PlacesAutocomplete"));
725
+ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
726
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
727
+ var _script = _interopRequireDefault(require("next/script"));
728
+ var _usePlacesAutocomplete = _interopRequireWildcard(require("use-places-autocomplete"));
729
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
730
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
731
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
732
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
733
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
734
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
735
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
736
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
737
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
738
+ function GooglePlacesModal(_ref) {
739
+ var onSave = _ref.onSave,
740
+ _ref$createButtonText = _ref.createButtonText,
741
+ createButtonText = _ref$createButtonText === void 0 ? "Save" : _ref$createButtonText;
742
+ var _useState = (0, _react.useState)(""),
743
+ _useState2 = _slicedToArray(_useState, 2),
744
+ address = _useState2[0],
745
+ setAddress = _useState2[1];
746
+ var _useState3 = (0, _react.useState)(""),
747
+ _useState4 = _slicedToArray(_useState3, 2),
748
+ city = _useState4[0],
749
+ setCity = _useState4[1];
750
+ var _useState5 = (0, _react.useState)(""),
751
+ _useState6 = _slicedToArray(_useState5, 2),
752
+ state = _useState6[0],
753
+ setState = _useState6[1];
754
+ var _useState7 = (0, _react.useState)(""),
755
+ _useState8 = _slicedToArray(_useState7, 2),
756
+ zip = _useState8[0],
757
+ setPostalcode = _useState8[1];
758
+ var _useState9 = (0, _react.useState)(null),
759
+ _useState10 = _slicedToArray(_useState9, 2),
760
+ lat = _useState10[0],
761
+ setLat = _useState10[1];
762
+ var _useState11 = (0, _react.useState)(null),
763
+ _useState12 = _slicedToArray(_useState11, 2),
764
+ lng = _useState12[0],
765
+ setLng = _useState12[1];
766
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_PlacesAutocomplete["default"], {
767
+ placeholder: "Address",
768
+ defaultValue: address,
769
+ onSelected: function onSelected(data) {
770
+ setAddress(data.address);
771
+ setCity(data.city);
772
+ setState(data.state);
773
+ setPostalcode(data.postalCode);
774
+ setLat(data.lat);
775
+ setLng(data["long"]);
776
+ },
777
+ onChange: function onChange(address) {
778
+ setAddress(address);
779
+ }
780
+ }), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
781
+ container: true,
782
+ spacing: 1,
783
+ sx: {
784
+ marginTop: 1
785
+ }
786
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
787
+ item: true,
788
+ xs: 6
789
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
790
+ id: "outlined-basic",
791
+ label: "City",
792
+ variant: "outlined",
793
+ fullWidth: true,
794
+ value: city,
795
+ onChange: function onChange(val) {
796
+ setCity(val.currentTarget.value);
797
+ }
798
+ }))), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
799
+ item: true,
800
+ xs: 6
801
+ }, /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
802
+ id: "outlined-basic",
803
+ label: "State",
804
+ variant: "outlined",
805
+ fullWidth: true,
806
+ value: state,
807
+ onChange: function onChange(val) {
808
+ setState(val.currentTarget.value);
809
+ }
810
+ })))), /*#__PURE__*/_react["default"].createElement(_system.Box, {
811
+ sx: {
812
+ marginTop: 2
813
+ }
814
+ }, /*#__PURE__*/_react["default"].createElement(_TextField["default"], {
815
+ id: "outlined-basic",
816
+ label: "Postal code",
817
+ variant: "outlined",
818
+ fullWidth: true,
819
+ value: zip,
820
+ onChange: function onChange(val) {
821
+ setPostalcode(val.currentTarget.value);
822
+ }
823
+ })), /*#__PURE__*/_react["default"].createElement(_system.Box, {
824
+ sx: {
825
+ marginTop: 1,
826
+ textAlign: "right"
827
+ }
828
+ }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
829
+ variant: "contained",
830
+ onClick: function onClick() {
831
+ if (lat == null || lng == null) {
832
+ var addressInfo = address + " " + city + " " + state + " " + zip;
833
+ (0, _usePlacesAutocomplete.getGeocode)({
834
+ address: addressInfo
835
+ }).then(function (results) {
836
+ var _getLatLng = (0, _usePlacesAutocomplete.getLatLng)(results[0]),
837
+ lat = _getLatLng.lat,
838
+ lng = _getLatLng.lng;
839
+ setLat(lat);
840
+ setLng(lng);
841
+ });
842
+ }
843
+ onSave(address, city, state, zip, lat, lng);
844
+ }
845
+ }, createButtonText))), /*#__PURE__*/_react["default"].createElement(_script["default"], {
846
+ src: "https://maps.googleapis.com/maps/api/js?key=" + process.env.googleMapsKey + "&libraries=places"
847
+ }));
848
+ }
849
+ "use strict";
850
+
720
851
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
721
852
  Object.defineProperty(exports, "__esModule", {
722
853
  value: true
@@ -727,12 +858,15 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
727
858
  var _html2canvas = _interopRequireDefault(require("html2canvas"));
728
859
  var _jspdf = require("jspdf");
729
860
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
861
+ var _DownloadRounded = _interopRequireDefault(require("@mui/icons-material/DownloadRounded"));
730
862
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
731
863
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
732
864
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
733
865
  var PageToPDF = function PageToPDF(_ref) {
734
866
  var _ref$buttonText = _ref.buttonText,
735
867
  buttonText = _ref$buttonText === void 0 ? "Download" : _ref$buttonText,
868
+ _ref$startIcon = _ref.startIcon,
869
+ startIcon = _ref$startIcon === void 0 ? /*#__PURE__*/_react["default"].createElement(_DownloadRounded["default"], null) : _ref$startIcon,
736
870
  _ref$variant = _ref.variant,
737
871
  variant = _ref$variant === void 0 ? "contained" : _ref$variant,
738
872
  elementById = _ref.elementById,
@@ -762,6 +896,7 @@ var PageToPDF = function PageToPDF(_ref) {
762
896
  });
763
897
  };
764
898
  return /*#__PURE__*/_react["default"].createElement(_Box["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
899
+ startIcon: startIcon,
765
900
  variant: variant,
766
901
  onClick: function onClick() {
767
902
  printElement();
@@ -771,6 +906,308 @@ var PageToPDF = function PageToPDF(_ref) {
771
906
  exports.PageToPDF = PageToPDF;
772
907
  "use strict";
773
908
 
909
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
910
+ Object.defineProperty(exports, "__esModule", {
911
+ value: true
912
+ });
913
+ exports.StripePayment = void 0;
914
+ var _react = _interopRequireWildcard(require("react"));
915
+ var _reactStripeJs = require("@stripe/react-stripe-js");
916
+ var _stripeJs = require("@stripe/stripe-js");
917
+ var _Box = _interopRequireDefault(require("@mui/material/Box"));
918
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
919
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
920
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
921
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
922
+ var _checkoutForm = _interopRequireDefault(require("./checkoutForm"));
923
+ var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
924
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
925
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
926
+ var _Select = _interopRequireDefault(require("@mui/material/Select"));
927
+ var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
928
+ var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
929
+ var _excluded = ["children", "value", "index"];
930
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
931
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
932
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
933
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
934
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
935
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
936
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
937
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
938
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
939
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
940
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
941
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
942
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
943
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
944
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
945
+ var StripePayment = function StripePayment() {
946
+ var stripePromise = (0, _stripeJs.loadStripe)(process.env.stripePublicKey);
947
+ var _useState = (0, _react.useState)(null),
948
+ _useState2 = _slicedToArray(_useState, 2),
949
+ options = _useState2[0],
950
+ setOptions = _useState2[1];
951
+ var _useState3 = (0, _react.useState)(0),
952
+ _useState4 = _slicedToArray(_useState3, 2),
953
+ value = _useState4[0],
954
+ setValue = _useState4[1];
955
+ var _useState5 = (0, _react.useState)([]),
956
+ _useState6 = _slicedToArray(_useState5, 2),
957
+ paymentMethods = _useState6[0],
958
+ setPaymentMethods = _useState6[1];
959
+ var _useState7 = (0, _react.useState)(null),
960
+ _useState8 = _slicedToArray(_useState7, 2),
961
+ paymentMethod = _useState8[0],
962
+ setPaymentMethod = _useState8[1];
963
+ var paymentMethodOpened = /*#__PURE__*/function () {
964
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
965
+ var response, responsePayments;
966
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
967
+ while (1) switch (_context.prev = _context.next) {
968
+ case 0:
969
+ response = null;
970
+ if (!(currentUser == null)) {
971
+ _context.next = 7;
972
+ break;
973
+ }
974
+ _context.next = 4;
975
+ return apiService().post("/Payment/ConnectCustomerNoAuth", {
976
+ paymentRequestType: paymentRequestType,
977
+ amount: amount,
978
+ priceId: priceId,
979
+ name: logOffUserName,
980
+ typeOfPayment: 1,
981
+ email: logOffEmail,
982
+ stripeCustomerId: stripeCustomerId
983
+ });
984
+ case 4:
985
+ response = _context.sent;
986
+ _context.next = 10;
987
+ break;
988
+ case 7:
989
+ _context.next = 9;
990
+ return apiService().post("/Payment/ConnectCustomer", {
991
+ paymentRequestType: paymentRequestType,
992
+ amount: amount,
993
+ priceId: priceId,
994
+ typeOfPayment: 1,
995
+ stripeCustomerId: stripeCustomerId
996
+ });
997
+ case 9:
998
+ response = _context.sent;
999
+ case 10:
1000
+ if (!(response != null && response.status == 200)) {
1001
+ _context.next = 16;
1002
+ break;
1003
+ }
1004
+ setOptions({
1005
+ clientSecret: response.data
1006
+ });
1007
+ _context.next = 14;
1008
+ return apiService().get("/Payment/GetPaymentMethods");
1009
+ case 14:
1010
+ responsePayments = _context.sent;
1011
+ if (responsePayments != null && responsePayments.status == 200) {
1012
+ if (responsePayments.data.length > 0) {
1013
+ setValue(1);
1014
+ }
1015
+ setPaymentMethods(responsePayments.data);
1016
+ }
1017
+ case 16:
1018
+ case "end":
1019
+ return _context.stop();
1020
+ }
1021
+ }, _callee);
1022
+ }));
1023
+ return function paymentMethodOpened() {
1024
+ return _ref.apply(this, arguments);
1025
+ };
1026
+ }();
1027
+ (0, _react.useEffect)(function () {
1028
+ if (isOpen) {
1029
+ paymentMethodOpened();
1030
+ }
1031
+ }, [isOpen]);
1032
+ var handleChange = function handleChange(event, newValue) {
1033
+ setValue(newValue);
1034
+ };
1035
+ function a11yProps(index) {
1036
+ return {
1037
+ id: "simple-tab-".concat(index),
1038
+ 'aria-controls': "simple-tabpanel-".concat(index)
1039
+ };
1040
+ }
1041
+ var PaymentMethod = function PaymentMethod(_ref2) {
1042
+ var paymentMethod = _ref2.paymentMethod,
1043
+ clicked = _ref2.clicked;
1044
+ return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
1045
+ fullWidth: true,
1046
+ sx: {
1047
+ height: 160,
1048
+ width: "100%",
1049
+ marginTop: 2,
1050
+ backgroundColor: "#2196F3",
1051
+ position: "relative",
1052
+ border: "1px solid #2196F3",
1053
+ borderRadius: 1,
1054
+ display: "flex",
1055
+ flexDirection: "column",
1056
+ justifyContent: "center",
1057
+ textAlign: "center",
1058
+ cursor: "pointer"
1059
+ },
1060
+ onClick: function onClick() {
1061
+ clicked(paymentMethod.id);
1062
+ }
1063
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
1064
+ gutterBottom: true,
1065
+ variant: "body",
1066
+ component: "div",
1067
+ sx: {
1068
+ fontSize: 14,
1069
+ position: "absolute",
1070
+ left: 15,
1071
+ top: 10,
1072
+ color: "white"
1073
+ }
1074
+ }, paymentMethod.brand), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
1075
+ gutterBottom: true,
1076
+ variant: "body",
1077
+ component: "div",
1078
+ sx: {
1079
+ verticalAlign: "middle",
1080
+ fontSize: 18,
1081
+ color: "white"
1082
+ }
1083
+ }, "* * * * \xA0 * * * * \xA0 * * * * \xA0 ", paymentMethod.last4), /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
1084
+ container: true,
1085
+ spacing: 1,
1086
+ sx: {
1087
+ position: "absolute",
1088
+ bottom: 8,
1089
+ marginLeft: 0,
1090
+ width: "100%"
1091
+ }
1092
+ }, /*#__PURE__*/_react["default"].createElement(_Grid["default"], {
1093
+ item: true,
1094
+ xs: 12,
1095
+ sx: {
1096
+ textAlign: "right",
1097
+ paddingRight: 2
1098
+ }
1099
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
1100
+ gutterBottom: true,
1101
+ variant: "body",
1102
+ component: "div",
1103
+ sx: {
1104
+ fontSize: 12,
1105
+ marginLeft: 2,
1106
+ marginTop: 1,
1107
+ color: "#e9e9e9"
1108
+ }
1109
+ }, "EXPIRES"), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
1110
+ gutterBottom: true,
1111
+ variant: "body",
1112
+ component: "div",
1113
+ sx: {
1114
+ fontSize: 12,
1115
+ marginLeft: 2,
1116
+ marginTop: "-9px",
1117
+ color: "white"
1118
+ }
1119
+ }, paymentMethod.expMonth, "/", paymentMethod.expYear))));
1120
+ };
1121
+ function TabPanel(props) {
1122
+ var children = props.children,
1123
+ value = props.value,
1124
+ index = props.index,
1125
+ other = _objectWithoutProperties(props, _excluded);
1126
+ return /*#__PURE__*/_react["default"].createElement("div", _extends({
1127
+ role: "tabpanel",
1128
+ hidden: value !== index,
1129
+ id: "simple-tabpanel-".concat(index),
1130
+ "aria-labelledby": "simple-tab-".concat(index)
1131
+ }, other), value === index && /*#__PURE__*/_react["default"].createElement(_Box["default"], {
1132
+ sx: {
1133
+ p: 3
1134
+ }
1135
+ }, /*#__PURE__*/_react["default"].createElement(_Typography["default"], null, children)));
1136
+ }
1137
+ var PaymentContent = function PaymentContent() {
1138
+ return /*#__PURE__*/_react["default"].createElement(_Box["default"], {
1139
+ sx: {
1140
+ width: '100%'
1141
+ }
1142
+ }, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
1143
+ sx: {
1144
+ borderBottom: 1,
1145
+ borderColor: 'divider'
1146
+ }
1147
+ }), paymentMethods.length > 0 && /*#__PURE__*/_react["default"].createElement(TabPanel, {
1148
+ value: value,
1149
+ index: 1
1150
+ }, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
1151
+ sx: {
1152
+ marginTop: 4
1153
+ },
1154
+ fullWidth: true,
1155
+ value: paymentMethod,
1156
+ onChange: function onChange(val) {
1157
+ setPaymentMethod(val.target.value);
1158
+ }
1159
+ }, paymentMethods != null && paymentMethods.map(function (paymentMethod, index) {
1160
+ return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
1161
+ key: index,
1162
+ value: paymentMethod.id,
1163
+ fullWidth: true,
1164
+ sx: {
1165
+ width: "100%"
1166
+ }
1167
+ }, /*#__PURE__*/_react["default"].createElement(PaymentMethod, {
1168
+ paymentMethod: paymentMethod,
1169
+ clicked: function clicked() {}
1170
+ }));
1171
+ }))), /*#__PURE__*/_react["default"].createElement(TabPanel, {
1172
+ value: value,
1173
+ index: 0
1174
+ }, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_Box["default"], {
1175
+ mt: 4
1176
+ }, options != null && process.env.stripePublicKey != null && /*#__PURE__*/_react["default"].createElement(_reactStripeJs.Elements, {
1177
+ stripe: stripePromise,
1178
+ options: options
1179
+ }, /*#__PURE__*/_react["default"].createElement(_checkoutForm["default"], {
1180
+ payButtonText: payButtonText,
1181
+ clientSecret: options != null ? options.clientSecret : null,
1182
+ onResponse: onResponse,
1183
+ amount: amount
1184
+ }))))));
1185
+ };
1186
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isModal && /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
1187
+ fullWidth: true,
1188
+ maxWidth: "sm",
1189
+ open: isOpen,
1190
+ onClose: function onClose() {
1191
+ return onModalClose();
1192
+ }
1193
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], null, title, /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
1194
+ "aria-label": "close",
1195
+ onClick: function onClick() {
1196
+ onModalClose();
1197
+ },
1198
+ sx: {
1199
+ position: 'absolute',
1200
+ right: 8,
1201
+ top: 8,
1202
+ color: function color(theme) {
1203
+ return theme.palette.grey[500];
1204
+ }
1205
+ }
1206
+ }, /*#__PURE__*/_react["default"].createElement(_Close["default"], null))), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, description, /*#__PURE__*/_react["default"].createElement(PaymentContent, null)), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null)), !isModal && /*#__PURE__*/_react["default"].createElement(PaymentContent, null));
1207
+ };
1208
+ exports.StripePayment = StripePayment;
1209
+ "use strict";
1210
+
774
1211
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
775
1212
  Object.defineProperty(exports, "__esModule", {
776
1213
  value: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.136",
3
+ "version": "1.0.138",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -322,9 +322,9 @@ export const FileUploader = ({
322
322
  }}
323
323
  aria-labelledby="alert-dialog-title"
324
324
  aria-describedby="alert-dialog-description">
325
- <DialogTitle id="alert-dialog-title">Remove File</DialogTitle>
325
+ <DialogTitle>Remove File</DialogTitle>
326
326
  <DialogContent>
327
- <DialogContentText id="alert-dialog-description">
327
+ <DialogContentText>
328
328
  Are you sure you want to remove this file?
329
329
  </DialogContentText>
330
330
  </DialogContent>
@@ -0,0 +1,115 @@
1
+ import React, { useState, useRef, useEffect } from "react";
2
+ import Button from "@mui/material/Button";
3
+ import { Box } from "@mui/system";
4
+ import AutoCompleteDialog from "../modals/PlacesAutocomplete";
5
+ import TextField from "@mui/material/TextField";
6
+ import Grid from "@mui/material/Grid";
7
+ import Script from 'next/script';
8
+
9
+ import usePlacesAutocomplete, {
10
+ getGeocode,
11
+ getZipCode,
12
+ getDetails,
13
+ getLatLng,
14
+ } from "use-places-autocomplete";
15
+
16
+ export default function GooglePlacesModal({
17
+ onSave,
18
+ createButtonText = "Save"
19
+ }) {
20
+ const [address, setAddress] = useState("");
21
+ const [city, setCity] = useState("");
22
+ const [state, setState] = useState("");
23
+ const [zip, setPostalcode] = useState("");
24
+ const [lat, setLat] = useState(null);
25
+ const [lng, setLng] = useState(null);
26
+
27
+ return (
28
+ <>
29
+ <Box>
30
+ <AutoCompleteDialog
31
+ placeholder={"Address"}
32
+ defaultValue={address}
33
+ onSelected={(data) => {
34
+ setAddress(data.address);
35
+ setCity(data.city);
36
+ setState(data.state);
37
+ setPostalcode(data.postalCode);
38
+ setLat(data.lat);
39
+ setLng(data.long);
40
+ }}
41
+ onChange={(address) => {
42
+ setAddress(address);
43
+ }}
44
+ ></AutoCompleteDialog>
45
+
46
+ <Grid container spacing={1} sx={{ marginTop: 1 }}>
47
+ <Grid item xs={6}>
48
+ <Box>
49
+ <TextField
50
+ id="outlined-basic"
51
+ label="City"
52
+ variant="outlined"
53
+ fullWidth={true}
54
+ value={city}
55
+ onChange={(val) => {
56
+ setCity(val.currentTarget.value);
57
+ }}
58
+ />
59
+ </Box>
60
+ </Grid>
61
+
62
+ <Grid item xs={6}>
63
+ <Box>
64
+ <TextField
65
+ id="outlined-basic"
66
+ label="State"
67
+ variant="outlined"
68
+ fullWidth={true}
69
+ value={state}
70
+ onChange={(val) => {
71
+ setState(val.currentTarget.value);
72
+ }}
73
+ />
74
+ </Box>
75
+ </Grid>
76
+ </Grid>
77
+
78
+ <Box sx={{ marginTop: 2 }}>
79
+ <TextField
80
+ id="outlined-basic"
81
+ label="Postal code"
82
+ variant="outlined"
83
+ fullWidth={true}
84
+ value={zip}
85
+ onChange={(val) => {
86
+ setPostalcode(val.currentTarget.value);
87
+ }}
88
+ />
89
+ </Box>
90
+
91
+ <Box sx={{ marginTop: 1, textAlign: "right" }}>
92
+ <Button
93
+ variant="contained"
94
+ onClick={() => {
95
+ if (lat == null || lng == null) {
96
+ let addressInfo =
97
+ address + " " + city + " " + state + " " + zip;
98
+ getGeocode({ address: addressInfo }).then((results) => {
99
+ const { lat, lng } = getLatLng(results[0]);
100
+ setLat(lat);
101
+ setLng(lng);
102
+ });
103
+ }
104
+
105
+ onSave(address, city, state, zip, lat, lng);
106
+ }}>
107
+ {createButtonText}
108
+ </Button>
109
+ </Box>
110
+ </Box>
111
+
112
+ <Script src={"https://maps.googleapis.com/maps/api/js?key=" + process.env.googleMapsKey + "&libraries=places"}></Script>
113
+ </>
114
+ );
115
+ }
@@ -0,0 +1,251 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import {Elements} from '@stripe/react-stripe-js';
3
+ import {loadStripe} from '@stripe/stripe-js';
4
+ import Box from '@mui/material/Box';
5
+ import Dialog from '@mui/material/Dialog';
6
+ import DialogActions from '@mui/material/DialogActions';
7
+ import DialogContent from '@mui/material/DialogContent';
8
+ import DialogTitle from '@mui/material/DialogTitle';
9
+ import CheckoutForm from './checkoutForm';
10
+ import IconButton from '@mui/material/IconButton';
11
+ import CloseIcon from '@mui/icons-material/Close';
12
+ import Typography from '@mui/material/Typography';
13
+ import Select from '@mui/material/Select';
14
+ import MenuItem from '@mui/material/MenuItem';
15
+ import Grid from '@mui/material/Grid';
16
+
17
+ export const StripePayment = () => {
18
+
19
+ const stripePromise = loadStripe(process.env.stripePublicKey);
20
+ const [options, setOptions] = useState(null);
21
+ const [value, setValue] = useState(0);
22
+ const [paymentMethods, setPaymentMethods] = useState([]);
23
+ const [paymentMethod, setPaymentMethod] = useState(null);
24
+
25
+ const paymentMethodOpened = async () => {
26
+
27
+ let response = null;
28
+ if (currentUser == null)
29
+ {
30
+ response = await apiService().post("/Payment/ConnectCustomerNoAuth", {
31
+ paymentRequestType: paymentRequestType,
32
+ amount: amount,
33
+ priceId: priceId,
34
+ name: logOffUserName,
35
+ typeOfPayment: 1,
36
+ email: logOffEmail,
37
+ stripeCustomerId: stripeCustomerId
38
+ });
39
+ }
40
+ else
41
+ {
42
+ response = await apiService().post("/Payment/ConnectCustomer", {
43
+ paymentRequestType: paymentRequestType,
44
+ amount: amount,
45
+ priceId: priceId,
46
+ typeOfPayment: 1,
47
+ stripeCustomerId: stripeCustomerId
48
+ });
49
+ }
50
+
51
+
52
+ if (response != null && response.status == 200)
53
+ {
54
+ setOptions({
55
+ clientSecret: response.data,
56
+ });
57
+
58
+ let responsePayments = await apiService().get("/Payment/GetPaymentMethods");
59
+ if (responsePayments != null && responsePayments.status == 200)
60
+ {
61
+ if (responsePayments.data.length > 0)
62
+ {
63
+ setValue(1);
64
+ }
65
+ setPaymentMethods(responsePayments.data);
66
+ }
67
+ }
68
+ }
69
+
70
+ useEffect(() => {
71
+
72
+ if (isOpen)
73
+ {
74
+ paymentMethodOpened();
75
+ }
76
+
77
+ }, [isOpen]);
78
+
79
+ const handleChange = (event, newValue) => {
80
+ setValue(newValue);
81
+ };
82
+
83
+ function a11yProps(index) {
84
+ return {
85
+ id: `simple-tab-${index}`,
86
+ 'aria-controls': `simple-tabpanel-${index}`,
87
+ };
88
+ }
89
+
90
+ const PaymentMethod = ({paymentMethod, clicked}) => {
91
+ return (
92
+ <Box fullWidth={true} sx={{height: 160, width:"100%", marginTop:2, backgroundColor:"#2196F3", position:"relative", border: "1px solid #2196F3", borderRadius: 1, display:"flex", flexDirection:"column", justifyContent:"center", textAlign:"center", cursor:"pointer"}}
93
+ onClick={() => {
94
+ clicked(paymentMethod.id);
95
+ }}>
96
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:14, position:"absolute", left:15, top:10, color:"white"}}>
97
+ {paymentMethod.brand}
98
+ </Typography>
99
+ <Typography gutterBottom variant="body" component="div" sx={{verticalAlign:"middle", fontSize:18, color:"white"}}>
100
+ * * * * &nbsp; * * * * &nbsp; * * * * &nbsp; {paymentMethod.last4}
101
+ </Typography>
102
+
103
+ <Grid container spacing={1} sx={{position:"absolute", bottom:8, marginLeft:0, width: "100%"}}>
104
+ <Grid item xs={12} sx={{textAlign:"right", paddingRight:2}}>
105
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:1, color:"#e9e9e9"}}>
106
+ EXPIRES
107
+ </Typography>
108
+
109
+ <Typography gutterBottom variant="body" component="div" sx={{fontSize:12, marginLeft:2, marginTop:"-9px", color:"white"}}>
110
+ {paymentMethod.expMonth}/{paymentMethod.expYear}
111
+ </Typography>
112
+ </Grid>
113
+ </Grid>
114
+ </Box>
115
+ );
116
+ };
117
+
118
+ function TabPanel(props) {
119
+ const { children, value, index, ...other } = props;
120
+
121
+ return (
122
+ <div
123
+ role="tabpanel"
124
+ hidden={value !== index}
125
+ id={`simple-tabpanel-${index}`}
126
+ aria-labelledby={`simple-tab-${index}`}
127
+ {...other}
128
+ >
129
+ {value === index && (
130
+ <Box sx={{ p: 3 }}>
131
+ <Typography>{children}</Typography>
132
+ </Box>
133
+ )}
134
+ </div>
135
+ );
136
+ }
137
+
138
+ const PaymentContent = () => {
139
+ return (
140
+ <Box sx={{ width: '100%' }}>
141
+ <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
142
+ {/* <Tabs value={value} onChange={handleChange} aria-label="basic tabs example">
143
+ <Tab label="Add Payment Method" {...a11yProps(0)} />
144
+ {paymentMethods.length > 0 &&
145
+ <Tab label="Existing Payment Method" {...a11yProps(1)} />
146
+ }
147
+ </Tabs> */}
148
+ </Box>
149
+ {paymentMethods.length > 0 &&
150
+ <TabPanel value={value} index={1}>
151
+
152
+ <Select
153
+ sx={{marginTop:4}}
154
+ fullWidth={true}
155
+ value={paymentMethod}
156
+ onChange={(val) => {
157
+ setPaymentMethod(val.target.value);
158
+ }}>
159
+ {paymentMethods != null && paymentMethods.map((paymentMethod, index) => {
160
+ return (
161
+ <MenuItem key={index} value={paymentMethod.id} fullWidth={true} sx={{width:"100%"}}>
162
+ <PaymentMethod paymentMethod={paymentMethod} clicked={() => {
163
+ }} />
164
+ </MenuItem>)
165
+ })}
166
+ </Select>
167
+
168
+ {/* <Button startIcon={<PaymentRoundedIcon/>} type="submit" variant="contained" disabled={paymentMethod == null} sx={{marginTop:2}} onClick={async () => {
169
+
170
+ if (invoiceId != null)
171
+ {
172
+ setIsLoading(true);
173
+ let response = await apiService().post("/Invoices/PayInvoice", {
174
+ InvoiceId: invoiceId,
175
+ WalletId: paymentMethod
176
+ });
177
+ setIsLoading(false);
178
+
179
+ if (response != null && response.status == 200)
180
+ {
181
+ window.location.reload();
182
+ }
183
+ else
184
+ {
185
+ alert("We had an issue with the payment method");
186
+ }
187
+ }
188
+
189
+ }}>{payButtonText}</Button> */}
190
+
191
+ </TabPanel>
192
+ }
193
+
194
+ <TabPanel value={value} index={0}>
195
+ <div>
196
+ <Box mt={4} >
197
+ {(options != null && process.env.stripePublicKey != null) &&
198
+ <Elements stripe={stripePromise} options={options}>
199
+ <CheckoutForm payButtonText={payButtonText} clientSecret={options != null ? options.clientSecret : null} onResponse={onResponse} amount={amount} />
200
+ </Elements>
201
+ }
202
+ </Box>
203
+ </div>
204
+ </TabPanel>
205
+ </Box>
206
+ )
207
+ }
208
+
209
+ return (
210
+ <>
211
+ {isModal &&
212
+ <Dialog
213
+ fullWidth={true}
214
+ maxWidth={"sm"}
215
+ open={isOpen}
216
+ onClose={() => onModalClose()}>
217
+ <DialogTitle>{title}
218
+
219
+ <IconButton
220
+ aria-label="close"
221
+ onClick={() => {
222
+
223
+ onModalClose();
224
+ }}
225
+ sx={{
226
+ position: 'absolute',
227
+ right: 8,
228
+ top: 8,
229
+ color: (theme) => theme.palette.grey[500],
230
+ }}>
231
+ <CloseIcon />
232
+ </IconButton>
233
+ </DialogTitle>
234
+ <DialogContent>
235
+ {description}
236
+ <PaymentContent />
237
+ </DialogContent>
238
+ <DialogActions>
239
+ </DialogActions>
240
+ </Dialog>
241
+ }
242
+
243
+ {!isModal &&
244
+ <PaymentContent />
245
+ }
246
+
247
+ </>
248
+ )
249
+
250
+
251
+ }
@@ -3,8 +3,9 @@ import Box from '@mui/material/Box';
3
3
  import html2canvas from 'html2canvas';
4
4
  import { jsPDF } from "jspdf";
5
5
  import Button from "@mui/material/Button";
6
+ import DownloadRoundedIcon from '@mui/icons-material/DownloadRounded';
6
7
 
7
- export const PageToPDF = ({buttonText = "Download", variant = "contained", elementById, scale = 2, fileName = "download"}) => {
8
+ export const PageToPDF = ({buttonText = "Download", startIcon = <DownloadRoundedIcon/>, variant = "contained", elementById, scale = 2, fileName = "download"}) => {
8
9
 
9
10
  const printElement = () => {
10
11
 
@@ -30,7 +31,7 @@ export const PageToPDF = ({buttonText = "Download", variant = "contained", eleme
30
31
 
31
32
  return (
32
33
  <Box>
33
- <Button variant={variant} onClick={() => {
34
+ <Button startIcon={startIcon} variant={variant} onClick={() => {
34
35
 
35
36
  printElement();
36
37