tf-checkout-react 1.6.6-beta.29 → 1.6.6-beta.30
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/dist/components/paymentContainer/OrderDetails.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +100 -89
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +100 -89
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +24 -12
- package/src/components/paymentContainer/OrderDetails.tsx +14 -9
- package/src/components/paymentContainer/index.tsx +11 -9
|
@@ -4,5 +4,5 @@ interface OrderDetailsProps {
|
|
|
4
4
|
paymentFieldsData: any[];
|
|
5
5
|
customMobileText?: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const OrderDetails: ({ orderData, paymentFieldsData, customMobileText }: OrderDetailsProps) => JSX.Element;
|
|
7
|
+
export declare const OrderDetails: ({ orderData, paymentFieldsData, customMobileText, }: OrderDetailsProps) => JSX.Element;
|
|
8
8
|
export {};
|
|
@@ -5619,6 +5619,76 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5619
5619
|
}
|
|
5620
5620
|
}, [showPaymentPlanSection, paymentPlanUseSavedCard, orderData == null ? void 0 : orderData.id]);
|
|
5621
5621
|
React.useEffect(function () {
|
|
5622
|
+
var fetchPaymentData = /*#__PURE__*/function () {
|
|
5623
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5624
|
+
var paymentDataResponse, _paymentDataResponse$, _cart$2, attributes, cart, order_details, _order_details$ticket, ticket, orderDataArray, _orderData;
|
|
5625
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5626
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5627
|
+
case 0:
|
|
5628
|
+
_context.prev = 0;
|
|
5629
|
+
_context.next = 3;
|
|
5630
|
+
return getPaymentData(hash);
|
|
5631
|
+
case 3:
|
|
5632
|
+
paymentDataResponse = _context.sent;
|
|
5633
|
+
if (paymentDataResponse.success) {
|
|
5634
|
+
attributes = paymentDataResponse == null ? void 0 : (_paymentDataResponse$ = paymentDataResponse.data) == null ? void 0 : _paymentDataResponse$.attributes;
|
|
5635
|
+
setReviewData(attributes);
|
|
5636
|
+
cart = attributes.cart, order_details = attributes.order_details;
|
|
5637
|
+
_order_details$ticket = order_details.tickets, ticket = _order_details$ticket[0];
|
|
5638
|
+
orderDataArray = _map(order_details.tickets, function (item) {
|
|
5639
|
+
var _cart$;
|
|
5640
|
+
return {
|
|
5641
|
+
product_name: (_cart$ = cart[0]) == null ? void 0 : _cart$.product_name,
|
|
5642
|
+
ticketType: item == null ? void 0 : item.name,
|
|
5643
|
+
quantity: item == null ? void 0 : item.guest_count,
|
|
5644
|
+
price: item == null ? void 0 : item.price,
|
|
5645
|
+
cost: item == null ? void 0 : item.cost,
|
|
5646
|
+
id: item.id,
|
|
5647
|
+
count: item == null ? void 0 : item.quantity
|
|
5648
|
+
};
|
|
5649
|
+
});
|
|
5650
|
+
_orderData = {
|
|
5651
|
+
id: order_details == null ? void 0 : order_details.id,
|
|
5652
|
+
product_name: (_cart$2 = cart[0]) == null ? void 0 : _cart$2.product_name,
|
|
5653
|
+
ticketType: ticket == null ? void 0 : ticket.name,
|
|
5654
|
+
quantity: ticket == null ? void 0 : ticket.quantity,
|
|
5655
|
+
price: ticket == null ? void 0 : ticket.price,
|
|
5656
|
+
total: order_details == null ? void 0 : order_details.total,
|
|
5657
|
+
currency: order_details == null ? void 0 : order_details.currency,
|
|
5658
|
+
add_ons: (order_details == null ? void 0 : order_details.add_ons) || [],
|
|
5659
|
+
pay_now: (order_details == null ? void 0 : order_details.pay_now) || '',
|
|
5660
|
+
guest_count: (order_details == null ? void 0 : order_details.guest_count) || '',
|
|
5661
|
+
debt: (order_details == null ? void 0 : order_details.debt) || null,
|
|
5662
|
+
tableTypes: orderDataArray,
|
|
5663
|
+
cost: ticket == null ? void 0 : ticket.cost,
|
|
5664
|
+
subtotal: order_details == null ? void 0 : order_details.subtotal,
|
|
5665
|
+
fees: order_details == null ? void 0 : order_details.fees
|
|
5666
|
+
};
|
|
5667
|
+
setOrderData(_orderData);
|
|
5668
|
+
setCurrency(order_details == null ? void 0 : order_details.currency);
|
|
5669
|
+
onGetPaymentDataSuccess(paymentDataResponse.data);
|
|
5670
|
+
}
|
|
5671
|
+
_context.next = 11;
|
|
5672
|
+
break;
|
|
5673
|
+
case 7:
|
|
5674
|
+
_context.prev = 7;
|
|
5675
|
+
_context.t0 = _context["catch"](0);
|
|
5676
|
+
setError(_get(_context.t0, 'response.data.message', null));
|
|
5677
|
+
onGetPaymentDataError(_context.t0.response);
|
|
5678
|
+
case 11:
|
|
5679
|
+
_context.prev = 11;
|
|
5680
|
+
setPaymentDataIsLoading(false);
|
|
5681
|
+
return _context.finish(11);
|
|
5682
|
+
case 14:
|
|
5683
|
+
case "end":
|
|
5684
|
+
return _context.stop();
|
|
5685
|
+
}
|
|
5686
|
+
}, _callee, null, [[0, 7, 11, 14]]);
|
|
5687
|
+
}));
|
|
5688
|
+
return function fetchPaymentData() {
|
|
5689
|
+
return _ref2.apply(this, arguments);
|
|
5690
|
+
};
|
|
5691
|
+
}();
|
|
5622
5692
|
if (isSinglePageCheckout) {
|
|
5623
5693
|
if (!(orderData != null && orderData.total)) {
|
|
5624
5694
|
setOrderData(function (current) {
|
|
@@ -5629,73 +5699,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5629
5699
|
});
|
|
5630
5700
|
setPaymentDataIsLoading(false);
|
|
5631
5701
|
}
|
|
5632
|
-
|
|
5702
|
+
fetchPaymentData();
|
|
5633
5703
|
}
|
|
5634
|
-
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
5635
|
-
var paymentDataResponse, _paymentDataResponse$, _cart$2, attributes, cart, order_details, _order_details$ticket, ticket, orderDataArray, _orderData;
|
|
5636
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5637
|
-
while (1) switch (_context.prev = _context.next) {
|
|
5638
|
-
case 0:
|
|
5639
|
-
_context.prev = 0;
|
|
5640
|
-
_context.next = 3;
|
|
5641
|
-
return getPaymentData(hash);
|
|
5642
|
-
case 3:
|
|
5643
|
-
paymentDataResponse = _context.sent;
|
|
5644
|
-
if (paymentDataResponse.success) {
|
|
5645
|
-
attributes = paymentDataResponse == null ? void 0 : (_paymentDataResponse$ = paymentDataResponse.data) == null ? void 0 : _paymentDataResponse$.attributes;
|
|
5646
|
-
setReviewData(attributes);
|
|
5647
|
-
cart = attributes.cart, order_details = attributes.order_details;
|
|
5648
|
-
_order_details$ticket = order_details.tickets, ticket = _order_details$ticket[0];
|
|
5649
|
-
orderDataArray = _map(order_details.tickets, function (item) {
|
|
5650
|
-
var _cart$;
|
|
5651
|
-
return {
|
|
5652
|
-
product_name: (_cart$ = cart[0]) == null ? void 0 : _cart$.product_name,
|
|
5653
|
-
ticketType: item == null ? void 0 : item.name,
|
|
5654
|
-
quantity: item == null ? void 0 : item.guest_count,
|
|
5655
|
-
price: item == null ? void 0 : item.price,
|
|
5656
|
-
cost: item == null ? void 0 : item.cost,
|
|
5657
|
-
id: item.id,
|
|
5658
|
-
count: item == null ? void 0 : item.quantity
|
|
5659
|
-
};
|
|
5660
|
-
});
|
|
5661
|
-
_orderData = {
|
|
5662
|
-
id: order_details == null ? void 0 : order_details.id,
|
|
5663
|
-
product_name: (_cart$2 = cart[0]) == null ? void 0 : _cart$2.product_name,
|
|
5664
|
-
ticketType: ticket == null ? void 0 : ticket.name,
|
|
5665
|
-
quantity: ticket == null ? void 0 : ticket.quantity,
|
|
5666
|
-
price: ticket == null ? void 0 : ticket.price,
|
|
5667
|
-
total: order_details == null ? void 0 : order_details.total,
|
|
5668
|
-
currency: order_details == null ? void 0 : order_details.currency,
|
|
5669
|
-
add_ons: (order_details == null ? void 0 : order_details.add_ons) || [],
|
|
5670
|
-
pay_now: (order_details == null ? void 0 : order_details.pay_now) || '',
|
|
5671
|
-
guest_count: (order_details == null ? void 0 : order_details.guest_count) || '',
|
|
5672
|
-
debt: (order_details == null ? void 0 : order_details.debt) || null,
|
|
5673
|
-
tableTypes: orderDataArray,
|
|
5674
|
-
cost: ticket == null ? void 0 : ticket.cost,
|
|
5675
|
-
subtotal: order_details == null ? void 0 : order_details.subtotal,
|
|
5676
|
-
fees: order_details == null ? void 0 : order_details.fees
|
|
5677
|
-
};
|
|
5678
|
-
setOrderData(_orderData);
|
|
5679
|
-
setCurrency(order_details == null ? void 0 : order_details.currency);
|
|
5680
|
-
onGetPaymentDataSuccess(paymentDataResponse.data);
|
|
5681
|
-
}
|
|
5682
|
-
_context.next = 11;
|
|
5683
|
-
break;
|
|
5684
|
-
case 7:
|
|
5685
|
-
_context.prev = 7;
|
|
5686
|
-
_context.t0 = _context["catch"](0);
|
|
5687
|
-
setError(_get(_context.t0, 'response.data.message', null));
|
|
5688
|
-
onGetPaymentDataError(_context.t0.response);
|
|
5689
|
-
case 11:
|
|
5690
|
-
_context.prev = 11;
|
|
5691
|
-
setPaymentDataIsLoading(false);
|
|
5692
|
-
return _context.finish(11);
|
|
5693
|
-
case 14:
|
|
5694
|
-
case "end":
|
|
5695
|
-
return _context.stop();
|
|
5696
|
-
}
|
|
5697
|
-
}, _callee, null, [[0, 7, 11, 14]]);
|
|
5698
|
-
}))();
|
|
5699
5704
|
}, [orderData, hash, isSinglePageCheckout, onGetPaymentDataError, onGetPaymentDataSuccess]);
|
|
5700
5705
|
//just once
|
|
5701
5706
|
React.useEffect(function () {
|
|
@@ -6641,7 +6646,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6641
6646
|
React.useEffect(function () {
|
|
6642
6647
|
var fetchCheckoutUpdate = /*#__PURE__*/function () {
|
|
6643
6648
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
6644
|
-
var checkoutUpdateResponse;
|
|
6649
|
+
var checkoutUpdateResponse, checkoutAttributes;
|
|
6645
6650
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6646
6651
|
while (1) switch (_context5.prev = _context5.next) {
|
|
6647
6652
|
case 0:
|
|
@@ -6661,7 +6666,8 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6661
6666
|
case 5:
|
|
6662
6667
|
checkoutUpdateResponse = _context5.sent;
|
|
6663
6668
|
if (checkoutUpdateResponse.success) {
|
|
6664
|
-
|
|
6669
|
+
checkoutAttributes = checkoutUpdateResponse.data.attributes;
|
|
6670
|
+
setCheckoutUpdateData(checkoutAttributes);
|
|
6665
6671
|
}
|
|
6666
6672
|
_context5.next = 12;
|
|
6667
6673
|
break;
|
|
@@ -6792,7 +6798,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6792
6798
|
}, []);
|
|
6793
6799
|
var updateCheckoutWithAddOns = React.useCallback( /*#__PURE__*/function () {
|
|
6794
6800
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(addOns) {
|
|
6795
|
-
var mergedAddOns, _checkoutUpdateData, checkoutResponse, errorMessage;
|
|
6801
|
+
var mergedAddOns, _checkoutUpdateData, checkoutResponse, checkoutDataObj, errorMessage;
|
|
6796
6802
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
6797
6803
|
while (1) switch (_context7.prev = _context7.next) {
|
|
6798
6804
|
case 0:
|
|
@@ -6828,7 +6834,8 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6828
6834
|
case 9:
|
|
6829
6835
|
checkoutResponse = _context7.sent;
|
|
6830
6836
|
if (checkoutResponse.success) {
|
|
6831
|
-
|
|
6837
|
+
checkoutDataObj = _get(checkoutResponse, 'data.attributes.cart_price_breakdown', {});
|
|
6838
|
+
setCheckoutData(checkoutDataObj);
|
|
6832
6839
|
onCheckoutUpdateSuccess(checkoutResponse.data.attributes);
|
|
6833
6840
|
setSingleCheckoutAddOns(mergedAddOns);
|
|
6834
6841
|
}
|
|
@@ -7034,16 +7041,20 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7034
7041
|
checkoutUpdateResponse = _context9.sent;
|
|
7035
7042
|
paymentResponse = null;
|
|
7036
7043
|
if (!isSinglePageCheckout) {
|
|
7037
|
-
_context9.next =
|
|
7044
|
+
_context9.next = 68;
|
|
7038
7045
|
break;
|
|
7039
7046
|
}
|
|
7040
7047
|
_checkoutResponse$dat = checkoutResponse.data.attributes, hash = _checkoutResponse$dat.hash, total = _checkoutResponse$dat.total;
|
|
7041
|
-
|
|
7048
|
+
localStorage.setItem('checkoutData', JSON.stringify({
|
|
7049
|
+
hash: hash,
|
|
7050
|
+
total: total
|
|
7051
|
+
}));
|
|
7052
|
+
_context9.next = 49;
|
|
7042
7053
|
return getPaymentData(String(hash));
|
|
7043
|
-
case
|
|
7054
|
+
case 49:
|
|
7044
7055
|
paymentDataResponse = _context9.sent;
|
|
7045
7056
|
if (!paymentDataResponse.success) {
|
|
7046
|
-
_context9.next =
|
|
7057
|
+
_context9.next = 68;
|
|
7047
7058
|
break;
|
|
7048
7059
|
}
|
|
7049
7060
|
attributes = paymentDataResponse.data.attributes;
|
|
@@ -7070,11 +7081,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7070
7081
|
paymentMethod = attributes.payment_method || {};
|
|
7071
7082
|
paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled;
|
|
7072
7083
|
if (isFreeTickets) {
|
|
7073
|
-
_context9.next =
|
|
7084
|
+
_context9.next = 66;
|
|
7074
7085
|
break;
|
|
7075
7086
|
}
|
|
7076
7087
|
card = cardRef.current;
|
|
7077
|
-
_context9.next =
|
|
7088
|
+
_context9.next = 63;
|
|
7078
7089
|
return stripeRef.current.createPaymentMethod({
|
|
7079
7090
|
type: 'card',
|
|
7080
7091
|
card: card || {
|
|
@@ -7084,14 +7095,14 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7084
7095
|
address: addressRef.current
|
|
7085
7096
|
}
|
|
7086
7097
|
});
|
|
7087
|
-
case
|
|
7098
|
+
case 63:
|
|
7088
7099
|
paymentMethodReq = _context9.sent;
|
|
7089
|
-
_context9.next =
|
|
7100
|
+
_context9.next = 66;
|
|
7090
7101
|
return stripeRef.current.confirmCardPayment(paymentMethod.stripe_client_secret, {
|
|
7091
7102
|
payment_method: paymentMethodReq.paymentMethod.id
|
|
7092
7103
|
});
|
|
7093
|
-
case
|
|
7094
|
-
_context9.next =
|
|
7104
|
+
case 66:
|
|
7105
|
+
_context9.next = 68;
|
|
7095
7106
|
return handlePaymentMiddleWare(null, {}, {
|
|
7096
7107
|
reviewData: attributes,
|
|
7097
7108
|
isFreeTickets: isFreeTickets,
|
|
@@ -7109,13 +7120,13 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7109
7120
|
throw error;
|
|
7110
7121
|
}
|
|
7111
7122
|
});
|
|
7112
|
-
case
|
|
7123
|
+
case 68:
|
|
7113
7124
|
removeReferralKey();
|
|
7114
7125
|
handleSubmit(values, formikHelpers, eventId, checkoutResponse, checkoutUpdateResponse, paymentResponse);
|
|
7115
|
-
_context9.next =
|
|
7126
|
+
_context9.next = 79;
|
|
7116
7127
|
break;
|
|
7117
|
-
case
|
|
7118
|
-
_context9.prev =
|
|
7128
|
+
case 72:
|
|
7129
|
+
_context9.prev = 72;
|
|
7119
7130
|
_context9.t1 = _context9["catch"](0);
|
|
7120
7131
|
setLoading(false);
|
|
7121
7132
|
onSubmitError(_context9.t1);
|
|
@@ -7142,15 +7153,15 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7142
7153
|
}
|
|
7143
7154
|
onSubmitError(_context9.t1);
|
|
7144
7155
|
}
|
|
7145
|
-
case
|
|
7146
|
-
_context9.prev =
|
|
7156
|
+
case 79:
|
|
7157
|
+
_context9.prev = 79;
|
|
7147
7158
|
setLoading(false);
|
|
7148
|
-
return _context9.finish(
|
|
7149
|
-
case
|
|
7159
|
+
return _context9.finish(79);
|
|
7160
|
+
case 82:
|
|
7150
7161
|
case "end":
|
|
7151
7162
|
return _context9.stop();
|
|
7152
7163
|
}
|
|
7153
|
-
}, _callee9, null, [[0,
|
|
7164
|
+
}, _callee9, null, [[0, 72, 79, 82], [8, 20]]);
|
|
7154
7165
|
}));
|
|
7155
7166
|
function onSubmit(_x3, _x4) {
|
|
7156
7167
|
return _onSubmit.apply(this, arguments);
|