tf-checkout-react 1.4.19 → 1.4.20

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.
@@ -75,7 +75,6 @@ var TableRow = _interopDefault(require('@mui/material/TableRow'));
75
75
  var _has = _interopDefault(require('lodash/has'));
76
76
  var _isNull = _interopDefault(require('lodash/isNull'));
77
77
  var _reverse = _interopDefault(require('lodash/reverse'));
78
- var lodash = require('lodash');
79
78
  var _keys = _interopDefault(require('lodash/keys'));
80
79
  var _values = _interopDefault(require('lodash/values'));
81
80
  var moment$1 = _interopDefault(require('moment'));
@@ -927,6 +926,18 @@ var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
927
926
  });
928
927
  return res;
929
928
  };
929
+ var createPaymentPlan = function createPaymentPlan(orderHash, stripePaymentMethodId) {
930
+ var res = publicRequest.post("v1/order/" + orderHash + "/payment_plan/create", {
931
+ stripe_payment_method_id: stripePaymentMethodId
932
+ }, {
933
+ headers: {
934
+ 'Referer-Url': isDocumentDefined ? document.referrer : ''
935
+ }
936
+ })["catch"](function (error) {
937
+ throw error;
938
+ });
939
+ return res;
940
+ };
930
941
  var handleFreeSuccess = function handleFreeSuccess(orderHash) {
931
942
  var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration", undefined, {
932
943
  headers: {
@@ -3864,11 +3875,13 @@ var CheckoutForm = function CheckoutForm(_ref) {
3864
3875
  _ref$isLoading = _ref.isLoading,
3865
3876
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
3866
3877
  _ref$handleSetLoading = _ref.handleSetLoading,
3867
- handleSetLoading = _ref$handleSetLoading === void 0 ? function () {} : _ref$handleSetLoading,
3878
+ handleSetLoading = _ref$handleSetLoading === void 0 ? _identity : _ref$handleSetLoading,
3868
3879
  _ref$conditions = _ref.conditions,
3869
3880
  conditions = _ref$conditions === void 0 ? [] : _ref$conditions,
3870
3881
  disableZipSection = _ref.disableZipSection,
3871
- paymentButtonText = _ref.paymentButtonText;
3882
+ paymentButtonText = _ref.paymentButtonText,
3883
+ _ref$forPaymentPlan = _ref.forPaymentPlan,
3884
+ forPaymentPlan = _ref$forPaymentPlan === void 0 ? false : _ref$forPaymentPlan;
3872
3885
  var stripe = reactStripeJs.useStripe();
3873
3886
  var elements = reactStripeJs.useElements();
3874
3887
  var _useState = React.useState(''),
@@ -3885,7 +3898,7 @@ var CheckoutForm = function CheckoutForm(_ref) {
3885
3898
  setAllowSubmit = _useState4[1];
3886
3899
  var handleSubmit = /*#__PURE__*/function () {
3887
3900
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
3888
- var card, address, paymentMethodReq, _yield$stripe$confirm, _error;
3901
+ var card, address, _setupResponse$setupI, setupResponse, paymentMethodReq, _yield$stripe$confirm, _error;
3889
3902
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3890
3903
  while (1) switch (_context.prev = _context.next) {
3891
3904
  case 0:
@@ -3918,7 +3931,26 @@ var CheckoutForm = function CheckoutForm(_ref) {
3918
3931
  if (!disableZipSection) {
3919
3932
  address.postal_code = postalCode;
3920
3933
  }
3921
- _context.next = 15;
3934
+ if (!forPaymentPlan) {
3935
+ _context.next = 19;
3936
+ break;
3937
+ }
3938
+ _context.next = 16;
3939
+ return stripe.confirmCardSetup(stripe_client_secret, {
3940
+ payment_method: {
3941
+ card: card || {
3942
+ token: ''
3943
+ }
3944
+ }
3945
+ });
3946
+ case 16:
3947
+ setupResponse = _context.sent;
3948
+ onSubmit(null, {
3949
+ paymentMethodId: (_setupResponse$setupI = setupResponse.setupIntent) == null ? void 0 : _setupResponse$setupI.payment_method
3950
+ });
3951
+ return _context.abrupt("return");
3952
+ case 19:
3953
+ _context.next = 21;
3922
3954
  return stripe.createPaymentMethod({
3923
3955
  type: 'card',
3924
3956
  card: card || {
@@ -3928,44 +3960,44 @@ var CheckoutForm = function CheckoutForm(_ref) {
3928
3960
  address: address
3929
3961
  }
3930
3962
  });
3931
- case 15:
3963
+ case 21:
3932
3964
  paymentMethodReq = _context.sent;
3933
3965
  if (!paymentMethodReq.error) {
3934
- _context.next = 20;
3966
+ _context.next = 26;
3935
3967
  break;
3936
3968
  }
3937
3969
  setStripeError(paymentMethodReq.error.message || null);
3938
3970
  handleSetLoading(false);
3939
3971
  return _context.abrupt("return");
3940
- case 20:
3972
+ case 26:
3941
3973
  handleSetLoading(true);
3942
- _context.next = 23;
3974
+ _context.next = 29;
3943
3975
  return stripe.confirmCardPayment(stripe_client_secret, {
3944
3976
  payment_method: paymentMethodReq.paymentMethod.id
3945
3977
  });
3946
- case 23:
3978
+ case 29:
3947
3979
  _yield$stripe$confirm = _context.sent;
3948
3980
  _error = _yield$stripe$confirm.error;
3949
3981
  if (!_error) {
3950
- _context.next = 29;
3982
+ _context.next = 35;
3951
3983
  break;
3952
3984
  }
3953
3985
  setStripeError(_error.message);
3954
3986
  handleSetLoading(false);
3955
3987
  return _context.abrupt("return");
3956
- case 29:
3988
+ case 35:
3957
3989
  onSubmit(null);
3958
- _context.next = 35;
3990
+ _context.next = 41;
3959
3991
  break;
3960
- case 32:
3961
- _context.prev = 32;
3992
+ case 38:
3993
+ _context.prev = 38;
3962
3994
  _context.t0 = _context["catch"](1);
3963
3995
  onSubmit(_context.t0);
3964
- case 35:
3996
+ case 41:
3965
3997
  case "end":
3966
3998
  return _context.stop();
3967
3999
  }
3968
- }, _callee, null, [[1, 32]]);
4000
+ }, _callee, null, [[1, 38]]);
3969
4001
  }));
