tf-checkout-react 1.6.6-beta.30 → 1.6.6-beta.31
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/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.js +89 -54
- 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 +89 -54
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +34 -11
- package/src/components/paymentContainer/index.tsx +16 -21
|
@@ -32,5 +32,6 @@ export interface IPaymentPage {
|
|
|
32
32
|
isSinglePageCheckout?: boolean;
|
|
33
33
|
stripePaymentProps?: Partial<ICheckoutForm>;
|
|
34
34
|
stripePublishableKey?: string;
|
|
35
|
+
stripeAccountId?: string;
|
|
35
36
|
}
|
|
36
|
-
export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, themeOptions, elementsOptions, onCountdownFinish, enableTimer, enablePaymentPlan, orderInfoLabel, paymentInfoLabel, displayPaymentButton, hidePaymentForm, hideFieldsBlock, isSinglePageCheckout, stripePaymentProps, stripePublishableKey
|
|
37
|
+
export declare const PaymentContainer: ({ paymentFields, handlePayment, formTitle, errorText, checkoutData, onErrorClose, onGetPaymentDataSuccess, onGetPaymentDataError, onPaymentError, themeOptions, elementsOptions, onCountdownFinish, enableTimer, enablePaymentPlan, orderInfoLabel, paymentInfoLabel, displayPaymentButton, hidePaymentForm, hideFieldsBlock, isSinglePageCheckout, stripePaymentProps, stripePublishableKey, stripeAccountId, }: IPaymentPage) => JSX.Element;
|
|
@@ -5455,7 +5455,6 @@ var PaymentPlanSection = function PaymentPlanSection(props) {
|
|
|
5455
5455
|
})))));
|
|
5456
5456
|
};
|
|
5457
5457
|
|
|
5458
|
-
var publishableKey = CONFIGS.STRIPE_PUBLISHABLE_KEY || '';
|
|
5459
5458
|
var initialPaymentPlanConfiguration = {
|
|
5460
5459
|
requires_deposit: false,
|
|
5461
5460
|
deposit: 0,
|
|
@@ -5541,7 +5540,8 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5541
5540
|
isSinglePageCheckout = _ref$isSinglePageChec === void 0 ? false : _ref$isSinglePageChec,
|
|
5542
5541
|
_ref$stripePaymentPro = _ref.stripePaymentProps,
|
|
5543
5542
|
stripePaymentProps = _ref$stripePaymentPro === void 0 ? {} : _ref$stripePaymentPro,
|
|
5544
|
-
|
|
5543
|
+
stripePublishableKey = _ref.stripePublishableKey,
|
|
5544
|
+
stripeAccountId = _ref.stripeAccountId;
|
|
5545
5545
|
var _useState = React.useState(initialReviewValues),
|
|
5546
5546
|
reviewData = _useState[0],
|
|
5547
5547
|
setReviewData = _useState[1];
|
|
@@ -5699,6 +5699,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5699
5699
|
});
|
|
5700
5700
|
setPaymentDataIsLoading(false);
|
|
5701
5701
|
}
|
|
5702
|
+
} else {
|
|
5702
5703
|
fetchPaymentData();
|
|
5703
5704
|
}
|
|
5704
5705
|
}, [orderData, hash, isSinglePageCheckout, onGetPaymentDataError, onGetPaymentDataSuccess]);
|
|
@@ -5750,15 +5751,18 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5750
5751
|
}
|
|
5751
5752
|
return showPaymentForm;
|
|
5752
5753
|
};
|
|
5754
|
+
var getPublishableKey = function getPublishableKey() {
|
|
5755
|
+
return stripePublishableKey || _get(reviewData, 'payment_method.stripe_publishable_key');
|
|
5756
|
+
};
|
|
5753
5757
|
var getStripePromise = React.useCallback(function () {
|
|
5754
|
-
var stripePublishableKey =
|
|
5755
|
-
var stripeAccount = _get(reviewData, 'payment_method.stripe_connected_account');
|
|
5758
|
+
var stripePublishableKey = getPublishableKey();
|
|
5759
|
+
var stripeAccount = stripeAccountId || _get(reviewData, 'payment_method.stripe_connected_account');
|
|
5756
5760
|
var options = {};
|
|
5757
5761
|
if (stripeAccount) {
|
|
5758
5762
|
options.stripeAccount = stripeAccount;
|
|
5759
5763
|
}
|
|
5760
5764
|
return stripeJs.loadStripe(stripePublishableKey, options);
|
|
5761
|
-
}, [reviewData,
|
|
5765
|
+
}, [reviewData, stripePublishableKey]);
|
|
5762
5766
|
var themeMui = styles.createTheme(themeOptions);
|
|
5763
5767
|
var hasTableTypes = Boolean(Number(orderData.guest_count));
|
|
5764
5768
|
var paymentFieldsData = hasTableTypes ? [{
|
|
@@ -5899,7 +5903,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
5899
5903
|
currency: currency,
|
|
5900
5904
|
paymentPlanUseSavedCard: paymentPlanUseSavedCard,
|
|
5901
5905
|
setPaymentPlanUseSavedCard: setPaymentPlanUseSavedCard
|
|
5902
|
-
}), showPaymentForm() ? React__default.createElement("div", {
|
|
5906
|
+
}), showPaymentForm() && !!getPublishableKey() ? React__default.createElement("div", {
|
|
5903
5907
|
className: "payment_info"
|
|
5904
5908
|
}, React__default.createElement("div", {
|
|
5905
5909
|
className: "payment_info_label"
|
|
@@ -6227,7 +6231,7 @@ var LogicRunner = function LogicRunner(_ref) {
|
|
|
6227
6231
|
return null;
|
|
6228
6232
|
};
|
|
6229
6233
|
var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
6230
|
-
var _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2;
|
|
6234
|
+
var _reviewData$payment_m, _checkoutUpdateData$a, _checkoutUpdateData$a2, _reviewData$payment_m2, _checkoutUpdateData$a3, _checkoutUpdateData$a4;
|
|
6231
6235
|
var _ref4$data = _ref4.data,
|
|
6232
6236
|
data = _ref4$data === void 0 ? [] : _ref4$data,
|
|
6233
6237
|
_ref4$ticketHoldersFi = _ref4.ticketHoldersFields,
|
|
@@ -6902,6 +6906,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6902
6906
|
dataWithUniqueIds[0].label = 'Get Your Tables';
|
|
6903
6907
|
}
|
|
6904
6908
|
var stripePublishableKey = (reviewData == null ? void 0 : (_reviewData$payment_m = reviewData.payment_method) == null ? void 0 : _reviewData$payment_m.stripe_publishable_key) || (checkoutUpdateData == null ? void 0 : (_checkoutUpdateData$a = checkoutUpdateData.additional_payment_information) == null ? void 0 : (_checkoutUpdateData$a2 = _checkoutUpdateData$a.basic_config) == null ? void 0 : _checkoutUpdateData$a2.apiKey);
|
|
6909
|
+
var stripeAccountId = (reviewData == null ? void 0 : (_reviewData$payment_m2 = reviewData.payment_method) == null ? void 0 : _reviewData$payment_m2.stripe_connected_account) || (checkoutUpdateData == null ? void 0 : (_checkoutUpdateData$a3 = checkoutUpdateData.additional_payment_information) == null ? void 0 : (_checkoutUpdateData$a4 = _checkoutUpdateData$a3.basic_config) == null ? void 0 : _checkoutUpdateData$a4.accountId);
|
|
6905
6910
|
return React__default.createElement(styles.ThemeProvider, {
|
|
6906
6911
|
theme: themeMui
|
|
6907
6912
|
}, (loading || cardLoading || isCountriesLoading || isConfigLoading) && React__default.createElement(Backdrop, {
|
|
@@ -6933,7 +6938,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6933
6938
|
enableReinitialize: false,
|
|
6934
6939
|
onSubmit: function () {
|
|
6935
6940
|
var _onSubmit = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(values, formikHelpers) {
|
|
6936
|
-
var checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, refreshToken, userProfile, hasUnverifiedOrder, message, profileData, profileSpecifiedData, profileDataObj, userDataObj, checkoutBody, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, paymentMethod, paymentPlanAvailable,
|
|
6941
|
+
var stripePaymentMethod, card, stripePaymentMethodResponse, _stripePaymentMethodR, checkoutBodyForRegistration, bodyFormData, resRegister, _xtfCookie, refreshToken, userProfile, hasUnverifiedOrder, message, profileData, profileSpecifiedData, profileDataObj, userDataObj, checkoutBody, checkoutResponse, checkoutUpdateResponse, paymentResponse, _checkoutResponse$dat, hash, total, paymentDataResponse, _cart$, attributes, order_details, cart, _order_details$ticket, ticket, updatedOrderData, isFreeTickets, paymentMethod, paymentPlanAvailable, confirmationResult, _confirmationResult$e, _hasUnverifiedOrder, _message, _e$response, event;
|
|
6937
6942
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
6938
6943
|
while (1) switch (_context9.prev = _context9.next) {
|
|
6939
6944
|
case 0:
|
|
@@ -6945,6 +6950,33 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6945
6950
|
setError('Fill in the card details');
|
|
6946
6951
|
return _context9.abrupt("return");
|
|
6947
6952
|
case 4:
|
|
6953
|
+
stripePaymentMethod = null;
|
|
6954
|
+
if (!(isSinglePageCheckout && !orderIsFree)) {
|
|
6955
|
+
_context9.next = 14;
|
|
6956
|
+
break;
|
|
6957
|
+
}
|
|
6958
|
+
card = cardRef.current;
|
|
6959
|
+
_context9.next = 9;
|
|
6960
|
+
return stripeRef.current.createPaymentMethod({
|
|
6961
|
+
type: 'card',
|
|
6962
|
+
card: card || {
|
|
6963
|
+
token: ''
|
|
6964
|
+
},
|
|
6965
|
+
billing_details: {
|
|
6966
|
+
address: addressRef.current
|
|
6967
|
+
}
|
|
6968
|
+
});
|
|
6969
|
+
case 9:
|
|
6970
|
+
stripePaymentMethodResponse = _context9.sent;
|
|
6971
|
+
if (!(stripePaymentMethodResponse != null && stripePaymentMethodResponse.error)) {
|
|
6972
|
+
_context9.next = 13;
|
|
6973
|
+
break;
|
|
6974
|
+
}
|
|
6975
|
+
setError('' + (stripePaymentMethodResponse == null ? void 0 : (_stripePaymentMethodR = stripePaymentMethodResponse.error) == null ? void 0 : _stripePaymentMethodR.message));
|
|
6976
|
+
return _context9.abrupt("return");
|
|
6977
|
+
case 13:
|
|
6978
|
+
stripePaymentMethod = stripePaymentMethodResponse.paymentMethod;
|
|
6979
|
+
case 14:
|
|
6948
6980
|
if (isBrowser) {
|
|
6949
6981
|
window.localStorage.setItem('extraData', JSON.stringify({
|
|
6950
6982
|
data_capture: {
|
|
@@ -6956,7 +6988,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6956
6988
|
}));
|
|
6957
6989
|
}
|
|
6958
6990
|
if (isLoggedIn) {
|
|
6959
|
-
_context9.next =
|
|
6991
|
+
_context9.next = 37;
|
|
6960
6992
|
break;
|
|
6961
6993
|
}
|
|
6962
6994
|
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
@@ -6965,11 +6997,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6965
6997
|
lastNameLogged: lastNameLogged
|
|
6966
6998
|
}, showDOB);
|
|
6967
6999
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration, flagFreeTicket);
|
|
6968
|
-
_context9.prev =
|
|
7000
|
+
_context9.prev = 18;
|
|
6969
7001
|
setLoading(true);
|
|
6970
|
-
_context9.next =
|
|
7002
|
+
_context9.next = 22;
|
|
6971
7003
|
return register(bodyFormData);
|
|
6972
|
-
case
|
|
7004
|
+
case 22:
|
|
6973
7005
|
resRegister = _context9.sent;
|
|
6974
7006
|
_xtfCookie = _get(resRegister, 'headers.x-tf-ecommerce');
|
|
6975
7007
|
refreshToken = _get(resRegister, 'data.attributes.refresh_token');
|
|
@@ -6980,11 +7012,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
6980
7012
|
refreshToken: refreshToken,
|
|
6981
7013
|
userProfile: userProfile
|
|
6982
7014
|
});
|
|
6983
|
-
_context9.next =
|
|
7015
|
+
_context9.next = 37;
|
|
6984
7016
|
break;
|
|
6985
|
-
case
|
|
6986
|
-
_context9.prev =
|
|
6987
|
-
_context9.t0 = _context9["catch"](
|
|
7017
|
+
case 30:
|
|
7018
|
+
_context9.prev = 30;
|
|
7019
|
+
_context9.t0 = _context9["catch"](18);
|
|
6988
7020
|
setLoading(false);
|
|
6989
7021
|
hasUnverifiedOrder = _get(_context9.t0, 'response.data.data.hasUnverifiedOrder');
|
|
6990
7022
|
message = _get(_context9.t0, 'response.data.message', {});
|
|
@@ -7009,10 +7041,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7009
7041
|
onRegisterError(_context9.t0, values.email);
|
|
7010
7042
|
}
|
|
7011
7043
|
return _context9.abrupt("return");
|
|
7012
|
-
case
|
|
7013
|
-
_context9.next =
|
|
7044
|
+
case 37:
|
|
7045
|
+
_context9.next = 39;
|
|
7014
7046
|
return getProfileData();
|
|
7015
|
-
case
|
|
7047
|
+
case 39:
|
|
7016
7048
|
profileData = _context9.sent;
|
|
7017
7049
|
profileSpecifiedData = _get(profileData, 'data');
|
|
7018
7050
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -7027,21 +7059,21 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7027
7059
|
if (isSinglePageCheckout) {
|
|
7028
7060
|
checkoutBody.attributes.add_ons = singleCheckoutAddons;
|
|
7029
7061
|
}
|
|
7030
|
-
_context9.next =
|
|
7062
|
+
_context9.next = 49;
|
|
7031
7063
|
return postOnCheckout(checkoutBody, flagFreeTicket);
|
|
7032
|
-
case
|
|
7064
|
+
case 49:
|
|
7033
7065
|
checkoutResponse = _context9.sent;
|
|
7034
|
-
_context9.next =
|
|
7066
|
+
_context9.next = 52;
|
|
7035
7067
|
return updateCheckout({
|
|
7036
7068
|
attributes: {
|
|
7037
7069
|
event_id: eventId
|
|
7038
7070
|
}
|
|
7039
7071
|
});
|
|
7040
|
-
case
|
|
7072
|
+
case 52:
|
|
7041
7073
|
checkoutUpdateResponse = _context9.sent;
|
|
7042
7074
|
paymentResponse = null;
|
|
7043
7075
|
if (!isSinglePageCheckout) {
|
|
7044
|
-
_context9.next =
|
|
7076
|
+
_context9.next = 81;
|
|
7045
7077
|
break;
|
|
7046
7078
|
}
|
|
7047
7079
|
_checkoutResponse$dat = checkoutResponse.data.attributes, hash = _checkoutResponse$dat.hash, total = _checkoutResponse$dat.total;
|
|
@@ -7049,12 +7081,12 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7049
7081
|
hash: hash,
|
|
7050
7082
|
total: total
|
|
7051
7083
|
}));
|
|
7052
|
-
_context9.next =
|
|
7084
|
+
_context9.next = 59;
|
|
7053
7085
|
return getPaymentData(String(hash));
|
|
7054
|
-
case
|
|
7086
|
+
case 59:
|
|
7055
7087
|
paymentDataResponse = _context9.sent;
|
|
7056
7088
|
if (!paymentDataResponse.success) {
|
|
7057
|
-
_context9.next =
|
|
7089
|
+
_context9.next = 81;
|
|
7058
7090
|
break;
|
|
7059
7091
|
}
|
|
7060
7092
|
attributes = paymentDataResponse.data.attributes;
|
|
@@ -7081,28 +7113,30 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7081
7113
|
paymentMethod = attributes.payment_method || {};
|
|
7082
7114
|
paymentPlanAvailable = paymentMethod.stripe_payment_plan_enabled;
|
|
7083
7115
|
if (isFreeTickets) {
|
|
7084
|
-
_context9.next =
|
|
7116
|
+
_context9.next = 79;
|
|
7085
7117
|
break;
|
|
7086
7118
|
}
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
address: addressRef.current
|
|
7096
|
-
}
|
|
7097
|
-
});
|
|
7098
|
-
case 63:
|
|
7099
|
-
paymentMethodReq = _context9.sent;
|
|
7100
|
-
_context9.next = 66;
|
|
7119
|
+
if (stripePaymentMethod) {
|
|
7120
|
+
_context9.next = 73;
|
|
7121
|
+
break;
|
|
7122
|
+
}
|
|
7123
|
+
setError('Fill in the card details');
|
|
7124
|
+
return _context9.abrupt("return");
|
|
7125
|
+
case 73:
|
|
7126
|
+
_context9.next = 75;
|
|
7101
7127
|
return stripeRef.current.confirmCardPayment(paymentMethod.stripe_client_secret, {
|
|
7102
|
-
payment_method:
|
|
7128
|
+
payment_method: stripePaymentMethod.id
|
|
7103
7129
|
});
|
|
7104
|
-
case
|
|
7105
|
-
|
|
7130
|
+
case 75:
|
|
7131
|
+
confirmationResult = _context9.sent;
|
|
7132
|
+
if (!(confirmationResult != null && confirmationResult.error)) {
|
|
7133
|
+
_context9.next = 79;
|
|
7134
|
+
break;
|
|
7135
|
+
}
|
|
7136
|
+
setError('' + (confirmationResult == null ? void 0 : (_confirmationResult$e = confirmationResult.error) == null ? void 0 : _confirmationResult$e.message));
|
|
7137
|
+
return _context9.abrupt("return");
|
|
7138
|
+
case 79:
|
|
7139
|
+
_context9.next = 81;
|
|
7106
7140
|
return handlePaymentMiddleWare(null, {}, {
|
|
7107
7141
|
reviewData: attributes,
|
|
7108
7142
|
isFreeTickets: isFreeTickets,
|
|
@@ -7120,13 +7154,13 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7120
7154
|
throw error;
|
|
7121
7155
|
}
|
|
7122
7156
|
});
|
|
7123
|
-
case
|
|
7157
|
+
case 81:
|
|
7124
7158
|
removeReferralKey();
|
|
7125
7159
|
handleSubmit(values, formikHelpers, eventId, checkoutResponse, checkoutUpdateResponse, paymentResponse);
|
|
7126
|
-
_context9.next =
|
|
7160
|
+
_context9.next = 92;
|
|
7127
7161
|
break;
|
|
7128
|
-
case
|
|
7129
|
-
_context9.prev =
|
|
7162
|
+
case 85:
|
|
7163
|
+
_context9.prev = 85;
|
|
7130
7164
|
_context9.t1 = _context9["catch"](0);
|
|
7131
7165
|
setLoading(false);
|
|
7132
7166
|
onSubmitError(_context9.t1);
|
|
@@ -7153,15 +7187,15 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7153
7187
|
}
|
|
7154
7188
|
onSubmitError(_context9.t1);
|
|
7155
7189
|
}
|
|
7156
|
-
case
|
|
7157
|
-
_context9.prev =
|
|
7190
|
+
case 92:
|
|
7191
|
+
_context9.prev = 92;
|
|
7158
7192
|
setLoading(false);
|
|
7159
|
-
return _context9.finish(
|
|
7160
|
-
case
|
|
7193
|
+
return _context9.finish(92);
|
|
7194
|
+
case 95:
|
|
7161
7195
|
case "end":
|
|
7162
7196
|
return _context9.stop();
|
|
7163
7197
|
}
|
|
7164
|
-
}, _callee9, null, [[0,
|
|
7198
|
+
}, _callee9, null, [[0, 85, 92, 95], [18, 30]]);
|
|
7165
7199
|
}));
|
|
7166
7200
|
function onSubmit(_x3, _x4) {
|
|
7167
7201
|
return _onSubmit.apply(this, arguments);
|
|
@@ -7319,6 +7353,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
7319
7353
|
}));
|
|
7320
7354
|
})), isSinglePageCheckout && !orderIsFree && stripePublishableKey && React__default.createElement(PaymentContainer, {
|
|
7321
7355
|
stripePublishableKey: stripePublishableKey,
|
|
7356
|
+
stripeAccountId: stripeAccountId,
|
|
7322
7357
|
formTitle: "Payment Information",
|
|
7323
7358
|
orderInfoLabel: "",
|
|
7324
7359
|
enableTimer: false,
|