tf-checkout-react 1.4.5 → 1.4.7
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/PromoCodeSection.d.ts +2 -1
- package/dist/components/ticketsContainer/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.js +15 -7
- 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 +15 -7
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/seatMapContainer/index.tsx +6 -2
- package/src/components/ticketsContainer/PromoCodeSection.tsx +15 -9
- package/src/components/ticketsContainer/index.tsx +3 -0
- package/src/components/common/dist/PhoneNumberField.js +0 -96
package/package.json
CHANGED
|
@@ -78,6 +78,7 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
|
|
|
78
78
|
const [guestCounts, setGuestCounts] = useState<IGuestCounts>(
|
|
79
79
|
{} as IGuestCounts
|
|
80
80
|
)
|
|
81
|
+
const isGuestCountsSet = useRef(false)
|
|
81
82
|
|
|
82
83
|
const updateGuestCounts = (data: any) => {
|
|
83
84
|
_forEach(data, (item: any) => {
|
|
@@ -85,10 +86,10 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
|
|
|
85
86
|
const seatTicketsArray = _values(tierTickets)
|
|
86
87
|
|
|
87
88
|
setGuestCounts((prevState: any) => ({
|
|
88
|
-
...prevState,
|
|
89
89
|
[item.seatId]: Number(
|
|
90
90
|
seatTicketsArray[0].ticket_type_min_number_of_guests
|
|
91
91
|
),
|
|
92
|
+
...prevState,
|
|
92
93
|
}))
|
|
93
94
|
})
|
|
94
95
|
}
|
|
@@ -151,7 +152,10 @@ export const SeatMapContainer = (props: IMapContainerProps) => {
|
|
|
151
152
|
setReservedSeats(reservationData)
|
|
152
153
|
// automatically set ticket/table type if it's the only one
|
|
153
154
|
if (ticketTypeTierRelationsRef.current) {
|
|
154
|
-
|
|
155
|
+
if (!isGuestCountsSet.current) {
|
|
156
|
+
updateGuestCounts(reservationData)
|
|
157
|
+
isGuestCountsSet.current = true
|
|
158
|
+
}
|
|
155
159
|
_forEach(reservationData, (item: any) => {
|
|
156
160
|
const tierTickets = ticketTypeTierRelationsRef.current[item.tierId]
|
|
157
161
|
const seatTicketsArray = _values(tierTickets)
|
|
@@ -16,6 +16,7 @@ export interface IPromoCodeSectionProps {
|
|
|
16
16
|
codeIsInvalid: boolean;
|
|
17
17
|
setCodeIsInvalid: (value: boolean) => void;
|
|
18
18
|
promoText?: string;
|
|
19
|
+
showAlertIcons?: boolean;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export const PromoCodeSection = ({
|
|
@@ -29,6 +30,7 @@ export const PromoCodeSection = ({
|
|
|
29
30
|
codeIsInvalid,
|
|
30
31
|
setCodeIsInvalid,
|
|
31
32
|
promoText,
|
|
33
|
+
showAlertIcons
|
|
32
34
|
}: IPromoCodeSectionProps) => {
|
|
33
35
|
const isPromoCodeHasValue = !!code.trim()
|
|
34
36
|
|
|
@@ -68,20 +70,24 @@ export const PromoCodeSection = ({
|
|
|
68
70
|
<div>
|
|
69
71
|
{codeIsApplied ? (
|
|
70
72
|
<div className="alert-info">
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
code
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
{showAlertIcons && (
|
|
74
|
+
<SVG
|
|
75
|
+
src={DoneSvg}
|
|
76
|
+
preProcessor={code =>
|
|
77
|
+
code.replace(/fill=".*?"/g, 'fill="currentColor"')
|
|
78
|
+
}
|
|
79
|
+
/>
|
|
80
|
+
)}
|
|
77
81
|
<p className="promo-code-success">PROMO CODE APPLIED SUCCESSFULLY</p>
|
|
78
82
|
</div>
|
|
79
83
|
) : null}
|
|
80
84
|
{codeIsInvalid ? (
|
|
81
85
|
<div className="alert-info fail">
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
{showAlertIcons && (
|
|
87
|
+
<SVG
|
|
88
|
+
src={XmarkSvg}
|
|
89
|
+
/>
|
|
90
|
+
)}
|
|
85
91
|
<p className="promo-code-fail">Invalid Promo Code</p>
|
|
86
92
|
</div>
|
|
87
93
|
) : null}
|
|
@@ -108,6 +108,7 @@ export interface IGetTickets {
|
|
|
108
108
|
currencySybmol?: string;
|
|
109
109
|
onReserveButtonClick?: () => void;
|
|
110
110
|
onPendingVerification?: () => void;
|
|
111
|
+
showAlertIcons?: boolean;
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
export interface ITicket {
|
|
@@ -164,6 +165,7 @@ export const TicketsContainer = ({
|
|
|
164
165
|
currencySybmol = '',
|
|
165
166
|
onReserveButtonClick = _identity,
|
|
166
167
|
onPendingVerification = _identity,
|
|
168
|
+
showAlertIcons = true,
|
|
167
169
|
}: IGetTickets) => {
|
|
168
170
|
const [selectedTickets, setSelectedTickets] = useState({} as ISelectedTickets)
|
|
169
171
|
const isWindowDefined = typeof window !== 'undefined'
|
|
@@ -675,6 +677,7 @@ export const TicketsContainer = ({
|
|
|
675
677
|
codeIsInvalid={codeIsInvalid}
|
|
676
678
|
setCodeIsInvalid={setCodeIsInvalid}
|
|
677
679
|
promoText={promoText}
|
|
680
|
+
showAlertIcons={showAlertIcons}
|
|
678
681
|
/>
|
|
679
682
|
) : null}
|
|
680
683
|
{wrappedActionsSectionComponent}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
exports.__esModule = true;
|
|
50
|
-
exports.PhoneNumberField = void 0;
|
|
51
|
-
var TextField_1 = require("@mui/material/TextField");
|
|
52
|
-
var debounce_1 = require("lodash/debounce");
|
|
53
|
-
var get_1 = require("lodash/get");
|
|
54
|
-
var react_1 = require("react");
|
|
55
|
-
var api_1 = require("../../api");
|
|
56
|
-
exports.PhoneNumberField = function (_a) {
|
|
57
|
-
var label = _a.label, _b = _a.type, type = _b === void 0 ? 'text' : _b, field = _a.field, _c = _a.form, errors = _c.errors, setFieldError = _c.setFieldError, setStatus = _c.setStatus;
|
|
58
|
-
var error = get_1["default"](errors, field.name);
|
|
59
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
var debounceCb = react_1.useCallback(debounce_1["default"](function (cb) { return void cb(); }, 1000), []);
|
|
61
|
-
react_1.useEffect(function () {
|
|
62
|
-
var _a;
|
|
63
|
-
if (field.value) {
|
|
64
|
-
setStatus((_a = {}, _a[field.name] = true, _a));
|
|
65
|
-
}
|
|
66
|
-
debounceCb(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
-
var error_1, message;
|
|
68
|
-
var _a;
|
|
69
|
-
return __generator(this, function (_b) {
|
|
70
|
-
switch (_b.label) {
|
|
71
|
-
case 0:
|
|
72
|
-
_b.trys.push([0, 3, 4, 5]);
|
|
73
|
-
if (!field.value) return [3 /*break*/, 2];
|
|
74
|
-
return [4 /*yield*/, api_1.validatePhoneNumber(field.value)];
|
|
75
|
-
case 1:
|
|
76
|
-
_b.sent();
|
|
77
|
-
_b.label = 2;
|
|
78
|
-
case 2:
|
|
79
|
-
setFieldError(field.name, '');
|
|
80
|
-
return [3 /*break*/, 5];
|
|
81
|
-
case 3:
|
|
82
|
-
error_1 = _b.sent();
|
|
83
|
-
message = get_1["default"](error_1, 'response.data.message', 'Invalid phone number');
|
|
84
|
-
setFieldError(field.name, message);
|
|
85
|
-
return [3 /*break*/, 5];
|
|
86
|
-
case 4:
|
|
87
|
-
setStatus((_a = {}, _a[field.name] = false, _a));
|
|
88
|
-
return [7 /*endfinally*/];
|
|
89
|
-
case 5: return [2 /*return*/];
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}); });
|
|
93
|
-
// eslint-disable-next-line
|
|
94
|
-
}, [field.value]);
|
|
95
|
-
return (react_1["default"].createElement(TextField_1["default"], __assign({}, field, { id: field.name, label: label, type: type, fullWidth: true, error: !!error, helperText: error, value: field.value || '', inputProps: { pattern: '[+0-9]/d+' } })));
|
|
96
|
-
};
|