3970
4002
  return function handleSubmit(_x) {
3971
4003
  return _ref2.apply(this, arguments);
@@ -4068,7 +4100,63 @@ var CheckoutForm = function CheckoutForm(_ref) {
4068
4100
  type: "submit"
4069
4101
  }, isLoading ? React__default.createElement(CircularProgress, {
4070
4102
  size: 26
4071
- }) : (paymentButtonText ? paymentButtonText : 'Pay') + " " + getCurrencySymbolByCurrency(currency) + total))));
4103
+ }) : forPaymentPlan ? 'Confirm Payment Plan' : (paymentButtonText ? paymentButtonText : 'Pay') + " " + getCurrencySymbolByCurrency(currency) + total))));
4104
+ };
4105
+
4106
+ var PaymentPlanSection = function PaymentPlanSection(props) {
4107
+ var _paymentPlanConfig$sa;
4108
+ var paymentPlanConfig = props.paymentPlanConfig,
4109
+ currency = props.currency,
4110
+ paymentPlanUseSavedCard = props.paymentPlanUseSavedCard,
4111
+ setPaymentPlanUseSavedCard = props.setPaymentPlanUseSavedCard;
4112
+ return React__default.createElement("div", {
4113
+ className: "payment_plan"
4114
+ }, React__default.createElement("h2", {
4115
+ className: "payment_plan_title"
4116
+ }, "Payment Plan Terms"), React__default.createElement("div", {
4117
+ className: "payment_plan_block"
4118
+ }, React__default.createElement("div", {
4119
+ className: "payment_plan_text"
4120
+ }, "By clicking on the \u201CConfirm Payment Plan\u201D button, you are starting your payment plan of", ' ', React__default.createElement("span", {
4121
+ className: "payment_plan_highlight"
4122
+ }, paymentPlanConfig.total_installments), ' ', "payments of", ' ', React__default.createElement("span", {
4123
+ className: "payment_plan_highlight"
4124
+ }, currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.price_per_installment), currency)), ", which will be drawn from your account every ", paymentPlanConfig.interval, " days, with the first payment taken later today."), paymentPlanConfig.has_admin_fee && React__default.createElement("div", {
4125
+ className: "payment_plan_text"
4126
+ }, "This includes a non-refundable admin fee of", ' ', React__default.createElement("span", {
4127
+ className: "payment_plan_highlight"
4128
+ }, currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.admin_fee), currency)), ' ', "per payment."), paymentPlanConfig.requires_deposit && React__default.createElement("div", {
4129
+ className: "payment_plan_text"
4130
+ }, "You will also be charged a single, non-refundable deposit of", ' ', React__default.createElement("span", {
4131
+ className: "payment_plan_highlight"
4132
+ }, currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.deposit), currency)), "."), React__default.createElement("div", {
4133
+ className: "payment_plan_text payment_plan_note payment_plan_highlight"
4134
+ }, "NOTE: If today\u2019s payment fails, your plan will not activate. Your tickets will not be issued until you complete your final payment."), !paymentPlanConfig.non_refundable_type && React__default.createElement("div", {
4135
+ className: "payment_plan_text"
4136
+ }, "If you do not complete your payments, your order will be canceled. Your", ' ', React__default.createElement("span", {
4137
+ className: "payment_plan_highlight"
4138
+ }, "first payment of", ' ', currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.price_per_installment), currency)), paymentPlanConfig.has_admin_fee && React__default.createElement(React__default.Fragment, null, ", plus the", ' ', React__default.createElement("span", {
4139
+ className: "payment_plan_highlight"
4140
+ }, "non-refundable admin-fee of", ' ', currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.admin_fee), currency))), ' ', "will not be refunded."), paymentPlanConfig.non_refundable_type === 'percent' && React__default.createElement("div", {
4141
+ className: "payment_plan_text"
4142
+ }, "If you do not complete your payments, you will receive", ' ', React__default.createElement("span", {
4143
+ className: "payment_plan_highlight"
4144
+ }, createFixedFloatNormalizer(0)(100 - paymentPlanConfig.non_refundable_amount), "%"), ' ', "of your money back", paymentPlanConfig.requires_deposit && React__default.createElement(React__default.Fragment, null, ", excluding your", ' ', currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.deposit), currency), ' ', "deposit"), "."), paymentPlanConfig.non_refundable_type === 'fixed' && React__default.createElement("div", {
4145
+ className: "payment_plan_text"
4146
+ }, "If you do not complete your payments, you will receive all your money back", paymentPlanConfig.non_refundable_amount && React__default.createElement(React__default.Fragment, null, "except for the non-refundable amount of", ' ', currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.non_refundable_amount), currency), paymentPlanConfig.requires_deposit && React__default.createElement(React__default.Fragment, null, ", excluding your", ' ', currencyNormalizerCreator(createFixedFloatNormalizer(2)(paymentPlanConfig.deposit), currency), ' ', "deposit")), "."), !!((_paymentPlanConfig$sa = paymentPlanConfig.saved_card) != null && _paymentPlanConfig$sa.stripe_payment_method_id) && React__default.createElement(React__default.Fragment, null, paymentPlanUseSavedCard && React__default.createElement("div", {
4147
+ className: "payment_plan_text"
4148
+ }, ' ', "Your payment will proceed with the card ending in ****", ' ', React__default.createElement("span", {
4149
+ className: "payment_plan_highlight"
4150
+ }, '' + paymentPlanConfig.saved_card.last_4_digits)), React__default.createElement("div", null, React__default.createElement(CheckboxField, {
4151
+ label: React__default.createElement("span", {
4152
+ className: 'payment_plan_toggle_label'
4153
+ }, "Use this card"),
4154
+ required: true,
4155
+ onChange: function onChange() {
4156
+ setPaymentPlanUseSavedCard(!paymentPlanUseSavedCard);
4157
+ },
4158
+ checked: paymentPlanUseSavedCard
4159
+ })))));
4072
4160
  };
