tf-checkout-react 1.4.21-beta.3 → 1.4.21-beta.5

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.
@@ -30,6 +30,12 @@ interface OrderDetailsTypes {
30
30
  itemsTitle?: string;
31
31
  ticketsTitle?: string;
32
32
  }
33
+ export interface CustomFieldOption {
34
+ id: string;
35
+ name: string;
36
+ value: string;
37
+ order: string;
38
+ }
33
39
  export interface CustomFieldTypes {
34
40
  description: string;
35
41
  enabled: string;
@@ -46,6 +52,7 @@ export interface CustomFieldTypes {
46
52
  type: string;
47
53
  value: string | Array<string>;
48
54
  ticketHash?: string;
55
+ options?: CustomFieldOption[];
49
56
  }
50
57
  export declare const OrderDetailsContainer: ({ columns, onGetOrdersSuccess, onGetOrdersError, onRemoveFromResaleSuccess, onRemoveFromResaleError, onResaleTicketSuccess, onResaleTicketError, onUpdateOrderCustomFieldsSuccess, onUpdateOrderCustomFieldsError, onUpdateTicketHolderCustomFieldsSuccess, onUpdateTicketHolderCustomFieldsError, onReturnButtonClick, personalLinkIcon, displayColumnNameInRow, canSellTicket, ticketsTableColumns, ordersPath, orderId: pOrderId, referralTitle, itemsTitle, ticketsTitle, }: OrderDetailsTypes) => JSX.Element;
51
58
  export {};
@@ -1,5 +1,5 @@
1
1
  import { CustomFieldTypes } from '../index';
2
- export declare const renderCustomFieldValue: (customField: CustomFieldTypes) => string;
2
+ export declare const renderCustomFieldValue: (customField: CustomFieldTypes) => string | string[];
3
3
  export declare const isFieldUpdatable: (field: CustomFieldTypes) => boolean;
4
4
  export declare const createCustomFieldsUpdateBody: (updatedValues: Record<string, any>, notUpdatableCustomFieldsValues?: Array<CustomFieldTypes>) => {
5
5
  [x: string]: any;
@@ -4194,7 +4194,6 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
4194
4194
  collectPaymentData();
4195
4195
  }, [skipPage, ticketsQuantity]);
4196
4196
  var collectCheckoutBody = function collectCheckoutBody(values, profileData) {
4197
- var _checkoutBody$attribu, _checkoutBody$attribu2, _checkoutBody$attribu3, _checkoutBody$attribu4, _checkoutBody$attribu5;
4198
4197
  var checkoutBody = {};
4199
4198
  // Auto collect ticket holders name when it was skipped optionally
4200
4199
  if (showDOB && !showTicketHolders && canSkipHolderNames) {
@@ -4217,20 +4216,18 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
4217
4216
  // Delete from values list
4218
4217
  delete checkoutBody.attributes[key];
4219
4218
  });
