tf-checkout-react 1.3.39-beta.3 → 1.3.40

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.
@@ -1 +1 @@
1
- export declare const usePixel: (key: string, eventId: string | number, alreadyLoadedEventData?: any) => Promise<void>;
1
+ export declare const usePixel: (key: string | string[], eventId: string | number, alreadyLoadedEventData?: any) => Promise<void>;
@@ -1618,16 +1618,27 @@ var getCheckoutPageConfigs = /*#__PURE__*/function () {
1618
1618
 
1619
1619
  var usePixel = /*#__PURE__*/function () {
1620
1620
  var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(key, eventId, alreadyLoadedEventData) {
1621
- var getEventData;
1621
+ var addPixel, getEventData;
1622
1622
  return runtime_1.wrap(function _callee2$(_context2) {
1623
1623
  while (1) {
1624
1624
  switch (_context2.prev = _context2.next) {
1625
1625
  case 0:
1626
+ addPixel = function addPixel(pixel) {
1627
+ var _document;
1628
+
1629
+ if ((_document = document) != null && _document.head && pixel) {
1630
+ var nodes = createElementFromHTML(pixel);
1631
+
1632
+ for (var _i = 0, _Array$from = Array.from(nodes); _i < _Array$from.length; _i++) {
1633
+ var element = _Array$from[_i];
1634
+ document.head.append(element);
1635
+ }
1636
+ }
1637
+ };
1638
+
1626
1639
  getEventData = /*#__PURE__*/function () {
1627
1640
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
1628
- var _document;
1629
-
1630
- var isEventDataUndefined, eventResponse, event, pixel, nodes, i;
1641
+ var isEventDataUndefined, eventResponse, event, pixel;
1631
1642
  return runtime_1.wrap(function _callee$(_context) {
1632
1643
  while (1) {
1633
1644
  switch (_context.prev = _context.next) {
@@ -1663,17 +1674,18 @@ var usePixel = /*#__PURE__*/function () {
1663
1674
  case 10:
1664
1675
  eventResponse = _context.t0;
1665
1676
  event = isEventDataUndefined ? _get(eventResponse, 'data.data.attributes', {}) : alreadyLoadedEventData || {};
1666
- pixel = event[key];
1667
1677
 
1668
- if ((_document = document) != null && _document.head && pixel) {
1669
- nodes = createElementFromHTML(pixel);
1670
-
1671
- for (i = 0; i < nodes.length; i++) {
1672
- document.head.append(nodes[i]);
1673
- }
1678
+ if (typeof key === 'string') {
1679
+ pixel = event[key];
1680
+ addPixel(pixel);
1681
+ } else {
1682
+ _forEach(key, function (item) {
1683
+ var pixel = event[item];
1684
+ addPixel(pixel);
1685
+ });
1674
1686
  }
1675
1687
 
1676
- case 14:
1688
+ case 13:
1677
1689
  case "end":
1678
1690
  return _context.stop();
1679
1691
  }
@@ -1690,7 +1702,7 @@ var usePixel = /*#__PURE__*/function () {
1690
1702
  getEventData(); // eslint-disable-next-line react-hooks/exhaustive-deps
1691
1703
  }, [eventId, alreadyLoadedEventData]);
1692
1704
 
1693
- case 2:
1705
+ case 3:
1694
1706
  case "end":
1695
1707
  return _context2.stop();
1696
1708
  }
@@ -3668,7 +3680,7 @@ var BillingInfoContainer = /*#__PURE__*/React__default.memo(function (_ref4) {
3668
3680
  return item.code.toLowerCase() === defaultCountry;
3669
3681
  }) || {};
3670
3682
  var initialCountry = selectedCountry.id || _get(userData, 'country', '') || '1';
3671
- usePixel('checkoutPixels', eventId);
3683
+ usePixel(['checkoutPixels', 'brandCheckoutPixels'], eventId);
3672
3684
  return React__default.createElement(styles.ThemeProvider, {
3673
3685
  theme: themeMui
3674
3686
  }, (loading || isCountriesLoading) && React__default.createElement(Backdrop, {
@@ -5086,7 +5098,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
5086
5098
  confirmationMain = _confirmationLabels$c2 === void 0 ? 'Your tickets are available in My Tickets section' : _confirmationLabels$c2,
5087
5099
  _confirmationLabels$c3 = confirmationLabels.confirmationHelper,
5088
5100
  confirmationHelper = _confirmationLabels$c3 === void 0 ? 'Please bring them with you to the event' : _confirmationLabels$c3;
5089
- usePixel('conversionPixels', data == null ? void 0 : data.product_id);
5101
+ usePixel(['conversionPixels', 'brandConversionPixels'], data == null ? void 0 : data.product_id);
5090
5102
  return React__default.createElement("div", {
5091
5103
  className: "confirmation-page"
5092
5104
  }, data && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
@@ -5950,7 +5962,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
5950
5962
  useCookieListener(X_TF_ECOMMERCE, function (value) {
5951
5963
  return setIsLogged(Boolean(value));
5952
5964
  });
5953
- usePixel('pagePixels', eventId, event);
5965
+ usePixel(['pagePixels', 'brandPagePixels'], eventId, event);
5954
5966
  React.useEffect(function () {
5955
5967
  if (typeof window !== 'undefined') {
5956
5968
  var access_token = window.localStorage.getItem('access_token');