4073
4161
 
4074
4162
  var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
@@ -4081,6 +4169,23 @@ var getStripePromise = function getStripePromise(reviewData) {
4081
4169
  }
4082
4170
  return stripeJs.loadStripe(stripePublishableKey, options);
4083
4171
  };
4172
+ var initialPaymentPlanConfiguration = {
4173
+ requires_deposit: false,
4174
+ deposit: 0,
4175
+ interval: 0,
4176
+ non_refundable_amount: 0,
4177
+ non_refundable_type: null,
4178
+ has_admin_fee: false,
4179
+ admin_fee: 0,
4180
+ total_installments: 0,
4181
+ price_per_installment: 0,
4182
+ stripe_setup_intent_secret: '',
4183
+ total: 0,
4184
+ saved_card: {
4185
+ last_4_digits: null,
4186
+ stripe_payment_method_id: null
4187
+ }
4188
+ };
4084
4189
  var initialOrderValues = {
4085
4190
  id: '',
4086
4191
  product_name: '',
@@ -4095,10 +4200,13 @@ var initialOrderValues = {
4095
4200
  };
4096
4201
  var initialReviewValues = {
4097
4202
  order_details: {
4203
+ id: '',
4098
4204
  order_hash: ''
4099
4205
  },
4100
4206
  payment_method: {
4101
- stripe_client_secret: ''
4207
+ stripe_client_secret: '',
4208
+ stripe_payment_plan_enabled: false,
4209
+ stripe_payment_plan_configuration: null
4102
4210
  },
4103
4211
  billing_info: {}
4104
4212
  };
@@ -4129,7 +4237,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4129
4237
  _ref$enableTimer = _ref.enableTimer,
4130
4238
  enableTimer = _ref$enableTimer === void 0 ? false : _ref$enableTimer,
4131
4239
  _ref$enablePaymentPla = _ref.enablePaymentPlan,
4132
- enablePaymentPlan = _ref$enablePaymentPla === void 0 ? false : _ref$enablePaymentPla,
4240
+ enablePaymentPlan = _ref$enablePaymentPla === void 0 ? true : _ref$enablePaymentPla,
4133
4241
  paymentButtonText = _ref.paymentButtonText,
4134
4242
  _ref$orderInfoLabel = _ref.orderInfoLabel,
4135
4243
  orderInfoLabel = _ref$orderInfoLabel === void 0 ? 'Order Review' : _ref$orderInfoLabel,
@@ -4156,6 +4264,18 @@ var PaymentContainer = function PaymentContainer(_ref) {
4156
4264
  var _useState7 = React.useState([]),
4157
4265
  conditions = _useState7[0],
4158
4266
  setConditions = _useState7[1];
4267
+ var _useState8 = React.useState(false),
4268
+ paymentPlanIsAvailable = _useState8[0],
4269
+ setPaymentPlanIsAvailable = _useState8[1];
4270
+ var _useState9 = React.useState(initialPaymentPlanConfiguration),
4271
+ paymentPlanConfig = _useState9[0],
4272
+ setPaymentPlanConfig = _useState9[1];
4273
+ var _useState10 = React.useState(true),
4274
+ paymentPlanUseSavedCard = _useState10[0],
4275
+ setPaymentPlanUseSavedCard = _useState10[1];
4276
+ var _useState11 = React.useState(''),
4277
+ currency = _useState11[0],
4278
+ setCurrency = _useState11[1];
4159
4279
  var showFormTitle = Boolean(formTitle);
4160
4280
  var showErrorText = Boolean(errorText);
4161
4281
  var eventId = getQueryVariable('event_id') || _get(reviewData, 'cart[0].product_id') || '';
@@ -4167,6 +4287,30 @@ var PaymentContainer = function PaymentContainer(_ref) {
4167
4287
  page: 'review',
4168
4288
  pageUrl: pageUrl
4169
4289
  });
4290
+ React.useEffect(function () {
4291
+ var paymentMethod = reviewData.payment_method || {};
4292
+ var paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled && enablePaymentPlan;
4293
+ setPaymentPlanIsAvailable(paymentPlanAvailable);
4294
+ if (paymentPlanAvailable) {
4295
+ var _paymentPlanConfig$sa;
4296
+ var _paymentPlanConfig = paymentMethod.stripe_payment_plan_configuration || initialPaymentPlanConfiguration;
4297
+ setPaymentPlanConfig(_paymentPlanConfig);
4298
+ setPaymentPlanUseSavedCard(!!((_paymentPlanConfig$sa = _paymentPlanConfig.saved_card) != null && _paymentPlanConfig$sa.stripe_payment_method_id));
4299
+ if (typeof window !== 'undefined') {
4300
+ var _reviewData$order_det;
4301
+ var sessionData = window.localStorage.getItem('paymentConfiguration');
4302
+ var session = sessionData ? JSON.parse(sessionData) : {};
4303
+ if (!!session && (session == null ? void 0 : session.orderId) == ((_reviewData$order_det = reviewData.order_details) == null ? void 0 : _reviewData$order_det.id)) {
4304
+ var _session$paymentPlanU, _session$showPaymentP;
4305
+ setPaymentPlanUseSavedCard((_session$paymentPlanU = session.paymentPlanUseSavedCard) != null ? _session$paymentPlanU : false);
4306
+ setShowPaymentPlanSection((_session$showPaymentP = session.showPaymentPlanSection) != null ? _session$showPaymentP : false);
4307
+ }
4308
+ }
4309
+ }
4310
+ }, [enablePaymentPlan, reviewData]);
4311
+ React.useEffect(function () {
4312
+ updateSessionInformation();
4313
+ }, [showPaymentPlanSection, paymentPlanUseSavedCard]);
4170
4314
  React.useEffect(function () {
4171
4315
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
4172
4316
  var response, _cart$2, attributes, cart, order_details, _order_details$ticket, ticket, orderDataArray, _orderData;
@@ -4209,6 +4353,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4209
4353
  tableTypes: orderDataArray
4210
4354
  };
4211
4355
  setOrderData(_orderData);
4356
+ setCurrency(order_details == null ? void 0 : order_details.currency);
4212
4357
  onGetPaymentDataSuccess(response.data);
4213
4358
  }
4214
4359
  _context.next = 11;
@@ -4270,7 +4415,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4270
4415
  // 2. handle payment ---> v1/order/${orderHash}/pay/
4271
4416
  // 3. redirect to confirmation page
4272
4417
  var handlePaymentMiddleWare = /*#__PURE__*/function () {
4273
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
4418
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error, data) {
4274
4419
  var order_hash, paymentSuccessResponse, isWindowDefined, _window;
4275
4420
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4276
4421
  while (1) switch (_context3.prev = _context3.next) {
@@ -4290,16 +4435,26 @@ var PaymentContainer = function PaymentContainer(_ref) {
4290
4435
  _context3.next = 7;
4291
4436
  return handleFreeSuccess(order_hash);
4292
4437
  case 7:
4293
- _context3.t0 = _context3.sent;
4294
- _context3.next = 13;
4438
+ paymentSuccessResponse = _context3.sent;
4439
+ _context3.next = 19;
4295
4440
  break;
4296
4441
  case 10:
4297
- _context3.next = 12;
4298
- return handlePaymentSuccess(order_hash);
4299
- case 12:
4300
- _context3.t0 = _context3.sent;
4442
+ if (!(paymentPlanIsAvailable && showPaymentPlanSection)) {
4443
+ _context3.next = 16;
4444
+ break;
4445
+ }
4446
+ _context3.next = 13;
4447
+ return createPaymentPlan(order_hash, _get(data, 'paymentMethodId', ''));
4301
4448
  case 13:
4302
- paymentSuccessResponse = _context3.t0;
4449
+ paymentSuccessResponse = _context3.sent;
4450
+ _context3.next = 19;
4451
+ break;
4452
+ case 16:
4453
+ _context3.next = 18;
4454
+ return handlePaymentSuccess(order_hash);
4455
+ case 18:
4456
+ paymentSuccessResponse = _context3.sent;
4457
+ case 19:
4303
4458
  if (paymentSuccessResponse.status === 200) {
4304
4459
  handlePayment(paymentSuccessResponse);
4305
4460
  setPaymentIsLoading(false);
@@ -4308,34 +4463,51 @@ var PaymentContainer = function PaymentContainer(_ref) {
4308
4463
  localStorage.removeItem("reservationStart-" + eventId);
4309
4464
  localStorage.removeItem('ownReservations');
4310
4465
  localStorage.removeItem('tierId');
4311
- isWindowDefined = typeof window !== "undefined";
4466
+ isWindowDefined = typeof window !== 'undefined';
4312
4467
  if (isWindowDefined) {
4313
4468
  (_window = window) == null ? void 0 : _window.dataLayer.push({
4314
- 'event': 'Purchase',
4315
- 'orderValue': orderData.total,
4316
- 'orderCurrency': orderData.currency,
4317
- 'orderId': orderData.id
4469
+ event: 'Purchase',
4470
+ orderValue: orderData.total,
4471
+ orderCurrency: orderData.currency,
4472
+ orderId: orderData.id
4318
4473
  });
4319
4474
  }
4320
4475
  }
4321
- _context3.next = 22;
4476
+ _context3.next = 27;
4322
4477
  break;
4323
- case 17:
4324
- _context3.prev = 17;
4325
- _context3.t1 = _context3["catch"](0);
4326
- setError(_get(_context3.t1, 'response.data.message'));
4327
- setPaymentIsLoading(false);
4328
- onPaymentError(_context3.t1.response);
4329
4478
  case 22:
4479
+ _context3.prev = 22;
4480
+ _context3.t0 = _context3["catch"](0);
4481
+ setError(_get(_context3.t0, 'response.data.message'));
4482
+ setPaymentIsLoading(false);
4483
+ onPaymentError(_context3.t0.response);
4484
+ case 27:
4330
4485
  case "end":
4331
4486
  return _context3.stop();
4332
4487
  }
4333
- }, _callee3, null, [[0, 17]]);
4488
+ }, _callee3, null, [[0, 22]]);
4334
4489
  }));