4220
- // Temp solution for hardcoded data capture values, to be deleted in future
4221
- data_capture = _extends({}, data_capture, {
4222
- instagram: _get(values, 'data_capture.instagram', ''),
4223
- company: _get(values, 'data_capture.company', ''),
4224
- businessCategory: _get(values, 'data_capture.businessCategory', ''),
4225
- jobTitle: _get(values, 'data_capture.jobTitle', ''),
4226
- wallet_address: _get(values, 'data_capture.wallet_address', '')
4219
+ // Temp solution for hardcoded data capture values, to be deleted in the future
4220
+ var captureKeys = ['businessCategory', 'company', 'instagram', 'jobTitle', 'wallet_address'];
4221
+ captureKeys.forEach(function (key) {
4222
+ var _checkoutBody$attribu;
4223
+ var path = "data_capture." + key;
4224
+ var value = _get(values, path, '');
4225
+ if (value !== '') {
4226
+ data_capture[key] = value;
4227
+ }
4228
+ var attributeKey = "data_capture[" + key + "]";
4229
+ (_checkoutBody$attribu = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu[attributeKey];
4227
4230
  });
4228
- // Temp solution for hardcoded data capture values, to be deleted in future
4229
- (_checkoutBody$attribu = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu['data_capture[businessCategory]'];
4230
- (_checkoutBody$attribu2 = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu2['data_capture[company]'];
4231
- (_checkoutBody$attribu3 = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu3['data_capture[instagram]'];
4232
- (_checkoutBody$attribu4 = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu4['data_capture[jobTitle]'];
4233
- (_checkoutBody$attribu5 = checkoutBody.attributes) == null ? true : delete _checkoutBody$attribu5['data_capture[wallet_address]'];
4234
4231
  // Collect data_capture for Ticket Holders Fields
4235
4232
  _forEach(checkoutBody.attributes.ticket_holders, function (holder, holderIndex) {
4236
4233
  var holderDataCapture = {};
@@ -8092,6 +8089,19 @@ var CustomFieldsForm = function CustomFieldsForm(_ref) {
8092
8089
  });
8093
8090
  };
8094
8091
 
8092
+ var getLabelForValue = function getLabelForValue(options, value) {
8093
+ var getLabel = function getLabel(singleValue) {
8094
+ var option = options.find(function (option) {
8095
+ return option.value === singleValue;
8096
+ });
8097
+ return option ? option.name : '';
8098
+ };
8099
+ if (_isArray(value)) {
8100
+ var labels = value.map(getLabel);
8101
+ return labels.join(', ');
8102
+ }
8103
+ return getLabel(value);
8104
+ };
8095
8105
  var renderCustomFieldValue = function renderCustomFieldValue(customField) {
8096
8106
  if (customField.type === 'checkbox') {
8097
8107
  return customField.value ? 'Checked' : 'Unchecked';
@@ -8099,8 +8109,8 @@ var renderCustomFieldValue = function renderCustomFieldValue(customField) {
8099
8109
  if (_isEmpty(customField.value)) {
8100
8110
  return 'N/A';
8101
8111
  }
8102
- if (_isArray(customField.value)) {
8103
- return customField.value.join(', ');
8112
+ if (customField.type === 'select' || customField.type === 'select_multi' || customField.type === 'radio') {
8113
+ return getLabelForValue(customField.options, customField.value);
8104
8114
  }
8105
8115
  return customField.value;
8106
8116
  };
@@ -8169,7 +8179,7 @@ var TicketHolderCustomFields = function TicketHolderCustomFields(_ref) {
8169
8179
  }
8170
8180
  return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
8171
8181
  className: "holder-custom-fields"
8172
- }, React__default.createElement(SVG, {
8182
+ }, !_isEmpty(allowedHolderCustomFields) && React__default.createElement(SVG, {
8173
8183
  src: EditSvg,
8174
8184
  onClick: function onClick() {
8175
8185
  return setShowHolderCustomFieldsSection(true);
@@ -8983,19 +8993,19 @@ var TicketResaleContainer = function TicketResaleContainer(_ref) {
8983
8993
  setSuccessMessage = _useState2[1];
8984
8994
  React.useEffect(function () {
8985
8995
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8986
- var params, hash, isDeclined, response, _error$response, _error$response$data, _response, _error$response2, _error$response2$data;
8996
+ var params, hash, isDeclined, response, _error$response, _error$response$data, _response, event_id, _error$response2, _error$response2$data;
8987
8997
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8988
8998
  while (1) switch (_context.prev = _context.next) {
8989
8999
  case 0:
8990
9000
  if (!isWindowDefined) {
8991
- _context.next = 34;
9001
+ _context.next = 35;
8992
9002
  break;
8993
9003
  }
8994
9004
  params = new URL("" + window.location).searchParams;
8995
9005
  hash = params.get('invitation_hash') || orderHash || null;
8996
9006
  isDeclined = params.get('decline') || false;
8997
9007
  if (!hash) {
8998
- _context.next = 33;
9008
+ _context.next = 34;
8999
9009
  break;
9000
9010
  }
9001
9011
  if (!isDeclined) {
@@ -9024,25 +9034,26 @@ var TicketResaleContainer = function TicketResaleContainer(_ref) {
9024
9034
  return processTicket(hash);
9025
9035
  case 22:
9026
9036
  _response = _context.sent;
9037
+ event_id = _get(_response.data.data.attributes, 'event_id');
9027
9038
  onProcessTicketSuccess(_response.data);
9028
- window.location.href = "" + (billingPath != null ? billingPath : '/billing/billing-info/');
9029
- _context.next = 31;
9039
+ window.location.href = (billingPath != null ? billingPath : '/billing/billing-info') + "?event_id=" + event_id;
9040
+ _context.next = 32;
9030
9041
  break;
9031
- case 27:
9032
- _context.prev = 27;
9042
+ case 28:
9043
+ _context.prev = 28;
9033
9044
  _context.t1 = _context["catch"](19);
9034
9045
  setError(_context.t1 == null ? void 0 : (_error$response2 = _context.t1.response) == null ? void 0 : (_error$response2$data = _error$response2.data) == null ? void 0 : _error$response2$data.message);
9035
9046
  onProcessTicketError(_context.t1.response);
9036
- case 31:
9037
- _context.next = 34;
9047
+ case 32:
9048
+ _context.next = 35;
9038
9049
  break;
9039
- case 33:
9040
- window.location.href = '/';
9041
9050
  case 34:
9051
+ window.location.href = '/';
9052
+ case 35:
9042
9053
  case "end":
9043
9054
  return _context.stop();
9044
9055
  }
9045
- }, _callee, null, [[6, 14], [19, 27]]);
9056
+ }, _callee, null, [[6, 14], [19, 28]]);
9046
9057
  }))();
9047
9058
  }, []);
9048
9059
  return React__default.createElement("div", {