authscape 1.0.578 → 1.0.582
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
|
@@ -5378,6 +5378,282 @@ var PageToPDF = function PageToPDF(_ref) {
|
|
|
5378
5378
|
exports.PageToPDF = PageToPDF;
|
|
5379
5379
|
"use strict";
|
|
5380
5380
|
|
|
5381
|
+
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); }
|
|
5382
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5383
|
+
value: true
|
|
5384
|
+
});
|
|
5385
|
+
exports.Pricing = Pricing;
|
|
5386
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
5387
|
+
var _system = require("@mui/system");
|
|
5388
|
+
var _material = require("@mui/material");
|
|
5389
|
+
var _ChevronRightRounded = _interopRequireDefault(require("@mui/icons-material/ChevronRightRounded"));
|
|
5390
|
+
var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
5391
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
5392
|
+
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
5393
|
+
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
5394
|
+
var _reactHookForm = require("react-hook-form");
|
|
5395
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
5396
|
+
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); }
|
|
5397
|
+
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; }
|
|
5398
|
+
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; }
|
|
5399
|
+
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); } }
|
|
5400
|
+
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); }); }; }
|
|
5401
|
+
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); }
|
|
5402
|
+
function Pricing(_ref) {
|
|
5403
|
+
var _ref$title = _ref.title,
|
|
5404
|
+
title = _ref$title === void 0 ? null : _ref$title,
|
|
5405
|
+
_ref$tiers = _ref.tiers,
|
|
5406
|
+
tiers = _ref$tiers === void 0 ? [] : _ref$tiers,
|
|
5407
|
+
_ref$features = _ref.features,
|
|
5408
|
+
features = _ref$features === void 0 ? null : _ref$features,
|
|
5409
|
+
_ref$onButtonClicked = _ref.onButtonClicked,
|
|
5410
|
+
onButtonClicked = _ref$onButtonClicked === void 0 ? null : _ref$onButtonClicked;
|
|
5411
|
+
var _useForm = (0, _reactHookForm.useForm)(),
|
|
5412
|
+
control = _useForm.control,
|
|
5413
|
+
register = _useForm.register,
|
|
5414
|
+
handleSubmit = _useForm.handleSubmit,
|
|
5415
|
+
errors = _useForm.formState.errors,
|
|
5416
|
+
watch = _useForm.watch,
|
|
5417
|
+
setValue = _useForm.setValue;
|
|
5418
|
+
var calculateQty = function calculateQty(qty) {
|
|
5419
|
+
var newMax = qty.minQty + qty.maxQty;
|
|
5420
|
+
var menuItemArray = [];
|
|
5421
|
+
var newIndex = 1;
|
|
5422
|
+
for (var index = qty.minQty; index < newMax; index++) {
|
|
5423
|
+
menuItemArray[newIndex] = newIndex;
|
|
5424
|
+
newIndex++;
|
|
5425
|
+
}
|
|
5426
|
+
return menuItemArray;
|
|
5427
|
+
};
|
|
5428
|
+
return /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5429
|
+
sx: {
|
|
5430
|
+
paddingTop: 2
|
|
5431
|
+
}
|
|
5432
|
+
}, /*#__PURE__*/_react["default"].createElement("form", null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5433
|
+
container: true,
|
|
5434
|
+
spacing: 0,
|
|
5435
|
+
justifyContent: "center",
|
|
5436
|
+
alignItems: "stretch",
|
|
5437
|
+
direction: "row"
|
|
5438
|
+
}, title != null && /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5439
|
+
item: true,
|
|
5440
|
+
xs: 12,
|
|
5441
|
+
sm: 6,
|
|
5442
|
+
md: 3,
|
|
5443
|
+
key: "plans"
|
|
5444
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
5445
|
+
variant: "h4",
|
|
5446
|
+
gutterBottom: true
|
|
5447
|
+
}, title)), tiers.map(function (tier) {
|
|
5448
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5449
|
+
item: true,
|
|
5450
|
+
xs: 12,
|
|
5451
|
+
sm: 6,
|
|
5452
|
+
md: 3,
|
|
5453
|
+
key: tier.title
|
|
5454
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5455
|
+
sx: {
|
|
5456
|
+
paddingBottom: 2,
|
|
5457
|
+
padding: 2
|
|
5458
|
+
}
|
|
5459
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5460
|
+
sx: {
|
|
5461
|
+
textAlign: "center",
|
|
5462
|
+
paddingTop: 2
|
|
5463
|
+
}
|
|
5464
|
+
}, tier.image != null && /*#__PURE__*/_react["default"].createElement("img", {
|
|
5465
|
+
src: tier.image,
|
|
5466
|
+
width: 200,
|
|
5467
|
+
height: 200
|
|
5468
|
+
}), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
5469
|
+
variant: "h3",
|
|
5470
|
+
component: "h2",
|
|
5471
|
+
sx: {
|
|
5472
|
+
paddingTop: 3
|
|
5473
|
+
}
|
|
5474
|
+
}, tier.title), tier.subTitle && /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
5475
|
+
variant: "h6",
|
|
5476
|
+
component: "h2",
|
|
5477
|
+
sx: {
|
|
5478
|
+
paddingTop: 2
|
|
5479
|
+
}
|
|
5480
|
+
}, tier.subTitle), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5481
|
+
container: true,
|
|
5482
|
+
spacing: 0
|
|
5483
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5484
|
+
item: true,
|
|
5485
|
+
xs: tier.qty != null ? 6 : 12,
|
|
5486
|
+
sx: {
|
|
5487
|
+
padding: 4
|
|
5488
|
+
}
|
|
5489
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5490
|
+
component: "span",
|
|
5491
|
+
sx: {
|
|
5492
|
+
fontSize: 30,
|
|
5493
|
+
fontWeight: "bold"
|
|
5494
|
+
}
|
|
5495
|
+
}, "$", tier.price), tier.duration != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5496
|
+
component: "span"
|
|
5497
|
+
}, "/ ", tier.duration)), tier.qty != null && /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5498
|
+
item: true,
|
|
5499
|
+
xs: 6,
|
|
5500
|
+
sx: {
|
|
5501
|
+
padding: 4
|
|
5502
|
+
}
|
|
5503
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
|
|
5504
|
+
name: "qty-" + tier.id,
|
|
5505
|
+
control: control,
|
|
5506
|
+
rules: {
|
|
5507
|
+
required: false
|
|
5508
|
+
},
|
|
5509
|
+
render: function render(_ref2) {
|
|
5510
|
+
var renderField = _ref2.renderField;
|
|
5511
|
+
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
5512
|
+
fullWidth: true
|
|
5513
|
+
}, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
|
|
5514
|
+
id: "demo-simple-select-label"
|
|
5515
|
+
}, "Quantity"), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("qty-" + tier.id, {
|
|
5516
|
+
required: false
|
|
5517
|
+
}), renderField, {
|
|
5518
|
+
labelId: "demo-simple-select-label",
|
|
5519
|
+
id: "demo-simple-select",
|
|
5520
|
+
defaultValue: 1,
|
|
5521
|
+
label: "Quantity"
|
|
5522
|
+
}), calculateQty(tier.qty).map(function (menuItem, index) {
|
|
5523
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
5524
|
+
key: index,
|
|
5525
|
+
value: menuItem
|
|
5526
|
+
}, menuItem);
|
|
5527
|
+
})));
|
|
5528
|
+
}
|
|
5529
|
+
}))), tier.modifiers != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5530
|
+
sx: {
|
|
5531
|
+
paddingBottom: 2
|
|
5532
|
+
}
|
|
5533
|
+
}, tier.modifiers.map(function (modifier, index) {
|
|
5534
|
+
return /*#__PURE__*/_react["default"].createElement(_reactHookForm.Controller, {
|
|
5535
|
+
name: "modifier-" + tier.id + modifier.name,
|
|
5536
|
+
control: control,
|
|
5537
|
+
rules: {
|
|
5538
|
+
required: false
|
|
5539
|
+
},
|
|
5540
|
+
render: function render(_ref3) {
|
|
5541
|
+
var renderField = _ref3.renderField;
|
|
5542
|
+
return /*#__PURE__*/_react["default"].createElement(_FormControl["default"], {
|
|
5543
|
+
fullWidth: true,
|
|
5544
|
+
key: index,
|
|
5545
|
+
sx: {
|
|
5546
|
+
marginTop: 2
|
|
5547
|
+
}
|
|
5548
|
+
}, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], {
|
|
5549
|
+
id: "demo-simple-select-label"
|
|
5550
|
+
}, modifier.name), /*#__PURE__*/_react["default"].createElement(_Select["default"], _extends({}, register("modifier-" + tier.id + "-" + modifier.name, {
|
|
5551
|
+
required: false
|
|
5552
|
+
}), renderField, {
|
|
5553
|
+
labelId: "demo-simple-select-label",
|
|
5554
|
+
id: "demo-simple-select",
|
|
5555
|
+
defaultValue: 0,
|
|
5556
|
+
label: modifier.name
|
|
5557
|
+
}), modifier.options.map(function (mod, index) {
|
|
5558
|
+
return /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
5559
|
+
key: index,
|
|
5560
|
+
value: index
|
|
5561
|
+
}, mod);
|
|
5562
|
+
})));
|
|
5563
|
+
}
|
|
5564
|
+
});
|
|
5565
|
+
})), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
5566
|
+
fullWidth: true,
|
|
5567
|
+
variant: tier.buttonVariant,
|
|
5568
|
+
endIcon: /*#__PURE__*/_react["default"].createElement(_ChevronRightRounded["default"], null),
|
|
5569
|
+
sx: {
|
|
5570
|
+
height: 50
|
|
5571
|
+
},
|
|
5572
|
+
onClick: handleSubmit( /*#__PURE__*/function () {
|
|
5573
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
|
|
5574
|
+
var modifiers, qty, index, modifier;
|
|
5575
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5576
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5577
|
+
case 0:
|
|
5578
|
+
modifiers = {};
|
|
5579
|
+
qty = null;
|
|
5580
|
+
if (tier.modifiers != null) {
|
|
5581
|
+
for (index = 0; index < tier.modifiers.length; index++) {
|
|
5582
|
+
modifier = tier.modifiers[index]; // assign the modifier as a property
|
|
5583
|
+
modifiers[modifier.name] = data["modifier-" + tier.id + "-" + modifier.name];
|
|
5584
|
+
}
|
|
5585
|
+
}
|
|
5586
|
+
if (tier.qty != null) {
|
|
5587
|
+
qty = parseInt(data["qty-" + tier.id]);
|
|
5588
|
+
}
|
|
5589
|
+
if (onButtonClicked != null) {
|
|
5590
|
+
onButtonClicked({
|
|
5591
|
+
id: tier.id,
|
|
5592
|
+
modifiers: modifiers,
|
|
5593
|
+
qty: qty
|
|
5594
|
+
});
|
|
5595
|
+
}
|
|
5596
|
+
case 5:
|
|
5597
|
+
case "end":
|
|
5598
|
+
return _context.stop();
|
|
5599
|
+
}
|
|
5600
|
+
}, _callee);
|
|
5601
|
+
}));
|
|
5602
|
+
return function (_x) {
|
|
5603
|
+
return _ref4.apply(this, arguments);
|
|
5604
|
+
};
|
|
5605
|
+
}())
|
|
5606
|
+
}, tier.buttonText), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
5607
|
+
variant: "body2",
|
|
5608
|
+
sx: {
|
|
5609
|
+
paddingTop: 2,
|
|
5610
|
+
fontSize: 16,
|
|
5611
|
+
textAlign: "left",
|
|
5612
|
+
lineHeight: "1.5rem"
|
|
5613
|
+
}
|
|
5614
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
5615
|
+
dangerouslySetInnerHTML: {
|
|
5616
|
+
__html: tier.description
|
|
5617
|
+
}
|
|
5618
|
+
})))));
|
|
5619
|
+
})), features != null && /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5620
|
+
sx: {
|
|
5621
|
+
paddingTop: 1
|
|
5622
|
+
}
|
|
5623
|
+
}, features.map(function (feature) {
|
|
5624
|
+
return /*#__PURE__*/_react["default"].createElement(_system.Box, null, /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5625
|
+
sx: {
|
|
5626
|
+
backgroundColor: "lightgray",
|
|
5627
|
+
padding: 1,
|
|
5628
|
+
borderRadius: 2
|
|
5629
|
+
}
|
|
5630
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
5631
|
+
variant: "h5",
|
|
5632
|
+
gutterBottom: true
|
|
5633
|
+
}, feature.name)), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5634
|
+
container: true,
|
|
5635
|
+
spacing: 0,
|
|
5636
|
+
justifyContent: "center"
|
|
5637
|
+
}, feature.subfeatures.map(function (subfeature, subFeatureIndex) {
|
|
5638
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, subfeature.map(function (item, index) {
|
|
5639
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
5640
|
+
item: true,
|
|
5641
|
+
xs: 3,
|
|
5642
|
+
key: subfeature
|
|
5643
|
+
}, /*#__PURE__*/_react["default"].createElement(_system.Box, {
|
|
5644
|
+
sx: {
|
|
5645
|
+
padding: 2,
|
|
5646
|
+
height: 60,
|
|
5647
|
+
paddingTop: subFeatureIndex == 0 ? 3 : 2,
|
|
5648
|
+
textAlign: index == 0 ? "left" : "center"
|
|
5649
|
+
}
|
|
5650
|
+
}, item), feature.subfeatures.length - 1 != subFeatureIndex ? /*#__PURE__*/_react["default"].createElement("hr", null) : "");
|
|
5651
|
+
}));
|
|
5652
|
+
})));
|
|
5653
|
+
}))));
|
|
5654
|
+
}
|
|
5655
|
+
"use strict";
|
|
5656
|
+
|
|
5381
5657
|
Object.defineProperty(exports, "__esModule", {
|
|
5382
5658
|
value: true
|
|
5383
5659
|
});
|
|
@@ -5661,6 +5937,9 @@ var SpreadsheetViewer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
5661
5937
|
case "time":
|
|
5662
5938
|
rows[rowIndex].cells[cellIndex].text = Date.parse(request.value);
|
|
5663
5939
|
break;
|
|
5940
|
+
case "image":
|
|
5941
|
+
rows[rowIndex].cells[cellIndex].url = request.value;
|
|
5942
|
+
break;
|
|
5664
5943
|
}
|
|
5665
5944
|
}
|
|
5666
5945
|
}
|
|
@@ -6057,6 +6336,17 @@ var SpreadsheetViewer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
|
6057
6336
|
console.error(exp);
|
|
6058
6337
|
}
|
|
6059
6338
|
}
|
|
6339
|
+
} else if (cellItem.type == "image") {
|
|
6340
|
+
JSONBuilder[cellItem.columnId] = cellItem.url;
|
|
6341
|
+
cellItem.url = change.newCell.url;
|
|
6342
|
+
if (onChange != null) {
|
|
6343
|
+
onChange(rowBuilder, dataRowId, fieldName, change.newCell.url);
|
|
6344
|
+
}
|
|
6345
|
+
try {
|
|
6346
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.url.toString());
|
|
6347
|
+
} catch (exp) {
|
|
6348
|
+
console.error(exp);
|
|
6349
|
+
}
|
|
6060
6350
|
}
|
|
6061
6351
|
});
|
|
6062
6352
|
return _toConsumableArray(prevDetails);
|
package/package.json
CHANGED
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import React, {useEffect, useState} from 'react';
|
|
2
|
+
import { Box } from '@mui/system';
|
|
3
|
+
import { Grid, Button, Typography, duration } from '@mui/material';
|
|
4
|
+
import ChevronRightRoundedIcon from '@mui/icons-material/ChevronRightRounded';
|
|
5
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
6
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
7
|
+
import FormControl from '@mui/material/FormControl';
|
|
8
|
+
import Select from '@mui/material/Select';
|
|
9
|
+
import { useForm, Controller } from 'react-hook-form';
|
|
10
|
+
|
|
11
|
+
export function Pricing({title = null, tiers = [], features = null, onButtonClicked = null}) {
|
|
12
|
+
|
|
13
|
+
const {control, register, handleSubmit, formState: { errors }, watch, setValue } = useForm();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const calculateQty = (qty) => {
|
|
17
|
+
|
|
18
|
+
let newMax = qty.minQty + qty.maxQty;
|
|
19
|
+
|
|
20
|
+
let menuItemArray = [];
|
|
21
|
+
let newIndex = 1;
|
|
22
|
+
for (let index = qty.minQty; index < newMax; index++) {
|
|
23
|
+
menuItemArray[newIndex] = newIndex;
|
|
24
|
+
newIndex++;
|
|
25
|
+
}
|
|
26
|
+
return menuItemArray;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box sx={{paddingTop:2}}>
|
|
31
|
+
<form >
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<Grid container spacing={0} justifyContent="center" alignItems="stretch" direction="row">
|
|
37
|
+
|
|
38
|
+
{title != null &&
|
|
39
|
+
<Grid item xs={12} sm={6} md={3} key={"plans"}>
|
|
40
|
+
<Typography variant="h4" gutterBottom>
|
|
41
|
+
{title}
|
|
42
|
+
</Typography>
|
|
43
|
+
</Grid>
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
{tiers.map((tier) => (
|
|
47
|
+
<Grid item xs={12} sm={6} md={3} key={tier.title}>
|
|
48
|
+
<Box sx={{paddingBottom:2, padding:2}}>
|
|
49
|
+
<Box sx={{textAlign:"center", paddingTop:2}}>
|
|
50
|
+
{tier.image != null &&
|
|
51
|
+
<img src={tier.image} width={200} height={200} />
|
|
52
|
+
}
|
|
53
|
+
<Typography variant="h3" component="h2" sx={{paddingTop:3}}>
|
|
54
|
+
{tier.title}
|
|
55
|
+
</Typography>
|
|
56
|
+
{tier.subTitle &&
|
|
57
|
+
<Typography variant="h6" component="h2" sx={{paddingTop:2}}>
|
|
58
|
+
{tier.subTitle}
|
|
59
|
+
</Typography>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
<Grid container spacing={0}>
|
|
63
|
+
<Grid item xs={tier.qty != null ? 6 : 12} sx={{padding: 4}}>
|
|
64
|
+
<Box component={"span"} sx={{fontSize:30, fontWeight:"bold"}}>
|
|
65
|
+
${tier.price}
|
|
66
|
+
</Box>
|
|
67
|
+
{tier.duration != null &&
|
|
68
|
+
<Box component={"span"}>
|
|
69
|
+
/ {tier.duration}
|
|
70
|
+
</Box>
|
|
71
|
+
}
|
|
72
|
+
</Grid>
|
|
73
|
+
|
|
74
|
+
{tier.qty != null &&
|
|
75
|
+
<Grid item xs={6} sx={{padding: 4}}>
|
|
76
|
+
<Controller name={"qty-" + tier.id}
|
|
77
|
+
control={control}
|
|
78
|
+
rules={{
|
|
79
|
+
required: false,
|
|
80
|
+
}}
|
|
81
|
+
render={({renderField}) =>
|
|
82
|
+
<FormControl fullWidth>
|
|
83
|
+
<InputLabel id="demo-simple-select-label">{"Quantity"}</InputLabel>
|
|
84
|
+
<Select
|
|
85
|
+
{...register("qty-" + tier.id, { required: false })}
|
|
86
|
+
{...renderField}
|
|
87
|
+
labelId="demo-simple-select-label"
|
|
88
|
+
id="demo-simple-select"
|
|
89
|
+
defaultValue={1}
|
|
90
|
+
label={"Quantity"}>
|
|
91
|
+
|
|
92
|
+
{calculateQty(tier.qty).map((menuItem, index) => {
|
|
93
|
+
return (
|
|
94
|
+
<MenuItem key={index} value={menuItem}>{menuItem}</MenuItem>
|
|
95
|
+
)
|
|
96
|
+
})}
|
|
97
|
+
|
|
98
|
+
</Select>
|
|
99
|
+
</FormControl>
|
|
100
|
+
} />
|
|
101
|
+
</Grid>
|
|
102
|
+
}
|
|
103
|
+
</Grid>
|
|
104
|
+
|
|
105
|
+
{tier.modifiers != null &&
|
|
106
|
+
<Box sx={{paddingBottom:2}}>
|
|
107
|
+
{tier.modifiers.map((modifier, index) => {
|
|
108
|
+
return (
|
|
109
|
+
<Controller name={"modifier-" + tier.id + modifier.name}
|
|
110
|
+
control={control}
|
|
111
|
+
rules={{
|
|
112
|
+
required: false,
|
|
113
|
+
}}
|
|
114
|
+
render={({renderField}) =>
|
|
115
|
+
<FormControl fullWidth key={index} sx={{marginTop: 2}}>
|
|
116
|
+
<InputLabel id="demo-simple-select-label">{modifier.name}</InputLabel>
|
|
117
|
+
<Select
|
|
118
|
+
{...register("modifier-" + tier.id + "-" + modifier.name, { required: false })}
|
|
119
|
+
{...renderField}
|
|
120
|
+
labelId="demo-simple-select-label"
|
|
121
|
+
id="demo-simple-select"
|
|
122
|
+
defaultValue={0}
|
|
123
|
+
label={modifier.name}>
|
|
124
|
+
|
|
125
|
+
{modifier.options.map((mod, index) => {
|
|
126
|
+
return <MenuItem key={index} value={index}>{mod}</MenuItem>
|
|
127
|
+
})}
|
|
128
|
+
|
|
129
|
+
</Select>
|
|
130
|
+
</FormControl>
|
|
131
|
+
} />
|
|
132
|
+
)
|
|
133
|
+
})}
|
|
134
|
+
</Box>
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
<Button fullWidth variant={tier.buttonVariant} endIcon={<ChevronRightRoundedIcon/>} sx={{height:50}} onClick={handleSubmit(async (data) => {
|
|
138
|
+
|
|
139
|
+
let modifiers = {};
|
|
140
|
+
let qty = null;
|
|
141
|
+
if (tier.modifiers != null)
|
|
142
|
+
{
|
|
143
|
+
for (let index = 0; index < tier.modifiers.length; index++) {
|
|
144
|
+
const modifier = tier.modifiers[index];
|
|
145
|
+
|
|
146
|
+
// assign the modifier as a property
|
|
147
|
+
modifiers[modifier.name] = data["modifier-" + tier.id + "-" + modifier.name];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (tier.qty != null)
|
|
152
|
+
{
|
|
153
|
+
qty = parseInt(data["qty-" + tier.id]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (onButtonClicked != null)
|
|
157
|
+
{
|
|
158
|
+
onButtonClicked({
|
|
159
|
+
id: tier.id,
|
|
160
|
+
modifiers: modifiers,
|
|
161
|
+
qty: qty
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
})}>
|
|
166
|
+
{tier.buttonText}
|
|
167
|
+
</Button>
|
|
168
|
+
|
|
169
|
+
<Typography variant="body2" sx={{paddingTop:2, fontSize:16, textAlign:"left", lineHeight:"1.5rem"}}>
|
|
170
|
+
|
|
171
|
+
<div
|
|
172
|
+
dangerouslySetInnerHTML={{__html: tier.description}}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
</Typography>
|
|
176
|
+
|
|
177
|
+
</Box>
|
|
178
|
+
|
|
179
|
+
</Box>
|
|
180
|
+
</Grid>
|
|
181
|
+
))}
|
|
182
|
+
</Grid>
|
|
183
|
+
|
|
184
|
+
{features != null &&
|
|
185
|
+
<Box sx={{paddingTop:1}}>
|
|
186
|
+
|
|
187
|
+
{features.map(feature => {
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<Box>
|
|
191
|
+
<Box sx={{backgroundColor:"lightgray", padding:1, borderRadius:2}}>
|
|
192
|
+
<Typography variant="h5" gutterBottom>
|
|
193
|
+
{feature.name}
|
|
194
|
+
</Typography>
|
|
195
|
+
</Box>
|
|
196
|
+
<Grid container spacing={0} justifyContent="center">
|
|
197
|
+
{feature.subfeatures.map((subfeature, subFeatureIndex) => {
|
|
198
|
+
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
{subfeature.map((item, index) => {
|
|
202
|
+
return (
|
|
203
|
+
<Grid item xs={3} key={subfeature}>
|
|
204
|
+
<Box sx={{padding:2, height:60, paddingTop: (subFeatureIndex == 0 ? 3 : 2), textAlign: (index == 0 ? "left" : "center")}}>
|
|
205
|
+
{item}
|
|
206
|
+
</Box>
|
|
207
|
+
|
|
208
|
+
{feature.subfeatures.length - 1 != subFeatureIndex ? <hr/> : ""}
|
|
209
|
+
|
|
210
|
+
</Grid>
|
|
211
|
+
)
|
|
212
|
+
})}
|
|
213
|
+
|
|
214
|
+
</>
|
|
215
|
+
)
|
|
216
|
+
})}
|
|
217
|
+
|
|
218
|
+
</Grid>
|
|
219
|
+
</Box>
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
})}
|
|
223
|
+
</Box>
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
</form>
|
|
227
|
+
</Box>
|
|
228
|
+
)
|
|
229
|
+
}
|
|
@@ -122,6 +122,9 @@ export const SpreadsheetViewer = forwardRef(({loadedUser, currentUser, documentI
|
|
|
122
122
|
case "time":
|
|
123
123
|
rows[rowIndex].cells[cellIndex].text = Date.parse(request.value);
|
|
124
124
|
break;
|
|
125
|
+
case "image":
|
|
126
|
+
rows[rowIndex].cells[cellIndex].url = request.value;
|
|
127
|
+
break;
|
|
125
128
|
}
|
|
126
129
|
}
|
|
127
130
|
}
|
|
@@ -602,6 +605,25 @@ export const SpreadsheetViewer = forwardRef(({loadedUser, currentUser, documentI
|
|
|
602
605
|
}
|
|
603
606
|
}
|
|
604
607
|
}
|
|
608
|
+
else if (cellItem.type == "image")
|
|
609
|
+
{
|
|
610
|
+
JSONBuilder[cellItem.columnId] = cellItem.url;
|
|
611
|
+
cellItem.url = change.newCell.url;
|
|
612
|
+
|
|
613
|
+
if (onChange != null)
|
|
614
|
+
{
|
|
615
|
+
onChange(rowBuilder, dataRowId, fieldName, change.newCell.url);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
try
|
|
619
|
+
{
|
|
620
|
+
hubConnection.invoke("CellChanged", documentId, userIdRef.current, dataRowId, fieldName, change.newCell.url.toString());
|
|
621
|
+
}
|
|
622
|
+
catch(exp)
|
|
623
|
+
{
|
|
624
|
+
console.error(exp);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
605
627
|
});
|
|
606
628
|
|
|
607
629
|
return [...prevDetails];
|