tf-checkout-react 1.4.21-beta.2 → 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.
@@ -20,6 +20,8 @@ export interface IBillingInfoPage {
20
20
  onGetStatesError?: (e: AxiosError) => void;
21
21
  onGetProfileDataSuccess?: (res: any) => void;
22
22
  onGetProfileDataError?: (e: AxiosError) => void;
23
+ onGetCheckoutConfigsSuccess?: (res: any) => void;
24
+ onGetCheckoutConfigsError?: (e: AxiosError) => void;
23
25
  onLogin?: () => void;
24
26
  onLoginSuccess?: () => void;
25
27
  onErrorClose?: () => void;
@@ -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;
@@ -3842,7 +3842,11 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3842
3842
  _ref4$isCountryCodeEd = _ref4.isCountryCodeEditable,
3843
3843
  isCountryCodeEditable = _ref4$isCountryCodeEd === void 0 ? true : _ref4$isCountryCodeEd,
3844
3844
  _ref4$onPendingVerifi = _ref4.onPendingVerification,
3845
- onPendingVerification = _ref4$onPendingVerifi === void 0 ? _identity : _ref4$onPendingVerifi;
3845
+ onPendingVerification = _ref4$onPendingVerifi === void 0 ? _identity : _ref4$onPendingVerifi,
3846
+ _ref4$onGetCheckoutCo = _ref4.onGetCheckoutConfigsSuccess,
3847
+ onGetCheckoutConfigsSuccess = _ref4$onGetCheckoutCo === void 0 ? _identity : _ref4$onGetCheckoutCo,
3848
+ _ref4$onGetCheckoutCo2 = _ref4.onGetCheckoutConfigsError,
3849
+ onGetCheckoutConfigsError = _ref4$onGetCheckoutCo2 === void 0 ? _identity : _ref4$onGetCheckoutCo2;
3846
3850
  var _useState = React.useState(null),
3847
3851
  extraData = _useState[0],
3848
3852
  setExtraData = _useState[1];
@@ -3869,8 +3873,10 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3869
3873
  setConfigs(data.data.attributes);
3870
3874
  setIsConfigLoading(false);
3871
3875
  }
3872
- })["catch"](function () {
3876
+ onGetCheckoutConfigsSuccess(data);
3877
+ })["catch"](function (e) {
3873
3878
  setIsConfigLoading(false);
3879
+ onGetCheckoutConfigsError(e);
3874
3880
  });
3875
3881
  }, [isBrowser]);
3876
3882
  var defaultCountry = isBrowser ? window.localStorage.getItem('eventCountry') : '';
@@ -4210,6 +4216,18 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
4210
4216
  // Delete from values list
4211
4217
  delete checkoutBody.attributes[key];
4212
4218
  });
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];
4230
+ });
4213
4231
  // Collect data_capture for Ticket Holders Fields
4214
4232
  _forEach(checkoutBody.attributes.ticket_holders, function (holder, holderIndex) {
4215
4233
  var holderDataCapture = {};
@@ -8071,6 +8089,19 @@ var CustomFieldsForm = function CustomFieldsForm(_ref) {
8071
8089
  });
8072
8090
  };
8073
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
+ };
8074
8105
  var renderCustomFieldValue = function renderCustomFieldValue(customField) {
8075
8106
  if (customField.type === 'checkbox') {
8076
8107
  return customField.value ? 'Checked' : 'Unchecked';
@@ -8078,8 +8109,8 @@ var renderCustomFieldValue = function renderCustomFieldValue(customField) {
8078
8109
  if (_isEmpty(customField.value)) {
8079
8110
  return 'N/A';
8080
8111
  }
8081
- if (_isArray(customField.value)) {
8082
- return customField.value.join(', ');
8112
+ if (customField.type === 'select' || customField.type === 'select_multi' || customField.type === 'radio') {
8113
+ return getLabelForValue(customField.options, customField.value);
8083
8114
  }
8084
8115
  return customField.value;
8085
8116
  };
@@ -8148,7 +8179,7 @@ var TicketHolderCustomFields = function TicketHolderCustomFields(_ref) {
8148
8179
  }
8149
8180
  return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
8150
8181
  className: "holder-custom-fields"
8151
- }, React__default.createElement(SVG, {
8182
+ }, !_isEmpty(allowedHolderCustomFields) && React__default.createElement(SVG, {
8152
8183
  src: EditSvg,
8153
8184
  onClick: function onClick() {
8154
8185
  return setShowHolderCustomFieldsSection(true);
@@ -8962,19 +8993,19 @@ var TicketResaleContainer = function TicketResaleContainer(_ref) {
8962
8993
  setSuccessMessage = _useState2[1];
8963
8994
  React.useEffect(function () {
8964
8995
  _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8965
- 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;
8966
8997
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8967
8998
  while (1) switch (_context.prev = _context.next) {
8968
8999
  case 0:
8969
9000
  if (!isWindowDefined) {
8970
- _context.next = 34;
9001
+ _context.next = 35;
8971
9002
  break;
8972
9003
  }
8973
9004
  params = new URL("" + window.location).searchParams;
8974
9005
  hash = params.get('invitation_hash') || orderHash || null;
8975
9006
  isDeclined = params.get('decline') || false;
8976
9007
  if (!hash) {
8977
- _context.next = 33;
9008
+ _context.next = 34;
8978
9009
  break;
8979
9010
  }
8980
9011
  if (!isDeclined) {
@@ -9003,25 +9034,26 @@ var TicketResaleContainer = function TicketResaleContainer(_ref) {
9003
9034
  return processTicket(hash);
9004
9035
  case 22:
9005
9036
  _response = _context.sent;
9037
+ event_id = _get(_response.data.data.attributes, 'event_id');
9006
9038
  onProcessTicketSuccess(_response.data);
9007
- window.location.href = "" + (billingPath != null ? billingPath : '/billing/billing-info/');
9008
- _context.next = 31;
9039
+ window.location.href = (billingPath != null ? billingPath : '/billing/billing-info') + "?event_id=" + event_id;
9040
+ _context.next = 32;
9009
9041
  break;
9010
- case 27:
9011
- _context.prev = 27;
9042
+ case 28:
9043
+ _context.prev = 28;
9012
9044
  _context.t1 = _context["catch"](19);
9013
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);
9014
9046
  onProcessTicketError(_context.t1.response);
9015
- case 31:
9016
- _context.next = 34;
9047
+ case 32:
9048
+ _context.next = 35;
9017
9049
  break;
9018
- case 33:
9019
- window.location.href = '/';
9020
9050
  case 34:
9051
+ window.location.href = '/';
9052
+ case 35:
9021
9053
  case "end":
9022
9054
  return _context.stop();
9023
9055
  }
9024
- }, _callee, null, [[6, 14], [19, 27]]);
9056
+ }, _callee, null, [[6, 14], [19, 28]]);
9025
9057
  }))();
9026
9058
  }, []);
9027
9059
  return React__default.createElement("div", {