4335
- return function handlePaymentMiddleWare(_x) {
4490
+ return function handlePaymentMiddleWare(_x, _x2) {
4336
4491
  return _ref4.apply(this, arguments);
4337
4492
  };
4338
4493
  }();
4494
+ var showPaymentForm = function showPaymentForm() {
4495
+ var _paymentPlanConfig$sa2;
4496
+ var showPaymentForm = !isFreeTickets;
4497
+ if (paymentPlanIsAvailable && showPaymentPlanSection && !!((_paymentPlanConfig$sa2 = paymentPlanConfig.saved_card) != null && _paymentPlanConfig$sa2.stripe_payment_method_id)) {
4498
+ showPaymentForm = !paymentPlanUseSavedCard;
4499
+ }
4500
+ return showPaymentForm;
4501
+ };
4502
+ var updateSessionInformation = function updateSessionInformation() {
4503
+ if (typeof window !== 'undefined' && !!(orderData != null && orderData.id)) {
4504
+ window.localStorage.setItem('paymentConfiguration', JSON.stringify({
4505
+ paymentPlanUseSavedCard: paymentPlanUseSavedCard,
4506
+ showPaymentPlanSection: showPaymentPlanSection,
4507
+ orderId: orderData == null ? void 0 : orderData.id
4508
+ }));
4509
+ }
4510
+ };
4339
4511
  var themeMui = styles.createTheme(themeOptions);
4340
4512
  var hasTableTypes = Boolean(Number(orderData.guest_count));
