tf-checkout-react 1.3.38 → 1.3.39-beta.2

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.
@@ -24,4 +24,4 @@ export interface IConfirmationPage {
24
24
  orderHash?: string;
25
25
  confirmationLabels: IConfirmationLabels;
26
26
  }
27
- export declare const ConfirmationContainer: ({ confirmationLabels, hasCopyIcon, isReferralEnabled, showDefaultShareButtons, messengerAppId, shareButtons, onGetConfirmationDataSuccess, onGetConfirmationDataError, orderHash, onLinkCopied }: IConfirmationPage) => JSX.Element;
27
+ export declare const ConfirmationContainer: ({ confirmationLabels, hasCopyIcon, isReferralEnabled, showDefaultShareButtons, messengerAppId, shareButtons, onGetConfirmationDataSuccess, onGetConfirmationDataError, orderHash, onLinkCopied, }: IConfirmationPage) => JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const usePixel: (key: string, eventId: string | number) => Promise<void>;
@@ -1208,6 +1208,13 @@ var setLoggedUserData = function setLoggedUserData(data) {
1208
1208
  };
1209
1209
  };
1210
1210
 
1211
+ var createElementFromHTML = function createElementFromHTML(htmlString) {
1212
+ var div = document.createElement('div');
1213
+ div.innerHTML = htmlString.trim(); // Change this to div.childNodes to support multiple top-level nodes.
1214
+
1215
+ return div.firstChild || '';
1216
+ };
1217
+
1211
1218
  var isWindowDefined = typeof window !== 'undefined';
1212
1219
  var isDocumentDefined = typeof document !== 'undefined';
1213
1220
 
@@ -1609,6 +1616,64 @@ var getCheckoutPageConfigs = /*#__PURE__*/function () {
1609
1616
  };
1610
1617
  }();
1611
1618
 
1619
+ var usePixel = /*#__PURE__*/function () {
1620
+ var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(key, eventId) {
1621
+ var getEventData;
1622
+ return runtime_1.wrap(function _callee2$(_context2) {
1623
+ while (1) {
1624
+ switch (_context2.prev = _context2.next) {
1625
+ case 0:
1626
+ getEventData = /*#__PURE__*/function () {
1627
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1628
+ var _document;
1629
+
1630
+ var eventResponse, event, pixel;
1631
+ return runtime_1.wrap(function _callee$(_context) {
1632
+ while (1) {
1633
+ switch (_context.prev = _context.next) {
1634
+ case 0:
1635
+ _context.next = 2;
1636
+ return getEvent(eventId);
1637
+
1638
+ case 2:
1639
+ eventResponse = _context.sent;
1640
+ event = _get(eventResponse, 'data.data.attributes');
1641
+ pixel = event[key];
1642
+
1643
+ if ((_document = document) != null && _document.head && pixel) {
1644
+ document.head.append(createElementFromHTML(pixel));
1645
+ }
1646
+
1647
+ case 6:
1648
+ case "end":
1649
+ return _context.stop();
1650
+ }
1651
+ }
1652
+ }, _callee);
1653
+ }));
1654
+
1655
+ return function getEventData() {
1656
+ return _ref2.apply(this, arguments);
1657
+ };
1658
+ }();
1659
+
1660
+ React.useEffect(function () {
1661
+ getEventData();
1662
+ }, []);
1663
+
1664
+ case 2:
1665
+ case "end":
1666
+ return _context2.stop();
1667
+ }
1668
+ }
1669
+ }, _callee2);
1670
+ }));
1671
+
1672
+ return function usePixel(_x, _x2) {
1673
+ return _ref.apply(this, arguments);
1674
+ };
1675
+ }();
1676
+
1612
1677
  var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
