tf-checkout-react 1.0.80 → 1.0.81
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/ticketsContainer/index.d.ts +2 -1
- package/dist/hooks/usePrevious.d.ts +1 -0
- package/dist/tf-checkout-react.cjs.development.js +65 -19
- 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 +66 -20
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/billing-info-container/index.tsx +18 -5
- package/src/components/ticketsContainer/PromoCodeSection.tsx +8 -3
- package/src/components/ticketsContainer/index.tsx +4 -1
- package/src/hooks/usePrevious.tsx +9 -0
- package/src/utils/downloadPDF.tsx +11 -3
|
@@ -27,6 +27,7 @@ export interface IGetTickets {
|
|
|
27
27
|
checkbox?: CSSProperties;
|
|
28
28
|
};
|
|
29
29
|
isAccessCodeEnabled?: boolean;
|
|
30
|
+
hideSessionButtons?: boolean;
|
|
30
31
|
}
|
|
31
32
|
export interface ITicket {
|
|
32
33
|
id: string | number;
|
|
@@ -35,5 +36,5 @@ export interface ITicket {
|
|
|
35
36
|
export interface ISelectedTickets {
|
|
36
37
|
[key: string]: string | number;
|
|
37
38
|
}
|
|
38
|
-
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, }: IGetTickets) => JSX.Element;
|
|
39
|
+
export declare const TicketsContainer: ({ onLoginSuccess, getTicketsLabel, eventId, onAddToCartSuccess, contentStyle, onAddToCartError, onGetTicketsSuccess, onGetTicketsError, theme, queryPromoCode, isPromotionsEnabled, themeOptions, isAccessCodeEnabled, hideSessionButtons }: IGetTickets) => JSX.Element;
|
|
39
40
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const usePrevious: <T extends unknown>(value: T) => T | undefined;
|
|
@@ -12,6 +12,7 @@ var _identity = _interopDefault(require('lodash/identity'));
|
|
|
12
12
|
var _map = _interopDefault(require('lodash/map'));
|
|
13
13
|
var _get = _interopDefault(require('lodash/get'));
|
|
14
14
|
var _includes = _interopDefault(require('lodash/includes'));
|
|
15
|
+
var _isEqual = _interopDefault(require('lodash/isEqual'));
|
|
15
16
|
var axios = _interopDefault(require('axios'));
|
|
16
17
|
var _forEach = _interopDefault(require('lodash/forEach'));
|
|
17
18
|
var material = require('@mui/material');
|
|
@@ -1006,7 +1007,7 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1006
1007
|
}
|
|
1007
1008
|
}).then( /*#__PURE__*/function () {
|
|
1008
1009
|
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(response) {
|
|
1009
|
-
var blobValue;
|
|
1010
|
+
var blobValue, fileNameHeader, fileName;
|
|
1010
1011
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1011
1012
|
while (1) {
|
|
1012
1013
|
switch (_context.prev = _context.next) {
|
|
@@ -1016,9 +1017,14 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1016
1017
|
|
|
1017
1018
|
case 2:
|
|
1018
1019
|
blobValue = _context.sent;
|
|
1019
|
-
|
|
1020
|
+
fileNameHeader = response.headers.get("content-disposition") || '';
|
|
1021
|
+
fileName = fileNameHeader.split('"')[1];
|
|
1022
|
+
return _context.abrupt("return", {
|
|
1023
|
+
blobValue: blobValue,
|
|
1024
|
+
fileName: fileName
|
|
1025
|
+
});
|
|
1020
1026
|
|
|
1021
|
-
case
|
|
1027
|
+
case 6:
|
|
1022
1028
|
case "end":
|
|
1023
1029
|
return _context.stop();
|
|
1024
1030
|
}
|
|
@@ -1029,12 +1035,20 @@ var downloadPDF = function downloadPDF(pdfUrl) {
|
|
|
1029
1035
|
return function (_x) {
|
|
1030
1036
|
return _ref.apply(this, arguments);
|
|
1031
1037
|
};
|
|
1032
|
-
}()).then(function (
|
|
1038
|
+
}()).then(function (_ref2) {
|
|
1039
|
+
var blobValue = _ref2.blobValue,
|
|
1040
|
+
fileName = _ref2.fileName;
|
|
1041
|
+
if (!fileName) return;
|
|
1033
1042
|
var file = new Blob([blobValue], {
|
|
1034
1043
|
type: 'application/pdf'
|
|
1035
1044
|
});
|
|
1036
1045
|
var fileURL = URL.createObjectURL(file);
|
|
1037
|
-
|
|
1046
|
+
var link = document.createElement('a');
|
|
1047
|
+
link.href = fileURL;
|
|
1048
|
+
link.setAttribute('download', fileName);
|
|
1049
|
+
document.body.appendChild(link);
|
|
1050
|
+
link.click();
|
|
1051
|
+
document.body.removeChild(link);
|
|
1038
1052
|
});
|
|
1039
1053
|
};
|
|
1040
1054
|
|
|
@@ -2087,6 +2101,14 @@ var FormikPhoneNumberField = function FormikPhoneNumberField(_ref) {
|
|
|
2087
2101
|
}, rest));
|
|
2088
2102
|
};
|
|
2089
2103
|
|
|
2104
|
+
var usePrevious = function usePrevious(value) {
|
|
2105
|
+
var ref = React.useRef();
|
|
2106
|
+
React.useEffect(function () {
|
|
2107
|
+
ref.current = value;
|
|
2108
|
+
});
|
|
2109
|
+
return ref.current;
|
|
2110
|
+
};
|
|
2111
|
+
|
|
2090
2112
|
var LogicRunner = function LogicRunner(_ref) {
|
|
2091
2113
|
var values = _ref.values,
|
|
2092
2114
|
setStates = _ref.setStates,
|
|
@@ -2224,7 +2246,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2224
2246
|
_ref3$onGetStatesErro = _ref3.onGetStatesError,
|
|
2225
2247
|
onGetStatesError = _ref3$onGetStatesErro === void 0 ? function () {} : _ref3$onGetStatesErro,
|
|
2226
2248
|
_ref3$onGetProfileDat = _ref3.onGetProfileDataSuccess,
|
|
2227
|
-
|
|
2249
|
+
_onGetProfileDataSuccess = _ref3$onGetProfileDat === void 0 ? function () {} : _ref3$onGetProfileDat,
|
|
2228
2250
|
_ref3$onGetProfileDat2 = _ref3.onGetProfileDataError,
|
|
2229
2251
|
onGetProfileDataError = _ref3$onGetProfileDat2 === void 0 ? function () {} : _ref3$onGetProfileDat2,
|
|
2230
2252
|
_ref3$onAuthorizeSucc = _ref3.onAuthorizeSuccess,
|
|
@@ -2240,6 +2262,7 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2240
2262
|
accountInfoTitle = _ref3$accountInfoTitl === void 0 ? '' : _ref3$accountInfoTitl,
|
|
2241
2263
|
hideLogo = _ref3.hideLogo,
|
|
2242
2264
|
themeOptions = _ref3.themeOptions;
|
|
2265
|
+
|
|
2243
2266
|
var themeMui = styles$1.createTheme(themeOptions);
|
|
2244
2267
|
var isWindowDefined = typeof window !== 'undefined';
|
|
2245
2268
|
var userData = isWindowDefined && window.localStorage.getItem('user_data') ? JSON.parse(window.localStorage.getItem('user_data') || '') : {};
|
|
@@ -2314,9 +2337,14 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2314
2337
|
|
|
2315
2338
|
var optedInFieldValue = _get(cartInfoData, 'optedIn', false);
|
|
2316
2339
|
|
|
2317
|
-
var
|
|
2340
|
+
var ttfOptIn = _get(cartInfoData, 'ttfOptIn', false);
|
|
2341
|
+
|
|
2342
|
+
var hideTtfOptIn = _get(cartInfoData, 'hide_ttf_opt_in', true); // Get prevProps
|
|
2343
|
+
|
|
2318
2344
|
|
|
2319
|
-
|
|
2345
|
+
var prevData = usePrevious(data);
|
|
2346
|
+
|
|
2347
|
+
if (!_get(dataWithUniqueIds, '[0].uniqueId') || !_isEqual(prevData, data)) {
|
|
2320
2348
|
setDataWithUniqueIds(assingUniqueIds(data));
|
|
2321
2349
|
}
|
|
2322
2350
|
|
|
@@ -2471,7 +2499,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2471
2499
|
lastName: profileDataObj.last_name
|
|
2472
2500
|
}));
|
|
2473
2501
|
window.localStorage.setItem('user_data', JSON.stringify(profileDataObj));
|
|
2474
|
-
|
|
2502
|
+
|
|
2503
|
+
_onGetProfileDataSuccess(userDataResponse.data);
|
|
2475
2504
|
|
|
2476
2505
|
case 10:
|
|
2477
2506
|
_context4.next = 15;
|
|
@@ -2507,7 +2536,8 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2507
2536
|
initialValues: getInitialValues(dataWithUniqueIds, _extends({}, initialValues, {
|
|
2508
2537
|
country: _get(userData, 'country', '') || "1",
|
|
2509
2538
|
state: _get(userData, 'state', '') || "1",
|
|
2510
|
-
brand_opt_in: optedInFieldValue
|
|
2539
|
+
brand_opt_in: optedInFieldValue,
|
|
2540
|
+
ttf_opt_in: ttfOptIn
|
|
2511
2541
|
}), userValues),
|
|
2512
2542
|
enableReinitialize: true,
|
|
2513
2543
|
onSubmit: function () {
|
|
@@ -2751,13 +2781,13 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2751
2781
|
var groupClassname = group.groupClassname,
|
|
2752
2782
|
groupItems = group.groupItems;
|
|
2753
2783
|
return React__default.createElement("div", {
|
|
2754
|
-
key: group.
|
|
2784
|
+
key: group.id
|
|
2755
2785
|
}, React__default.createElement("div", {
|
|
2756
2786
|
className: groupClassname
|
|
2757
2787
|
}, _map(groupItems, function (element) {
|
|
2758
2788
|
return React__default.createElement("div", {
|
|
2759
2789
|
className: element.className,
|
|
2760
|
-
key: element.
|
|
2790
|
+
key: element.name
|
|
2761
2791
|
}, React__default.createElement(formik.Field, {
|
|
2762
2792
|
name: element.name + "-" + index,
|
|
2763
2793
|
label: element.label,
|
|
@@ -2791,7 +2821,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2791
2821
|
userExpired: userExpired,
|
|
2792
2822
|
onAuthorizeSuccess: onAuthorizeSuccess,
|
|
2793
2823
|
onAuthorizeError: onAuthorizeError,
|
|
2794
|
-
onGetProfileDataSuccess: onGetProfileDataSuccess
|
|
2824
|
+
onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
|
|
2825
|
+
fetchCart();
|
|
2826
|
+
|
|
2827
|
+
_onGetProfileDataSuccess(data);
|
|
2828
|
+
},
|
|
2795
2829
|
onGetProfileDataError: onGetProfileDataError
|
|
2796
2830
|
}), showModalRegister && React__default.createElement(RegisterModal, {
|
|
2797
2831
|
onClose: function onClose() {
|
|
@@ -2800,7 +2834,11 @@ var BillingInfoContainer = function BillingInfoContainer(_ref3) {
|
|
|
2800
2834
|
onRegister: function onRegister() {
|
|
2801
2835
|
setShowModalRegister(false);
|
|
2802
2836
|
},
|
|
2803
|
-
onGetProfileDataSuccess: onGetProfileDataSuccess
|
|
2837
|
+
onGetProfileDataSuccess: function onGetProfileDataSuccess(data) {
|
|
2838
|
+
fetchCart();
|
|
2839
|
+
|
|
2840
|
+
_onGetProfileDataSuccess(data);
|
|
2841
|
+
},
|
|
2804
2842
|
onGetProfileDataError: onGetProfileDataError
|
|
2805
2843
|
}));
|
|
2806
2844
|
};
|
|
@@ -4034,6 +4072,7 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
4034
4072
|
setPromoCodeUpdated = _ref.setPromoCodeUpdated,
|
|
4035
4073
|
setShowPromoInput = _ref.setShowPromoInput,
|
|
4036
4074
|
isAccessCodeEnabled = _ref.isAccessCodeEnabled;
|
|
4075
|
+
var isPromoCodeHasValue = !!promoCode.trim();
|
|
4037
4076
|
|
|
4038
4077
|
var renderInputField = function renderInputField() {
|
|
4039
4078
|
return React__default.createElement("div", {
|
|
@@ -4049,14 +4088,18 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
4049
4088
|
setPromoCode(e.target.value);
|
|
4050
4089
|
},
|
|
4051
4090
|
onKeyPress: function onKeyPress(event) {
|
|
4052
|
-
if (event.key === 'Enter') {
|
|
4091
|
+
if (event.key === 'Enter' && isPromoCodeHasValue) {
|
|
4053
4092
|
setPromoCodeUpdated(promoCode);
|
|
4093
|
+
setShowPromoInput(false);
|
|
4054
4094
|
}
|
|
4055
4095
|
}
|
|
4056
4096
|
}), React__default.createElement(Button$1, {
|
|
4057
4097
|
className: "promo-submit-button",
|
|
4058
4098
|
onClick: function onClick() {
|
|
4059
|
-
|
|
4099
|
+
if (isPromoCodeHasValue) {
|
|
4100
|
+
setPromoCodeUpdated(promoCode);
|
|
4101
|
+
setShowPromoInput(false);
|
|
4102
|
+
}
|
|
4060
4103
|
}
|
|
4061
4104
|
}, isAccessCodeEnabled ? 'ENTER' : 'APPLY'));
|
|
4062
4105
|
};
|
|
@@ -4070,7 +4113,7 @@ var PromoCodeSection = function PromoCodeSection(_ref) {
|
|
|
4070
4113
|
}
|
|
4071
4114
|
}), React__default.createElement("p", {
|
|
4072
4115
|
className: "promo-code-success"
|
|
4073
|
-
}, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput &&
|
|
4116
|
+
}, "PROMO CODE APPLIED SUCCESSFULLY")) : null, showPromoInput && renderInputField(), isPromotionsEnabled && !showPromoInput && !isAccessCodeEnabled ? React__default.createElement(Button$1, {
|
|
4074
4117
|
className: "promo-code-button",
|
|
4075
4118
|
placeholder: "Promo Codes",
|
|
4076
4119
|
onClick: function onClick() {
|
|
@@ -4184,7 +4227,9 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4184
4227
|
isPromotionsEnabled = _ref$isPromotionsEnab === void 0 ? true : _ref$isPromotionsEnab,
|
|
4185
4228
|
themeOptions = _ref.themeOptions,
|
|
4186
4229
|
_ref$isAccessCodeEnab = _ref.isAccessCodeEnabled,
|
|
4187
|
-
isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab
|
|
4230
|
+
isAccessCodeEnabled = _ref$isAccessCodeEnab === void 0 ? false : _ref$isAccessCodeEnab,
|
|
4231
|
+
_ref$hideSessionButto = _ref.hideSessionButtons,
|
|
4232
|
+
hideSessionButtons = _ref$hideSessionButto === void 0 ? false : _ref$hideSessionButto;
|
|
4188
4233
|
|
|
4189
4234
|
var _useState = React.useState({}),
|
|
4190
4235
|
selectedTickets = _useState[0],
|
|
@@ -4315,6 +4360,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4315
4360
|
setTickets(_get(attributes, 'tickets'));
|
|
4316
4361
|
setShowWaitingList(attributes.showWaitingList);
|
|
4317
4362
|
onGetTicketsSuccess(response.data);
|
|
4363
|
+
setPromoCode('');
|
|
4318
4364
|
}
|
|
4319
4365
|
|
|
4320
4366
|
if (eventResponse.data.success) {
|
|
@@ -4523,7 +4569,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
4523
4569
|
"aria-hidden": true,
|
|
4524
4570
|
className: "book-button " + (handleBookIsLoading || _isEmpty(selectedTickets) || Object.values(selectedTickets)[0] === 0 ? 'disabled' : ''),
|
|
4525
4571
|
onClick: !handleBookIsLoading && !_isEmpty(selectedTickets) && Object.values(selectedTickets)[0] > 0 ? handleBook : function () {}
|
|
4526
|
-
}, getTicketsLabel || 'GET TICKETS'), isLogged ? React__default.createElement("div", {
|
|
4572
|
+
}, getTicketsLabel || 'GET TICKETS'), isLogged && !hideSessionButtons ? React__default.createElement("div", {
|
|
4527
4573
|
className: "session-wrapper"
|
|
4528
4574
|
}, React__default.createElement("span", {
|
|
4529
4575
|
className: "session-container"
|