4341
4513
  var paymentFieldsData = hasTableTypes ? [{
@@ -4392,12 +4564,14 @@ var PaymentContainer = function PaymentContainer(_ref) {
4392
4564
  className = _field$className === void 0 ? '' : _field$className,
4393
4565
  _field$normalizer = field.normalizer,
4394
4566
  normalizer = _field$normalizer === void 0 ? _identity : _field$normalizer;
4395
- var currency = orderData.currency;
4396
4567
  var value = orderData[id];
4397
4568
  var component = null;
4398
4569
  if (field.id === 'add_ons' && _isEmpty(value)) {
4399
4570
  return false;
4400
4571
  }
4572
+ if (field.id === 'total' && paymentPlanIsAvailable && showPaymentPlanSection) {
4573
+ value = '' + paymentPlanConfig.total;
4574
+ }
4401
4575
  if (field.id === 'tableTypes') {
4402
4576
  var valueArray = value;
4403
4577
  component = React__default.createElement("div", {
@@ -4453,29 +4627,23 @@ var PaymentContainer = function PaymentContainer(_ref) {
4453
4627
  className: "add-on-each"
4454
4628
  }, ' each'));
4455
4629
  })));
4456
- })), enablePaymentPlan && React__default.createElement("div", {
4630
+ })), !isFreeTickets && paymentPlanIsAvailable && React__default.createElement("div", {
4457
4631
  className: "payment_toggle"
4458
- }, React__default.createElement("label", {
4459
- htmlFor: "togBtn",
4460
- className: "switch"
4461
- }, React__default.createElement("input", {
4462
- type: "checkbox",
4463
- id: "togBtn",
4464
- disabled: true,
4465
- onChange: function onChange() {
4466
- return setShowPaymentPlanSection(!showPaymentPlanSection);
4467
- }
4468
- }), React__default.createElement("div", {
4469
- className: "slider round"
4470
- }), React__default.createElement("span", {
4471
- className: "tog_text"
4472
- }, "Click to checkout using Payment Plan"))), showPaymentPlanSection && React__default.createElement("div", {
4473
- className: "payment_plan"
4474
- }, React__default.createElement("h2", null, "PAYMENT PLAN"), React__default.createElement("div", {
4475
- className: "plan_block"
4476
- }, React__default.createElement("h3", null, "Mbrand Payment Plan Terms"), React__default.createElement("p", null, "By clicking on the \u201CConfirm Payment Plan\u201D button, you are starting your payment plan of 2 payments of $115.00, which will be drawn from your account every 2 weeks, with the first payment taken later today."), React__default.createElement("p", null, "This includes a non-refundable admin fee of $3.00 per payment."), React__default.createElement("p", {
4477
- className: "payment_note"
4478
- }, "NOTE: If today\u2019s payment fails, your payment plan will not activate, and your tickets will not be issued until you complete your final payment."), React__default.createElement("p", null, "If you do not complete your payements, your order will be canceled. Your first payment of $115.00, plus the non-refundable admin fee of $3.00 will not be refunded."), React__default.createElement("p", null, "Your payment will proceed with the card ending in **** 4242."))), !isFreeTickets ? React__default.createElement("div", {
4632
+ }, React__default.createElement(CheckboxField, {
4633
+ label: React__default.createElement("span", {
4634
+ className: 'payment_plan_toggle_label'
4635
+ }, "Click to checkout using Payment Plan"),
4636
+ required: true,
4637
+ onChange: function onChange(_) {
4638
+ setShowPaymentPlanSection(!showPaymentPlanSection);
4639
+ },
4640
+ checked: showPaymentPlanSection
4641
+ })), showPaymentPlanSection && React__default.createElement(PaymentPlanSection, {
4642
+ paymentPlanConfig: paymentPlanConfig,
4643
+ currency: currency,
4644
+ paymentPlanUseSavedCard: paymentPlanUseSavedCard,
4645
+ setPaymentPlanUseSavedCard: setPaymentPlanUseSavedCard
4646
+ }), showPaymentForm() ? React__default.createElement("div", {
4479
4647
  className: "payment_info"
4480
4648
  }, React__default.createElement("div", {
4481
4649
  className: "payment_info_label"
@@ -4485,7 +4653,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
4485
4653
  stripe: getStripePromise(reviewData),
4486
4654
  options: elementsOptions
4487
4655
  }, React__default.createElement(CheckoutForm, {
4488
- stripe_client_secret: _get(reviewData, 'payment_method.stripe_client_secret'),
4656
+ stripe_client_secret: paymentPlanIsAvailable && showPaymentPlanSection ? paymentPlanConfig.stripe_setup_intent_secret : _get(reviewData, 'payment_method.stripe_client_secret'),
4489
4657
  total: orderData.guest_count ? orderData.pay_now : orderData.total,
4490
4658
  onSubmit: handlePaymentMiddleWare,
4491
4659
  error: error,
@@ -4498,7 +4666,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
4498
4666
  conditions: conditions,
4499
4667
  stripeCardOptions: stripeCardOptions,
4500
4668
  disableZipSection: disableZipSection,
4501
- paymentButtonText: paymentButtonText
4669
+ paymentButtonText: paymentButtonText,
4670
+ forPaymentPlan: paymentPlanIsAvailable && showPaymentPlanSection
4502
4671
  })))) : React__default.createElement("div", {
4503
4672
  className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
4504
4673
  }, React__default.createElement("button", {
@@ -4506,11 +4675,18 @@ var PaymentContainer = function PaymentContainer(_ref) {
4506
4675
  type: "button",
4507
4676
  onClick: function onClick() {
4508
4677
  setPaymentIsLoading(true);
4509
- handlePaymentMiddleWare(null);
4678
+ var data;
4679
+ if (paymentPlanIsAvailable && showPaymentPlanSection && paymentPlanUseSavedCard) {
4680
+ var _paymentPlanConfig$sa3;
4681
+ data = {
4682
+ paymentMethodId: (_paymentPlanConfig$sa3 = paymentPlanConfig.saved_card) == null ? void 0 : _paymentPlanConfig$sa3.stripe_payment_method_id
4683
+ };
4684
+ }
4685
+ handlePaymentMiddleWare(null, data);
4510
4686
  }
4511
4687
  }, paymentIsLoading ? React__default.createElement(CircularProgress, {
4512
4688
  size: 26
4513
- }) : 'Complete Registration')))));
4689
+ }) : isFreeTickets ? 'Complete Registration' : 'Confirm Payment Plan')))));
4514
4690
  };
