tf-checkout-react 1.0.95 → 1.0.96
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/api/index.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +68 -42
- 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 +68 -42
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +9 -0
- package/src/components/billing-info-container/index.tsx +0 -3
- package/src/components/paymentContainer/index.tsx +18 -5
package/dist/api/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const getAccessToken: (data: FormData) => Promise<import("axios")
|
|
|
19
19
|
export declare const getPaymentData: (hash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
20
20
|
export declare const handlePaymentData: (orderHash: string, data: any) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
21
21
|
export declare const handlePaymentSuccess: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
|
+
export declare const handleFreeSuccess: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
23
|
export declare const getProfileData: (accessToken: any) => Promise<any>;
|
|
23
24
|
export declare const getCountries: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
24
25
|
export declare const getConfirmationData: (orderHash: string) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
@@ -1275,6 +1275,12 @@ var handlePaymentSuccess = function handlePaymentSuccess(orderHash) {
|
|
|
1275
1275
|
});
|
|
1276
1276
|
return res;
|
|
1277
1277
|
};
|
|
1278
|
+
var handleFreeSuccess = function handleFreeSuccess(orderHash) {
|
|
1279
|
+
var res = publicRequest.post("v1/order/" + orderHash + "/complete_free_registration")["catch"](function (error) {
|
|
1280
|
+
throw error;
|
|
1281
|
+
});
|
|
1282
|
+
return res;
|
|
1283
|
+
};
|
|
1278
1284
|
var getProfileData = function getProfileData(accessToken) {
|
|
1279
1285
|
return publicRequest.get('/customer/profile/', {
|
|
1280
1286
|
headers: _extends({}, ttfHeaders, {
|
|
@@ -2688,7 +2694,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2688
2694
|
_context6.prev = 0;
|
|
2689
2695
|
|
|
2690
2696
|
if (!isLoggedIn) {
|
|
2691
|
-
_context6.next =
|
|
2697
|
+
_context6.next = 15;
|
|
2692
2698
|
break;
|
|
2693
2699
|
}
|
|
2694
2700
|
|
|
@@ -2716,14 +2722,10 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2716
2722
|
|
|
2717
2723
|
case 12:
|
|
2718
2724
|
_res = _context6.sent;
|
|
2719
|
-
_context6.next = 15;
|
|
2720
|
-
return getPaymentData(_res.data.data.attributes.hash);
|
|
2721
|
-
|
|
2722
|
-
case 15:
|
|
2723
2725
|
handleSubmit(values, formikHelpers, eventId, _res);
|
|
2724
2726
|
return _context6.abrupt("return");
|
|
2725
2727
|
|
|
2726
|
-
case
|
|
2728
|
+
case 15:
|
|
2727
2729
|
checkoutBodyForRegistration = createCheckoutDataBody(ticketsQuantity.length, values, {
|
|
2728
2730
|
emailLogged: emailLogged,
|
|
2729
2731
|
firstNameLogged: firstNameLogged,
|
|
@@ -2731,11 +2733,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2731
2733
|
}, showDOB);
|
|
2732
2734
|
bodyFormData = createRegisterFormData(values, checkoutBodyForRegistration);
|
|
2733
2735
|
access_token_register = null;
|
|
2734
|
-
_context6.prev =
|
|
2735
|
-
_context6.next =
|
|
2736
|
+
_context6.prev = 18;
|
|
2737
|
+
_context6.next = 21;
|
|
2736
2738
|
return register(bodyFormData);
|
|
2737
2739
|
|
|
2738
|
-
case
|
|
2740
|
+
case 21:
|
|
2739
2741
|
resRegister = _context6.sent;
|
|
2740
2742
|
access_token_register = _get(resRegister, 'data.data.attributes.access_token');
|
|
2741
2743
|
refreshToken = _get(resRegister, 'data.data.attributes.refresh_token');
|
|
@@ -2745,12 +2747,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2745
2747
|
refreshToken: refreshToken
|
|
2746
2748
|
};
|
|
2747
2749
|
onRegisterSuccess(tokens);
|
|
2748
|
-
_context6.next =
|
|
2750
|
+
_context6.next = 33;
|
|
2749
2751
|
break;
|
|
2750
2752
|
|
|
2751
|
-
case
|
|
2752
|
-
_context6.prev =
|
|
2753
|
-
_context6.t0 = _context6["catch"](
|
|
2753
|
+
case 29:
|
|
2754
|
+
_context6.prev = 29;
|
|
2755
|
+
_context6.t0 = _context6["catch"](18);
|
|
2754
2756
|
|
|
2755
2757
|
if (axios.isAxiosError(_context6.t0)) {
|
|
2756
2758
|
_error = _context6.t0 == null ? void 0 : (_e$response = _context6.t0.response) == null ? void 0 : (_e$response$data = _e$response.data) == null ? void 0 : _e$response$data.message;
|
|
@@ -2775,11 +2777,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2775
2777
|
|
|
2776
2778
|
return _context6.abrupt("return");
|
|
2777
2779
|
|
|
2778
|
-
case
|
|
2779
|
-
_context6.next =
|
|
2780
|
+
case 33:
|
|
2781
|
+
_context6.next = 35;
|
|
2780
2782
|
return getProfileData(access_token_register);
|
|
2781
2783
|
|
|
2782
|
-
case
|
|
2784
|
+
case 35:
|
|
2783
2785
|
profileData = _context6.sent;
|
|
2784
2786
|
profileSpecifiedData = _get(profileData, 'data.data');
|
|
2785
2787
|
profileDataObj = setLoggedUserData(profileSpecifiedData);
|
|
@@ -2789,21 +2791,17 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2789
2791
|
}
|
|
2790
2792
|
|
|
2791
2793
|
checkoutBody = collectCheckoutBody(values);
|
|
2792
|
-
_context6.next =
|
|
2794
|
+
_context6.next = 42;
|
|
2793
2795
|
return postOnCheckout(checkoutBody, access_token_register);
|
|
2794
2796
|
|
|
2795
|
-
case
|
|
2797
|
+
case 42:
|
|
2796
2798
|
res = _context6.sent;
|
|
2797
|
-
_context6.next = 47;
|
|
2798
|
-
return getPaymentData(res.data.data.attributes.hash);
|
|
2799
|
-
|
|
2800
|
-
case 47:
|
|
2801
2799
|
handleSubmit(values, formikHelpers, eventId, res);
|
|
2802
|
-
_context6.next =
|
|
2800
|
+
_context6.next = 49;
|
|
2803
2801
|
break;
|
|
2804
2802
|
|
|
2805
|
-
case
|
|
2806
|
-
_context6.prev =
|
|
2803
|
+
case 46:
|
|
2804
|
+
_context6.prev = 46;
|
|
2807
2805
|
_context6.t1 = _context6["catch"](0);
|
|
2808
2806
|
|
|
2809
2807
|
if (axios.isAxiosError(_context6.t1)) {
|
|
@@ -2827,12 +2825,12 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2827
2825
|
onSubmitError(_context6.t1);
|
|
2828
2826
|
}
|
|
2829
2827
|
|
|
2830
|
-
case
|
|
2828
|
+
case 49:
|
|
2831
2829
|
case "end":
|
|
2832
2830
|
return _context6.stop();
|
|
2833
2831
|
}
|
|
2834
2832
|
}
|
|
2835
|
-
}, _callee6, null, [[0,
|
|
2833
|
+
}, _callee6, null, [[0, 46], [18, 29]]);
|
|
2836
2834
|
}));
|
|
2837
2835
|
|
|
2838
2836
|
function onSubmit(_x2, _x3) {
|
|
@@ -3414,9 +3412,9 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3414
3412
|
var showFormTitle = Boolean(formTitle);
|
|
3415
3413
|
var showErrorText = Boolean(errorText);
|
|
3416
3414
|
var eventId = getQueryVariable('event_id');
|
|
3415
|
+
var hash = checkoutData.hash,
|
|
3416
|
+
total = checkoutData.total;
|
|
3417
3417
|
React.useEffect(function () {
|
|
3418
|
-
var hash = checkoutData.hash;
|
|
3419
|
-
|
|
3420
3418
|
_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
3421
3419
|
var response, _cart$, attributes, cart, order_details, _order_details$ticket, ticket, _orderData;
|
|
3422
3420
|
|
|
@@ -3536,32 +3534,50 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3536
3534
|
|
|
3537
3535
|
case 4:
|
|
3538
3536
|
order_hash = reviewData.order_details.order_hash;
|
|
3539
|
-
|
|
3537
|
+
|
|
3538
|
+
if (!(total === "0.00")) {
|
|
3539
|
+
_context3.next = 11;
|
|
3540
|
+
break;
|
|
3541
|
+
}
|
|
3542
|
+
|
|
3543
|
+
_context3.next = 8;
|
|
3544
|
+
return handleFreeSuccess(order_hash);
|
|
3545
|
+
|
|
3546
|
+
case 8:
|
|
3547
|
+
_context3.t0 = _context3.sent;
|
|
3548
|
+
_context3.next = 14;
|
|
3549
|
+
break;
|
|
3550
|
+
|
|
3551
|
+
case 11:
|
|
3552
|
+
_context3.next = 13;
|
|
3540
3553
|
return handlePaymentSuccess(order_hash);
|
|
3541
3554
|
|
|
3542
|
-
case
|
|
3543
|
-
|
|
3555
|
+
case 13:
|
|
3556
|
+
_context3.t0 = _context3.sent;
|
|
3557
|
+
|
|
3558
|
+
case 14:
|
|
3559
|
+
paymentSuccessResponse = _context3.t0;
|
|
3544
3560
|
|
|
3545
3561
|
if (paymentSuccessResponse.status === 200) {
|
|
3546
3562
|
handlePayment(paymentSuccessResponse);
|
|
3547
3563
|
setPaymentIsLoading(false);
|
|
3548
3564
|
}
|
|
3549
3565
|
|
|
3550
|
-
_context3.next =
|
|
3566
|
+
_context3.next = 22;
|
|
3551
3567
|
break;
|
|
3552
3568
|
|
|
3553
|
-
case
|
|
3554
|
-
_context3.prev =
|
|
3555
|
-
_context3.
|
|
3556
|
-
setError(_get(_context3.
|
|
3557
|
-
onPaymentError(_context3.
|
|
3569
|
+
case 18:
|
|
3570
|
+
_context3.prev = 18;
|
|
3571
|
+
_context3.t1 = _context3["catch"](0);
|
|
3572
|
+
setError(_get(_context3.t1, 'response.data.message'));
|
|
3573
|
+
onPaymentError(_context3.t1.response);
|
|
3558
3574
|
|
|
3559
|
-
case
|
|
3575
|
+
case 22:
|
|
3560
3576
|
case "end":
|
|
3561
3577
|
return _context3.stop();
|
|
3562
3578
|
}
|
|
3563
3579
|
}
|
|
3564
|
-
}, _callee3, null, [[0,
|
|
3580
|
+
}, _callee3, null, [[0, 18]]);
|
|
3565
3581
|
}));
|
|
3566
3582
|
|
|
3567
3583
|
return function handlePaymentMiddleWare(_x) {
|
|
@@ -3603,7 +3619,7 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3603
3619
|
}, label), React__default.createElement("div", {
|
|
3604
3620
|
className: className + " order_info_text"
|
|
3605
3621
|
}, normalizer(orderData[id], orderData.currency)));
|
|
3606
|
-
})), React__default.createElement("div", {
|
|
3622
|
+
})), total !== "0.00" ? React__default.createElement("div", {
|
|
3607
3623
|
className: "payment_info"
|
|
3608
3624
|
}, React__default.createElement("div", {
|
|
3609
3625
|
className: "payment_info_label"
|
|
@@ -3626,7 +3642,17 @@ var PaymentContainer = function PaymentContainer(_ref) {
|
|
|
3626
3642
|
conditions: conditions,
|
|
3627
3643
|
stripeCardOptions: stripeCardOptions,
|
|
3628
3644
|
disableZipSection: disableZipSection
|
|
3629
|
-
}))))
|
|
3645
|
+
})))) : React__default.createElement("div", {
|
|
3646
|
+
className: "payment_button " + (paymentIsLoading ? 'disabled-payment-button' : '')
|
|
3647
|
+
}, React__default.createElement("button", {
|
|
3648
|
+
disabled: paymentIsLoading,
|
|
3649
|
+
type: "button",
|
|
3650
|
+
onClick: function onClick() {
|
|
3651
|
+
handlePaymentMiddleWare(null);
|
|
3652
|
+
}
|
|
3653
|
+
}, paymentIsLoading ? React__default.createElement(CircularProgress, {
|
|
3654
|
+
size: 26
|
|
3655
|
+
}) : "Complete Registration")))));
|
|
3630
3656
|
};
|
|
3631
3657
|
|
|
3632
3658
|
var config = {
|