tf-checkout-react 1.2.28 → 1.2.30

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.28",
2
+ "version": "1.2.30",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -76,9 +76,9 @@
76
76
  "dependencies": {
77
77
  "@emotion/react": "^11.7.0",
78
78
  "@emotion/styled": "^11.6.0",
79
- "@mui/lab": "^5.0.0-alpha.55",
80
79
  "@mui/material": "^5.2.2",
81
80
  "@mui/styles": "^5.2.2",
81
+ "@mui/x-date-pickers": "^5.0.1",
82
82
  "@stripe/react-stripe-js": "^1.6.0",
83
83
  "@stripe/stripe-js": "^1.21.1",
84
84
  "axios": "^0.24.0",
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -256,7 +256,7 @@ export const BillingInfoContainer = React.memo(
256
256
  : ''
257
257
  const [dataWithUniqueIds, setDataWithUniqueIds] = useState<
258
258
  IBillingInfoData[]
259
- >(data)
259
+ >(assingUniqueIds(data))
260
260
  const xtfCookie = getCookieByName('X-TF-ECOMMERCE')
261
261
  const [isLoggedIn, setIsLoggedIn] = useState(!!(pIsLoggedIn || xtfCookie))
262
262
  const [cartInfoData, setCartInfo] = useState<any>({})
@@ -22,6 +22,7 @@ export const CheckboxField = ({
22
22
  theme,
23
23
  setFieldValue,
24
24
  disableDropdown,
25
+ setPhoneValidationIsLoading,
25
26
  ...rest
26
27
  }: ICheckboxField & IOtherProps) => {
27
28
  const customTheme: any = useTheme()
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
- import DatePicker from '@mui/lab/DatePicker'
3
- import AdapterMoment from '@mui/lab/AdapterMoment'
4
- import LocalizationProvider from '@mui/lab/LocalizationProvider'
2
+ import { DatePicker } from '@mui/x-date-pickers'
3
+ import { AdapterMoment } from '@mui/x-date-pickers/AdapterMoment'
4
+ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
5
5
  import { ThemeProvider, createTheme } from '@mui/material/styles'
6
6
  import { FieldInputProps, FormikProps } from 'formik'
7
7
  import _get from 'lodash/get'
@@ -32,6 +32,12 @@ const compactStyles = {
32
32
  width: DATE_SIZE,
33
33
  height: DATE_SIZE,
34
34
  },
35
+ '& .MuiPickersArrowSwitcher-spacer': {
36
+ width: 0,
37
+ },
38
+ '& [role="presentation"] .PrivatePickersFadeTransitionGroup-root': {
39
+ marginRight: -1,
40
+ },
35
41
  }
36
42
 
37
43
  const compactStyleTheme = createTheme({
@@ -88,8 +88,8 @@ export const PhoneNumberField = ({
88
88
  defaultCountry="us"
89
89
  disableDropdown={disableDropdown}
90
90
  label={label}
91
- error={!!error && isTouched}
92
- helperText={isTouched && error}
91
+ error={!!error && (isTouched || fill)}
92
+ helperText={(isTouched || fill) && error}
93
93
  fullWidth
94
94
  autoFormat={false}
95
95
  disableAreaCodes={true}
@@ -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
+ };
@@ -1,3 +1,4 @@
1
+ import CircularProgress from '@mui/material/CircularProgress'
1
2
  import Paper from '@mui/material/Paper'
2
3
  import Table from '@mui/material/Table'
3
4
  import TableBody from '@mui/material/TableBody'
@@ -27,7 +28,6 @@ export interface ITicketTypes {
27
28
  is_on_sale?: boolean;
28
29
  event_name: string;
29
30
  currency: string;
30
- resale_fee_amount: number | string;
31
31
  ticket_type_hash: string;
32
32
  ticket_type_is_active?: boolean;
33
33
  retain_amount_on_sale: number | string;
@@ -52,6 +52,11 @@ interface TicketsTableTypes {
52
52
  displayColumnNameInRow?: boolean;
53
53
  }
54
54
 
55
+ type PdfDownload = {
56
+ hash: string;
57
+ loading: boolean;
58
+ }
59
+
55
60
  const TicketsTable = ({
56
61
  tickets = [],
57
62
  columns = [],
@@ -61,11 +66,20 @@ const TicketsTable = ({
61
66
  displayColumnNameInRow = false,
62
67
  }: TicketsTableTypes) => {
63
68
  const [pdfError, setPdfError] = useState<string | null>(null)
69
+ const [pdfDownload, setPdfDownload] = useState<PdfDownload>({
70
+ hash: '',
71
+ loading: false,
72
+ })
64
73
 
65
74
  const getRow = (ticket: ITicketTypes) =>
66
75
  _map(columns, (column, columnIndex) => {
67
76
  if (column.key === 'download') {
68
- if (ticket.pdf_link && ticket.status === 'Sold') return null
77
+ const ticketIsDownloading =
78
+ pdfDownload.loading && pdfDownload.hash === ticket.hash
79
+
80
+ if (!ticket.pdf_link || ticket.status === 'Sold' || ticket.is_on_sale)
81
+ return null
82
+
69
83
  return (
70
84
  <TableCell key={columnIndex}>
71
85
  {Boolean(icon) && <img src={icon} alt="nodata" />}
@@ -73,6 +87,11 @@ const TicketsTable = ({
73
87
  aria-hidden={true}
74
88
  className="action-button"
75
89
  onClick={async () => {
90
+ if (ticketIsDownloading) {
91
+ return
92
+ }
93
+
94
+ setPdfDownload({ hash: ticket.hash, loading: true })
76
95
  try {
77
96
  const pdfDownloadError = await downloadPDF(ticket.pdf_link)
78
97
  if (pdfDownloadError) {
@@ -82,10 +101,16 @@ const TicketsTable = ({
82
101
  if (err && typeof err === 'string') {
83
102
  setPdfError(err)
84
103
  }
104
+ } finally {
105
+ setPdfDownload({ hash: '', loading: false })
85
106
  }
86
107
  }}
87
108
  >
88
- Download
109
+ {ticketIsDownloading ? (
110
+ <CircularProgress size="22px" />
111
+ ) : (
112
+ 'Download'
113
+ )}
89
114
  </span>
90
115
  </TableCell>
91
116
  )
@@ -81,7 +81,7 @@ export const TicketResaleModal = ({
81
81
  onSubmit = () => { },
82
82
  loading = false
83
83
  }: Props) => {
84
- const { hash, holder_name, event_name, currency, resale_fee_amount, retain_amount_on_sale, ticket_type_is_active } = ticket
84
+ const { hash, holder_name, event_name, currency, retain_amount_on_sale, ticket_type_is_active } = ticket
85
85
 
86
86
  return (
87
87
  <Modal
@@ -198,7 +198,6 @@ export const TicketResaleModal = ({
198
198
  <p>I confirm that I want to sell this ticket and that, if someone chooses to buy it, I will no longer own it or have the right to ask for it back.</p>
199
199
  <p>I also understand that, if no one chooses to buy it, it remains my property, is valid for entry to <strong>{event_name}</strong> and I will not receive any refund.</p>
200
200
  <p>If my ticket is sold, the original card I used to buy my ticket will be refunded with the original amount paid, minus a small handling fee of <strong>{`${currency ?? ''} ${retain_amount_on_sale ?? '0'}`}</strong>, and that any existing refunds due to me for referring sales for this event are no longer valid.</p>
201
- <p>In order to receive the refund, I agree to pay a fee of <strong>{`${currency ?? ''} ${resale_fee_amount ?? '0'}`}</strong>.</p>
202
201
  <Field
203
202
  name='confirm'
204
203
  label='I agree'
@@ -5,7 +5,7 @@ export const getQueryVariable = (variable: string) => {
5
5
  for (let i = 0; i < vars.length; i++) {
6
6
  const pair = vars[i].split('=')
7
7
  if (pair[0] === variable) {
8
- return pair[1]
8
+ return decodeURIComponent(pair[1])
9
9
  }
10
10
  }
11
11
  }