4515
4691
 
4516
4692
  var config = {
@@ -4776,7 +4952,13 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4776
4952
  _confirmationLabels$c2 = confirmationLabels.confirmationMain,
4777
4953
  confirmationMain = _confirmationLabels$c2 === void 0 ? 'Your tickets are available in My Tickets section' : _confirmationLabels$c2,
4778
4954
  _confirmationLabels$c3 = confirmationLabels.confirmationHelper,
4779
- confirmationHelper = _confirmationLabels$c3 === void 0 ? 'Please bring them with you to the event' : _confirmationLabels$c3;
4955
+ confirmationHelper = _confirmationLabels$c3 === void 0 ? 'Please bring them with you to the event' : _confirmationLabels$c3,
4956
+ _confirmationLabels$p = confirmationLabels.paymentPlanConfirmationTitle,
4957
+ paymentPlanConfirmationTitle = _confirmationLabels$p === void 0 ? 'Your Tickets are Confirmed!' : _confirmationLabels$p,
4958
+ _confirmationLabels$p2 = confirmationLabels.paymentPlanConfirmationMain,
4959
+ paymentPlanConfirmationMain = _confirmationLabels$p2 === void 0 ? 'Your payment plan is pending and we are trying to take your initial payment. If your initial payment does not complete, your payment plan will be cancelled.' : _confirmationLabels$p2,
4960
+ _confirmationLabels$p3 = confirmationLabels.paymentPlanConfirmationHelper,
4961
+ paymentPlanConfirmationHelper = _confirmationLabels$p3 === void 0 ? 'You will receive a confirmation with your tickets once your final payment has been made.' : _confirmationLabels$p3;
4780
4962
  var pageUrl = isBrowser ? window.location.href.split('?')[0] : '';
4781
4963
  usePixel(eventId, {
4782
4964
  page: 'complete',
@@ -4813,16 +4995,20 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4813
4995
  className: "header-product-text"
4814
4996
  }, React__default.createElement("p", {
4815
4997
  className: "title"
4816
- }, confirmationTitle), React__default.createElement("div", {
4998
+ }, data.is_payment_plan ? paymentPlanConfirmationTitle : confirmationTitle), React__default.createElement("div", {
4817
4999
  className: "share-message-section",
4818
5000
  dangerouslySetInnerHTML: data.custom_confirmation_page_text && data.custom_confirmation_page_text_full_replacement ? createMarkup(data.custom_confirmation_page_text) : undefined
4819
- }, data.custom_confirmation_page_text && data.custom_confirmation_page_text_full_replacement ? undefined : React__default.createElement(React__default.Fragment, null, data.attach_tickets ? React__default.createElement("span", {
5001
+ }, data.custom_confirmation_page_text && data.custom_confirmation_page_text_full_replacement ? undefined : React__default.createElement(React__default.Fragment, null, Boolean(data.is_payment_plan) && React__default.createElement(React__default.Fragment, null, React__default.createElement("span", {
5002
+ className: "main"
5003
+ }, paymentPlanConfirmationMain), React__default.createElement("span", {
5004
+ className: "helper"
5005
+ }, paymentPlanConfirmationHelper)), !data.is_payment_plan && React__default.createElement(React__default.Fragment, null, data.attach_tickets ? React__default.createElement("span", {
4820
5006
  className: "main"
4821
5007
  }, "Your tickets have been emailed to you") : React__default.createElement("span", {
4822
5008
  className: "main"
4823
5009
  }, confirmationMain), React__default.createElement("span", {
4824
5010
  className: "helper"
4825
- }, data.attach_tickets ? 'Please bring them with you to the event' : confirmationHelper))))), data.custom_confirmation_page_text && !data.custom_confirmation_page_text_full_replacement ? React__default.createElement("div", {
5011
+ }, data.attach_tickets ? 'Please bring them with you to the event' : confirmationHelper)))))), data.custom_confirmation_page_text && !data.custom_confirmation_page_text_full_replacement ? React__default.createElement("div", {
4826
5012
  className: "custom-confirmation-page-text",
4827
5013
  dangerouslySetInnerHTML: createMarkup(data.custom_confirmation_page_text)
4828
5014
  }) : null, data.disable_referral === false && isReferralEnabled && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
@@ -4901,7 +5087,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4901
5087
  className: "pricing-section_sublabel"
4902
5088
  }, pricing.subLabel)), React__default.createElement("div", {
4903
5089
  className: "pricing-section_price"
4904
- }, ' ', pricing.price));
5090
+ }, " ", pricing.price));
4905
5091
  }), showPricingNoteSection && React__default.createElement("div", {
4906
5092
  className: "note-pricing-section"
4907
5093
  }, "^ This is based on the most expensive ticket in your order."))))));
