tf-checkout-react 1.3.19 → 1.3.22
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/README.md +5 -0
- package/dist/components/orderDetailsContainer/index.d.ts +2 -1
- package/dist/components/ticketResale/index.d.ts +2 -1
- package/dist/components/ticketsContainer/index.d.ts +2 -1
- package/dist/tf-checkout-react.cjs.development.js +19 -11
- 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 +19 -11
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/api/index.ts +12 -5
- package/src/components/.DS_Store +0 -0
- package/src/components/common/dist/PhoneNumberField.js +96 -0
- package/src/components/orderDetailsContainer/index.tsx +4 -2
- package/src/components/ticketResale/index.tsx +14 -9
- package/src/components/ticketsContainer/index.tsx +3 -1
package/package.json
CHANGED
package/src/.DS_Store
ADDED
|
Binary file
|
package/src/api/index.ts
CHANGED
|
@@ -178,12 +178,15 @@ export function getTickets(
|
|
|
178
178
|
pk?: string
|
|
179
179
|
) {
|
|
180
180
|
const invitationHash = getQueryVariable('invitation-hash')
|
|
181
|
+
const params = { pk } as any
|
|
182
|
+
|
|
183
|
+
if (invitationHash) {
|
|
184
|
+
params['invitation-hash'] = invitationHash
|
|
185
|
+
}
|
|
186
|
+
|
|
181
187
|
const response = publicRequest
|
|
182
188
|
.get(`v1/event/${id}/tickets`, {
|
|
183
|
-
params
|
|
184
|
-
pk,
|
|
185
|
-
'invitation-hash': invitationHash,
|
|
186
|
-
},
|
|
189
|
+
params,
|
|
187
190
|
headers: promoCode
|
|
188
191
|
? {
|
|
189
192
|
...ttfHeaders,
|
|
@@ -216,7 +219,11 @@ export const getCart = () => {
|
|
|
216
219
|
return res
|
|
217
220
|
}
|
|
218
221
|
|
|
219
|
-
export const postOnCheckout = (
|
|
222
|
+
export const postOnCheckout = (
|
|
223
|
+
data: any,
|
|
224
|
+
accessToken?: string,
|
|
225
|
+
freeTicket = false
|
|
226
|
+
) => {
|
|
220
227
|
if (freeTicket) {
|
|
221
228
|
delete data.attributes.city
|
|
222
229
|
delete data.attributes.country
|
|
Binary file
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
};
|
|
@@ -46,6 +46,7 @@ interface OrderDetailsTypes {
|
|
|
46
46
|
key: keyof ITicketTypes & keyof IActionColumns;
|
|
47
47
|
label: string | number | null | undefined;
|
|
48
48
|
}>;
|
|
49
|
+
ordersPath?: string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const getTotal = (data: any) => {
|
|
@@ -67,6 +68,7 @@ export const OrderDetailsContainer = ({
|
|
|
67
68
|
personalLinkIcon = '',
|
|
68
69
|
displayColumnNameInRow = false,
|
|
69
70
|
ticketsTableColumns,
|
|
71
|
+
ordersPath,
|
|
70
72
|
}: OrderDetailsTypes) => {
|
|
71
73
|
const [data, setData] = useState<any>({})
|
|
72
74
|
const [loading, setLoading] = useState(true)
|
|
@@ -226,7 +228,7 @@ export const OrderDetailsContainer = ({
|
|
|
226
228
|
className="return-button"
|
|
227
229
|
onClick={() => {
|
|
228
230
|
if (typeof window !== 'undefined') {
|
|
229
|
-
window.location.assign('/orders')
|
|
231
|
+
window.location.assign(ordersPath ?? '/orders')
|
|
230
232
|
}
|
|
231
233
|
}}
|
|
232
234
|
>
|
|
@@ -328,7 +330,7 @@ export const OrderDetailsContainer = ({
|
|
|
328
330
|
if (onReturnButtonClick) {
|
|
329
331
|
onReturnButtonClick(data)
|
|
330
332
|
} else if (typeof window !== 'undefined') {
|
|
331
|
-
window.location.assign('/orders')
|
|
333
|
+
window.location.assign(ordersPath ?? '/orders')
|
|
332
334
|
}
|
|
333
335
|
}}
|
|
334
336
|
>
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import _get from 'lodash/get'
|
|
3
|
-
import { processTicket, declineInvitation } from '../../api'
|
|
4
1
|
import { AxiosError } from 'axios'
|
|
2
|
+
import _get from 'lodash/get'
|
|
3
|
+
import React, { useEffect, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { declineInvitation,processTicket } from '../../api'
|
|
5
6
|
|
|
6
7
|
export interface ITicketResaleContainer {
|
|
7
|
-
onProcessTicketSuccess: (res: any) => void
|
|
8
|
-
onProcessTicketError: (e: AxiosError) => void
|
|
9
|
-
onDeclineTicketPurchaseSuccess: (res: any) => void
|
|
10
|
-
onDeclineTicketPurchaseError: (e: AxiosError) => void
|
|
11
|
-
orderHash?: string
|
|
8
|
+
onProcessTicketSuccess: (res: any) => void;
|
|
9
|
+
onProcessTicketError: (e: AxiosError) => void;
|
|
10
|
+
onDeclineTicketPurchaseSuccess: (res: any) => void;
|
|
11
|
+
onDeclineTicketPurchaseError: (e: AxiosError) => void;
|
|
12
|
+
orderHash?: string;
|
|
13
|
+
billingPath?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export const TicketResaleContainer = ({
|
|
@@ -17,6 +19,7 @@ export const TicketResaleContainer = ({
|
|
|
17
19
|
onDeclineTicketPurchaseSuccess = () => {},
|
|
18
20
|
onDeclineTicketPurchaseError = () => {},
|
|
19
21
|
orderHash,
|
|
22
|
+
billingPath,
|
|
20
23
|
}: ITicketResaleContainer) => {
|
|
21
24
|
const isWindowDefined = typeof window !== 'undefined'
|
|
22
25
|
const [error, setError] = useState('')
|
|
@@ -52,7 +55,9 @@ export const TicketResaleContainer = ({
|
|
|
52
55
|
const event_id = _get(data, 'event_id')
|
|
53
56
|
|
|
54
57
|
onProcessTicketSuccess(response.data)
|
|
55
|
-
window.location.href =
|
|
58
|
+
window.location.href = `${
|
|
59
|
+
billingPath ?? '/billing/billing-info/'
|
|
60
|
+
}?age_required=${age_required}&names_required=${names_required}&event_id=${event_id}`
|
|
56
61
|
} catch (error) {
|
|
57
62
|
setError(error?.response?.data?.message)
|
|
58
63
|
onProcessTicketError(error.response)
|
|
@@ -87,6 +87,7 @@ export interface IGetTickets {
|
|
|
87
87
|
hideTicketsHeader?: boolean;
|
|
88
88
|
enableInfluencersSection?: boolean;
|
|
89
89
|
enableAddOns?: boolean;
|
|
90
|
+
ordersPath?: string;
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export interface ITicket {
|
|
@@ -131,6 +132,7 @@ export const TicketsContainer = ({
|
|
|
131
132
|
enableAddOns = true,
|
|
132
133
|
handleNotInvitedModalClose = _identity,
|
|
133
134
|
handleInvalidLinkModalClose = _identity,
|
|
135
|
+
ordersPath,
|
|
134
136
|
}: IGetTickets) => {
|
|
135
137
|
const [selectedTickets, setSelectedTickets] = useState({} as ISelectedTickets)
|
|
136
138
|
const isWindowDefined = typeof window !== 'undefined'
|
|
@@ -255,7 +257,7 @@ export const TicketsContainer = ({
|
|
|
255
257
|
|
|
256
258
|
const handleOrdersClick = () => {
|
|
257
259
|
if (isWindowDefined) {
|
|
258
|
-
window.location.href = '/orders'
|
|
260
|
+
window.location.href = ordersPath ?? '/orders'
|
|
259
261
|
}
|
|
260
262
|
}
|
|
261
263
|
|