tf-checkout-react 1.3.17 → 1.3.18
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 -1
- package/dist/tf-checkout-react.cjs.development.js +42 -24
- 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 +42 -24
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/types/checkoutPageConfigs.d.ts +3 -0
- package/package.json +1 -1
- package/src/api/index.ts +8 -1
- package/src/components/addonsContainer/index.tsx +6 -0
- package/src/components/billing-info-container/index.tsx +4 -4
- package/src/components/ticketsContainer/index.tsx +1 -1
- package/src/types/checkoutPageConfigs.ts +3 -0
package/dist/api/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function getEvent(id: string | number, pk?: string): Promise<Axio
|
|
|
5
5
|
export declare function getTickets(id: string | number, promoCode: string, pk?: string): Promise<AxiosResponse<any, any>>;
|
|
6
6
|
export declare const addToCart: (id: string | number, data: any) => Promise<AxiosResponse<any, any>>;
|
|
7
7
|
export declare const getCart: () => Promise<AxiosResponse<any, any>>;
|
|
8
|
-
export declare const postOnCheckout: (data: any, accessToken?: string | undefined) => Promise<AxiosResponse<any, any>>;
|
|
8
|
+
export declare const postOnCheckout: (data: any, accessToken?: string | undefined, freeTicket?: boolean) => Promise<AxiosResponse<any, any>>;
|
|
9
9
|
export declare const authorize: (data: {
|
|
10
10
|
email: string;
|
|
11
11
|
password: string;
|
|
@@ -1379,7 +1379,19 @@ var getCart = function getCart() {
|
|
|
1379
1379
|
var res = publicRequest.get("v1/cart/");
|
|
1380
1380
|
return res;
|
|
1381
1381
|
};
|
|
1382
|
-
var postOnCheckout = function postOnCheckout(data, accessToken) {
|
|
1382
|
+
var postOnCheckout = function postOnCheckout(data, accessToken, freeTicket) {
|
|
1383
|
+
if (freeTicket === void 0) {
|
|
1384
|
+
freeTicket = false;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
if (freeTicket) {
|
|
1388
|
+
delete data.attributes.city;
|
|
1389
|
+
delete data.attributes.country;
|
|
1390
|
+
delete data.attributes.state;
|
|
1391
|
+
delete data.attributes.zip;
|
|
1392
|
+
delete data.attributes.street_address;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1383
1395
|
var res = publicRequest.post("v1/on-checkout/", {
|
|
1384
1396
|
data: data
|
|
1385
1397
|
}, {
|
|
@@ -3306,7 +3318,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
3306
3318
|
}
|
|
3307
3319
|
|
|
3308
3320
|
_context5.next = 7;
|
|
3309
|
-
return postOnCheckout(checkoutBody, access_token);
|
|
3321
|
+
return postOnCheckout(checkoutBody, access_token, flagFreeTicket);
|
|
3310
3322
|
|
|
3311
3323
|
case 7:
|
|
3312
3324
|
res = _context5.sent;
|
|
@@ -3419,7 +3431,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
3419
3431
|
}
|
|
3420
3432
|
|
|
3421
3433
|
_context6.next = 6;
|
|
3422
|
-
return postOnCheckout(_checkoutBody, access_token);
|
|
3434
|
+
return postOnCheckout(_checkoutBody, access_token, flagFreeTicket);
|
|
3423
3435
|
|
|
3424
3436
|
case 6:
|
|
3425
3437
|
_res = _context6.sent;
|
|
@@ -3523,7 +3535,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
|
|
|
3523
3535
|
}
|
|
3524
3536
|
|
|
3525
3537
|
_context6.next = 47;
|
|
3526
|
-
return postOnCheckout(checkoutBody);
|
|
3538
|
+
return postOnCheckout(checkoutBody, undefined, flagFreeTicket);
|
|
3527
3539
|
|
|
3528
3540
|
case 47:
|
|
3529
3541
|
res = _context6.sent;
|
|
@@ -5850,7 +5862,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5850
5862
|
}
|
|
5851
5863
|
|
|
5852
5864
|
_context2.next = 40;
|
|
5853
|
-
return postOnCheckout(checkoutBody, access_token);
|
|
5865
|
+
return postOnCheckout(checkoutBody, access_token, freeTicket);
|
|
5854
5866
|
|
|
5855
5867
|
case 40:
|
|
5856
5868
|
_context2.t1 = _context2.sent;
|
|
@@ -7762,7 +7774,7 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7762
7774
|
|
|
7763
7775
|
var handleConfirm = /*#__PURE__*/function () {
|
|
7764
7776
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(values, skipAddonPage) {
|
|
7765
|
-
var _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$has_, pageConfigsDataResponse, pageConfigsData, isWindowDefined, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hasAddOn, ticketsQuantity, userData, checkoutBody, checkoutResponse, hash, total;
|
|
7777
|
+
var _pageConfigsData$skip, _pageConfigsData$name, _pageConfigsData$age_, _pageConfigsData$phon, _pageConfigsData$has_, _pageConfigsData$free, _pageConfigsData$coll, _pageConfigsData$coll2, pageConfigsDataResponse, pageConfigsData, isWindowDefined, skipBillingPage, nameIsRequired, ageIsRequired, phoneIsRequired, hasAddOn, freeTicket, collectOptionalWalletAddress, collectMandatoryWalletAddress, ticketsQuantity, userData, checkoutBody, checkoutResponse, hash, total;
|
|
7766
7778
|
|
|
7767
7779
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
7768
7780
|
while (1) {
|
|
@@ -7781,24 +7793,27 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7781
7793
|
ageIsRequired = (_pageConfigsData$age_ = pageConfigsData.age_required) != null ? _pageConfigsData$age_ : false;
|
|
7782
7794
|
phoneIsRequired = (_pageConfigsData$phon = pageConfigsData.phone_required) != null ? _pageConfigsData$phon : false;
|
|
7783
7795
|
hasAddOn = (_pageConfigsData$has_ = pageConfigsData.has_add_on) != null ? _pageConfigsData$has_ : false;
|
|
7796
|
+
freeTicket = (_pageConfigsData$free = pageConfigsData.free_ticket) != null ? _pageConfigsData$free : false;
|
|
7797
|
+
collectOptionalWalletAddress = (_pageConfigsData$coll = pageConfigsData.collect_optional_wallet_address) != null ? _pageConfigsData$coll : false;
|
|
7798
|
+
collectMandatoryWalletAddress = (_pageConfigsData$coll2 = pageConfigsData.collect_mandatory_wallet_address) != null ? _pageConfigsData$coll2 : false;
|
|
7784
7799
|
|
|
7785
7800
|
if (!(skipBillingPage && enableBillingInfoAutoCreate)) {
|
|
7786
|
-
_context2.next =
|
|
7801
|
+
_context2.next = 36;
|
|
7787
7802
|
break;
|
|
7788
7803
|
}
|
|
7789
7804
|
|
|
7790
7805
|
ticketsQuantity = window.localStorage.getItem('quantity');
|
|
7791
7806
|
userData = JSON.parse(window.localStorage.getItem('user_data') || '{}');
|
|
7792
7807
|
checkoutBody = createCheckoutDataBodyWithDefaultHolder(Number(ticketsQuantity) || 0, userData);
|
|
7793
|
-
_context2.prev =
|
|
7794
|
-
_context2.next =
|
|
7808
|
+
_context2.prev = 18;
|
|
7809
|
+
_context2.next = 21;
|
|
7795
7810
|
return postOnCheckout(_extends({}, checkoutBody, {
|
|
7796
7811
|
attributes: _extends({}, checkoutBody.attributes, !skipAddonPage && {
|
|
7797
7812
|
add_ons: values
|
|
7798
7813
|
})
|
|
7799
7814
|
}));
|
|
7800
7815
|
|
|
7801
|
-
case
|
|
7816
|
+
case 21:
|
|
7802
7817
|
checkoutResponse = _context2.sent;
|
|
7803
7818
|
hash = _get(checkoutResponse, 'data.data.attributes.hash');
|
|
7804
7819
|
total = _get(checkoutResponse, 'data.data.attributes.total');
|
|
@@ -7813,22 +7828,25 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7813
7828
|
event_id: String(eventId),
|
|
7814
7829
|
hash: hash,
|
|
7815
7830
|
total: total,
|
|
7816
|
-
hasAddOn: hasAddOn
|
|
7831
|
+
hasAddOn: hasAddOn,
|
|
7832
|
+
free_ticket: freeTicket,
|
|
7833
|
+
collect_optional_wallet_address: collectOptionalWalletAddress,
|
|
7834
|
+
collect_mandatory_wallet_address: collectMandatoryWalletAddress
|
|
7817
7835
|
});
|
|
7818
|
-
_context2.next =
|
|
7836
|
+
_context2.next = 34;
|
|
7819
7837
|
break;
|
|
7820
7838
|
|
|
7821
|
-
case
|
|
7822
|
-
_context2.prev =
|
|
7823
|
-
_context2.t0 = _context2["catch"](
|
|
7839
|
+
case 30:
|
|
7840
|
+
_context2.prev = 30;
|
|
7841
|
+
_context2.t0 = _context2["catch"](18);
|
|
7824
7842
|
onPostCheckoutError(_context2.t0);
|
|
7825
7843
|
onConfirmSelectionError(_context2.t0);
|
|
7826
7844
|
|
|
7827
|
-
case
|
|
7828
|
-
_context2.next =
|
|
7845
|
+
case 34:
|
|
7846
|
+
_context2.next = 37;
|
|
7829
7847
|
break;
|
|
7830
7848
|
|
|
7831
|
-
case
|
|
7849
|
+
case 36:
|
|
7832
7850
|
if (isWindowDefined) {
|
|
7833
7851
|
if (!skipAddonPage) {
|
|
7834
7852
|
window.localStorage.setItem('add_ons', JSON.stringify(values));
|
|
@@ -7849,21 +7867,21 @@ var AddonsContainter = function AddonsContainter(_ref) {
|
|
|
7849
7867
|
});
|
|
7850
7868
|
}
|
|
7851
7869
|
|
|
7852
|
-
case
|
|
7853
|
-
_context2.next =
|
|
7870
|
+
case 37:
|
|
7871
|
+
_context2.next = 42;
|
|
7854
7872
|
break;
|
|
7855
7873
|
|
|
7856
|
-
case
|
|
7857
|
-
_context2.prev =
|
|
7874
|
+
case 39:
|
|
7875
|
+
_context2.prev = 39;
|
|
7858
7876
|
_context2.t1 = _context2["catch"](0);
|
|
7859
7877
|
onConfirmSelectionError(_context2.t1);
|
|
7860
7878
|
|
|
7861
|
-
case
|
|
7879
|
+
case 42:
|
|
7862
7880
|
case "end":
|
|
7863
7881
|
return _context2.stop();
|
|
7864
7882
|
}
|
|
7865
7883
|
}
|
|
7866
|
-
}, _callee2, null, [[0,
|
|
7884
|
+
}, _callee2, null, [[0, 39], [18, 30]]);
|
|
7867
7885
|
}));
|
|
7868
7886
|
|
|
7869
7887
|
return function handleConfirm(_x, _x2) {
|