@@ -8235,26 +8421,32 @@ var SeatMapComponent = function SeatMapComponent(props) {
8235
8421
  ticketTypeTierRelations = _seatMapProps$ticketT === void 0 ? {} : _seatMapProps$ticketT,
8236
8422
  tierPrices = seatMapProps.tierPrices,
8237
8423
  isReserving = seatMapProps.isReserving,
8238
- predefinedSeats = seatMapProps.predefinedSeats;
8424
+ predefinedSeats = seatMapProps.predefinedSeats,
8425
+ isLoadingSeatMapData = seatMapProps.isLoadingSeatMapData;
8239
8426
  React.useEffect(function () {
8240
8427
  var parentElement = document.getElementById(mapContainerId || CONTAINER_DEFAULT_ID);
8241
8428
  // Temp solution
8242
8429
  window.tierPrices = tierPrices;
8243
- if (Boolean(parentElement)) {
8244
- var mapComponent = React__default.createElement(SeatMapView, {
8245
- disabled: isReserving,
8246
- loading: isReserving,
8247
- events: seatMapEvents,
8248
- isSelectionOn: false,
8249
- seatData: seatData,
8250
- statuses: statuses,
8251
- ticketTypeTireRelationsArray: getTierRelationsArray(ticketTypeTierRelations),
8252
- width: Math.min((parentElement == null ? void 0 : parentElement.clientWidth) || 800, 800),
8253
- height: Math.min((parentElement == null ? void 0 : parentElement.clientWidth) || 800, 800),
8254
- isBlockMap: seatMapType === 'block',
8255
- isTableMap: seatMapType === 'table',
8256
- predefinedSeats: predefinedSeats
8257
- });
8430
+ if (parentElement) {
8431
+ var mapComponent = null;
8432
+ if (!(seatData && statuses) || isLoadingSeatMapData) {
8433
+ mapComponent = React__default.createElement(Loader, null);
8434
+ } else {
8435
+ mapComponent = React__default.createElement(SeatMapView, {
8436
+ disabled: isReserving,
8437
+ loading: isReserving,
8438
+ events: seatMapEvents,
8439
+ isSelectionOn: false,
8440
+ seatData: seatData,
8441
+ statuses: statuses,
8442
+ ticketTypeTireRelationsArray: getTierRelationsArray(ticketTypeTierRelations),
8443
+ width: Math.min((parentElement == null ? void 0 : parentElement.clientWidth) || 800, 800),
8444
+ height: Math.min((parentElement == null ? void 0 : parentElement.clientWidth) || 800, 800),
8445
+ isBlockMap: seatMapType === 'block',
8446
+ isTableMap: seatMapType === 'table',
8447
+ predefinedSeats: predefinedSeats
8448
+ });
8449
+ }
8258
8450
  ReactDom.render(mapComponent, parentElement);
8259
8451
  }
8260
8452
  }, [isReserving, mapContainerId, seatData, seatMapEvents, seatMapType, tierPrices, statuses, ticketTypeTierRelations]);
@@ -8402,7 +8594,7 @@ var TicketsSection$1 = function TicketsSection(props) {
8402
8594
  }
8403
8595
  }, showDescription && React__default.createElement(Tooltip, {
8404
8596
  title: "View Ticket Info",
8405
- placement: 'left',
8597
+ placement: "left",
8406
8598
  arrow: true,
8407
8599
  componentsProps: {
8408
8600
  tooltip: {
@@ -8466,7 +8658,7 @@ var TicketsSection$1 = function TicketsSection(props) {
8466
8658
  }, option);
8467
8659
  }))))), selectedTicketsInfo[dropdownData.seatId] && React__default.createElement("div", {
8468
8660
  className: "ticket-description-content",
8469
- dangerouslySetInnerHTML: createMarkup(selectedTicketData.description || "")
8661
+ dangerouslySetInnerHTML: createMarkup(selectedTicketData.description || '')
8470
8662
  })));