1613
1678
  var combineValidators = function combineValidators() {
1614
1679
  for (var _len = arguments.length, validators = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -3271,7 +3336,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3271
3336
 
3272
3337
  var showDOB = getQueryVariable('age_required') === 'true';
3273
3338
  var showTicketHolders = getQueryVariable('names_required') === 'true';
3274
- var eventId = getQueryVariable('event_id');
3339
+ var eventId = getQueryVariable('event_id') || '';
3275
3340
  var optedInFieldValue = brandOptIn ? brandOptIn : _get(cartInfoData, 'optedIn', false);
3276
3341
  var ttfOptIn = Boolean(_get(cartInfoData, 'ttfOptIn', false));
3277
3342
 
@@ -3574,6 +3639,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3574
3639
  return item.code.toLowerCase() === defaultCountry;
3575
3640
  }) || {};
3576
3641
  var initialCountry = selectedCountry.id || _get(userData, 'country', '') || '1';
3642
+ usePixel('checkoutPixels', eventId);
3577
3643
  return React__default.createElement(styles.ThemeProvider, {
3578
3644
  theme: themeMui
3579
3645
  }, (loading || isCountriesLoading) && React__default.createElement(Backdrop, {
@@ -4991,14 +5057,15 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
4991
5057
  confirmationMain = _confirmationLabels$c2 === void 0 ? 'Your tickets are available in My Tickets section' : _confirmationLabels$c2,
4992
5058
  _confirmationLabels$c3 = confirmationLabels.confirmationHelper,
4993
5059
  confirmationHelper = _confirmationLabels$c3 === void 0 ? 'Please bring them with you to the event' : _confirmationLabels$c3;
5060
+ usePixel('conversionPixels', data == null ? void 0 : data.product_id);
4994
5061
  return React__default.createElement("div", {
4995
5062
  className: "confirmation-page"
4996
5063
  }, data && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
4997
- className: 'header-container'
5064
+ className: "header-container"
4998
5065
  }, React__default.createElement("div", {
4999
- className: 'header-product-image'
5066
+ className: "header-product-image"
5000
5067
  }, React__default.createElement("img", {
5001
- className: 'product-image',
5068
+ className: "product-image",
5002
5069
  src: data.product_image
5003
5070
  })), React__default.createElement("div", {
5004
5071
  className: "header-product-text"
@@ -5014,7 +5081,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5014
5081
  }, confirmationMain), React__default.createElement("span", {
5015
5082
  className: "helper"
5016
5083
  }, data.attach_tickets ? 'Please bring them with you to the event' : confirmationHelper))))), data.custom_confirmation_page_text && !data.custom_confirmation_page_text_full_replacement ? React__default.createElement("div", {
5017
- className: 'custom-confirmation-page-text',
5084
+ className: "custom-confirmation-page-text",
5018
5085
  dangerouslySetInnerHTML: createMarkup(data.custom_confirmation_page_text)
5019
5086
  }) : null, data.disable_referral === false && isReferralEnabled && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
5020
5087
  className: "referral_text_image_section"
@@ -5033,7 +5100,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5033
5100
  }, " Invite friends "), "and we'll refund up to", React__default.createElement("span", {
5034
5101
  className: "strong-text"
5035
5102
  }, " 100% "), "of your ticket money, if they buy tickets as well!")), React__default.createElement("img", {
5036
- className: 'body-product-image',
5103
+ className: "body-product-image",
5037
5104
  src: data.product_image,
5038
5105
  alt: "No Data"
5039
5106
  })), React__default.createElement("div", {
@@ -5067,7 +5134,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5067
5134
  src: "https://img.icons8.com/office/50/000000/copy.png",
5068
5135
  alt: "copy"
5069
5136
  }) : React__default.createElement("span", {
5070
- className: 'copy-icon'
5137
+ className: "copy-icon"
5071
5138
  }, "Copy")))), (showDefaultShareButtons || !!shareButtons.length) && React__default.createElement(SocialButtons, {
5072
5139
  showDefaultShareButtons: showDefaultShareButtons,
5073
5140
  name: data.product_name,
@@ -5854,6 +5921,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5854
5921
  useCookieListener(X_TF_ECOMMERCE, function (value) {
5855
5922
  return setIsLogged(Boolean(value));
5856
5923
  });
5924
+ usePixel('pagePixels', eventId);
5857
5925
  React.useEffect(function () {
5858
5926
  if (typeof window !== 'undefined') {
5859
5927
  var access_token = window.localStorage.getItem('access_token');