8471
8663
  })), React__default.createElement("div", null, React__default.createElement(reactBootstrap.Button, {
8472
8664
  className: "book-button\n " + (bookButtonIsDisabled ? 'disabled' : '') + "\n " + (isButtonScrollable ? 'is-scrollable' : '') + "\n ",
@@ -8490,9 +8682,9 @@ var SeatMapContainer = function SeatMapContainer(props) {
8490
8682
  _props$timerMessage = props.timerMessage,
8491
8683
  timerMessage = _props$timerMessage === void 0 ? '' : _props$timerMessage,
8492
8684
  _props$onAddToCartSuc = props.onAddToCartSuccess,
8493
- onAddToCartSuccess = _props$onAddToCartSuc === void 0 ? lodash.identity : _props$onAddToCartSuc,
8685
+ onAddToCartSuccess = _props$onAddToCartSuc === void 0 ? _identity : _props$onAddToCartSuc,
8494
8686
  _props$onCountdownFin = props.onCountdownFinish,
8495
- onCountdownFinish = _props$onCountdownFin === void 0 ? lodash.identity : _props$onCountdownFin,
8687
+ onCountdownFinish = _props$onCountdownFin === void 0 ? _identity : _props$onCountdownFin,
8496
8688
  ticketDeleteButtonContent = props.ticketDeleteButtonContent,
8497
8689
  ticketInfoContent = props.ticketInfoContent;
8498
8690
  var _useState = React.useState({
@@ -8514,7 +8706,7 @@ var SeatMapContainer = function SeatMapContainer(props) {
8514
8706
  var _useState5 = React.useState(true),
8515
8707
  isLoadingSeatMapData = _useState5[0],
8516
8708
  setIsLoadingSeatMapData = _useState5[1];
8517
- var _useState6 = React.useState(true),
8709
+ var _useState6 = React.useState(false),
8518
8710
  isLoadingStatuses = _useState6[0],
8519
8711
  setIsLoadingStatuses = _useState6[1];
8520
8712
  var _useState7 = React.useState(false),
@@ -8601,10 +8793,14 @@ var SeatMapContainer = function SeatMapContainer(props) {
8601
8793
  });
8602
8794
  });
8603
8795
  localStorage.setItem('reservationData', JSON.stringify(reservationData));
8604
- setSeatMapStatuses(statusesResponse.data.attributes);
8605
- setReservedSeats(reservationData);
8796
+ if (!_isEqual(seatMapStatuses, statusesResponse.data.attributes)) {
8797
+ setSeatMapStatuses(statusesResponse.data.attributes);
8798
+ }
8799
+ if (!_isEqual(reservationData, reservedSeats)) {
8800
+ setReservedSeats(reservationData);
8801
+ }
8606
8802
  // automatically set ticket/table type if it's the only one
8607
- if (ticketTypeTierRelationsRef.current) {
8803
+ if (ticketTypeTierRelationsRef.current && !_isEqual(reservationData, reservedSeats)) {
8608
8804
  if (!isGuestCountsSet.current) {
8609
8805
  updateGuestCounts(reservationData);
8610
8806
  isGuestCountsSet.current = true;
@@ -8629,25 +8825,21 @@ var SeatMapContainer = function SeatMapContainer(props) {
8629
8825
  _context2.t0 = _context2["catch"](0);
8630
8826
  setError('Something went wrong');
8631
8827
  case 17:
8632
- _context2.prev = 17;
8633
- setIsLoadingStatuses(false);
8634
- return _context2.finish(17);
8635
- case 20:
8636
8828
  case "end":
8637
8829
  return _context2.stop();
8638
8830
  }
8639
- }, _callee2, null, [[0, 14, 17, 20]]);
8640
- })), [eventId]);
8831
+ }, _callee2, null, [[0, 14]]);
8832
+ })), [eventId, seatMapStatuses, reservedSeats]);
8641
8833
  var startTimer = React.useCallback(function (duration) {
8642
8834
  setShowTimer(true);
8643
8835
  if (!localStorage.getItem("reservationStart-" + eventId)) {
8644
8836
  localStorage.setItem("reservationStart-" + eventId, String(Date.now() + duration));
8645
8837
  }
8646
- }, []);
8838
+ }, [eventId]);
8647
8839
  var endTimer = React.useCallback(function () {
8648
8840
  localStorage.removeItem("reservationStart-" + eventId);
8649
8841
  setShowTimer(false);
8650
- }, []);
8842
+ }, [eventId]);
8651
8843
  var handleSeatReservation = /*#__PURE__*/function () {
8652
8844
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(eventId, tierId, seatId) {
8653
8845
  var reservationData, relations, _keys2, firstItem, _error$response, _error$response$data;
@@ -8675,7 +8867,9 @@ var SeatMapContainer = function SeatMapContainer(props) {
8675
8867
  case 15:
8676
8868
  _context3.prev = 15;
8677
8869
  _context3.t0 = _context3["catch"](1);
8678
- setError((_context3.t0 == null ? void 0 : (_error$response = _context3.t0.response) == null ? void 0 : (_error$response$data = _error$response.data) == null ? void 0 : _error$response$data.message) === 'Selected seat is not available' ? 'No more of this ticket type are available right now - they’re either sold out or in people’s shopping carts. Try refreshing the page!' : 'Something went wrong');
8870
+ setError((_context3.t0 == null ? void 0 : (_error$response = _context3.t0.response) == null ? void 0 : (_error$response$data = _error$response.data) == null ? void 0 : _error$response$data.message) === 'Selected seat is not available' ?
8871
+ // eslint-disable-next-line max-len
8872
+ 'No more of this ticket type are available right now - they’re either sold out or in people’s shopping carts. Try refreshing the page!' : 'Something went wrong');
8679
8873
  case 18:
8680
8874
  _context3.prev = 18;
8681
8875
  setIsReserving(false);
@@ -8837,23 +9031,28 @@ var SeatMapContainer = function SeatMapContainer(props) {
8837
9031
  while (1) switch (_context7.prev = _context7.next) {
8838
9032
  case 0:
8839
9033
  _context7.prev = 0;
8840
- _context7.next = 3;
9034
+ setIsLoadingStatuses(true);
9035
+ _context7.next = 4;
8841
9036
  return fetchSeatMapData();
8842
- case 3:
8843
- _context7.next = 5;
9037
+ case 4:
9038
+ _context7.next = 6;
8844
9039
  return fetchSeatMapReservations();
8845
- case 5:
8846
- _context7.next = 10;
9040
+ case 6:
9041
+ _context7.next = 11;
8847
9042
  break;
8848
- case 7:
8849
- _context7.prev = 7;
9043
+ case 8:
9044
+ _context7.prev = 8;
8850
9045
  _context7.t0 = _context7["catch"](0);
8851
9046
  setError('Something went wrong');
8852
- case 10:
9047
+ case 11:
9048
+ _context7.prev = 11;
9049
+ setIsLoadingStatuses(false);
9050
+ return _context7.finish(11);
9051
+ case 14:
8853
9052
  case "end":
8854
9053
  return _context7.stop();
8855
9054
  }
8856
- }, _callee7, null, [[0, 7]]);
9055
+ }, _callee7, null, [[0, 8, 11, 14]]);
8857
9056
  }));
8858
9057
  return function makeRequests() {
8859
9058
  return _ref7.apply(this, arguments);
@@ -8863,13 +9062,15 @@ var SeatMapContainer = function SeatMapContainer(props) {
8863
9062
  if (country) {
8864
9063
  localStorage.setItem('eventCountry', country);
8865
9064
  }
9065
+ }, [country, eventId, fetchSeatMapData]);
9066
+ React.useEffect(function () {
8866
9067
  var intervalId = setInterval(function () {
8867
9068
  fetchSeatMapReservations();
8868
9069
  }, 3000);
8869
9070
  return function () {
8870
9071
  clearInterval(intervalId);
8871
9072
  };
8872
- }, [fetchSeatMapData, fetchSeatMapReservations]);
9073
+ }, [fetchSeatMapReservations]);
8873
9074
  return React__default.createElement(React__default.Fragment, null, error && React__default.createElement(material.Alert, {
8874
9075
  severity: "error",
8875
9076
  onClose: function onClose() {
@@ -8916,7 +9117,7 @@ var SeatMapContainer = function SeatMapContainer(props) {
8916
9117
  tableMapEnabled: Boolean(tableMapEnabled),
8917
9118
  guestCounts: guestCounts,
8918
9119
  setGuestCounts: setGuestCounts
8919
- }), seatMapData.seatMap && seatMapStatuses && React__default.createElement(SeatMapComponent, {
9120
+ }), React__default.createElement(SeatMapComponent, {
8920
9121
  seatMapProps: {
8921
9122
  seatData: seatMapData.seatMap,
8922
9123
  statuses: seatMapStatuses,
@@ -8927,7 +9128,8 @@ var SeatMapContainer = function SeatMapContainer(props) {
8927
9128
  onSeatClick: onSeatClick
8928
9129
  },
8929
9130
  isReserving: isReserving,
8930
- predefinedSeats: seatMapData.predefinedSeats
9131
+ predefinedSeats: seatMapData.predefinedSeats,
9132
+ isLoadingSeatMapData: isLoadingSeatMapData
8931
9133
  },
8932
9134
  mapContainerId: mapContainerId
8933
9135
  }));