tf-checkout-react 1.3.39-beta.1 → 1.3.39-beta.3
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/dist/hooks/usePixel.d.ts +1 -1
- package/dist/tf-checkout-react.cjs.development.js +43 -14
- package/dist/tf-checkout-react.cjs.development.js.map +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js +1 -1
- package/dist/tf-checkout-react.cjs.production.min.js.map +1 -1
- package/dist/tf-checkout-react.esm.js +43 -14
- package/dist/tf-checkout-react.esm.js.map +1 -1
- package/dist/utils/htmlNodeFromString.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/confirmationContainer/index.tsx +1 -1
- package/src/components/ticketsContainer/index.tsx +1 -1
- package/src/hooks/usePixel.ts +23 -5
- package/src/utils/htmlNodeFromString.ts +1 -1
package/dist/hooks/usePixel.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const usePixel: (key: string, eventId: string | number) => Promise<void>;
|
|
1
|
+
export declare const usePixel: (key: string, eventId: string | number, alreadyLoadedEventData?: any) => Promise<void>;
|
|
@@ -1212,7 +1212,7 @@ var createElementFromHTML = function createElementFromHTML(htmlString) {
|
|
|
1212
1212
|
var div = document.createElement('div');
|
|
1213
1213
|
div.innerHTML = htmlString.trim(); // Change this to div.childNodes to support multiple top-level nodes.
|
|
1214
1214
|
|
|
1215
|
-
return div.
|
|
1215
|
+
return div.childNodes || [];
|
|
1216
1216
|
};
|
|
1217
1217
|
|
|
1218
1218
|
var isWindowDefined = typeof window !== 'undefined';
|
|
@@ -1617,7 +1617,7 @@ var getCheckoutPageConfigs = /*#__PURE__*/function () {
|
|
|
1617
1617
|
}();
|
|
1618
1618
|
|
|
1619
1619
|
var usePixel = /*#__PURE__*/function () {
|
|
1620
|
-
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(key, eventId) {
|
|
1620
|
+
var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(key, eventId, alreadyLoadedEventData) {
|
|
1621
1621
|
var getEventData;
|
|
1622
1622
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1623
1623
|
while (1) {
|
|
@@ -1627,24 +1627,53 @@ var usePixel = /*#__PURE__*/function () {
|
|
|
1627
1627
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1628
1628
|
var _document;
|
|
1629
1629
|
|
|
1630
|
-
var eventResponse, event, pixel;
|
|
1630
|
+
var isEventDataUndefined, eventResponse, event, pixel, nodes, i;
|
|
1631
1631
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1632
1632
|
while (1) {
|
|
1633
1633
|
switch (_context.prev = _context.next) {
|
|
1634
1634
|
case 0:
|
|
1635
|
-
|
|
1636
|
-
|
|
1635
|
+
if (eventId) {
|
|
1636
|
+
_context.next = 2;
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
return _context.abrupt("return");
|
|
1637
1641
|
|
|
1638
1642
|
case 2:
|
|
1639
|
-
|
|
1640
|
-
event
|
|
1643
|
+
// Check if event data object passed or not. If not then the value will be undefined.
|
|
1644
|
+
// If event data passed, then it's initial value will be null.
|
|
1645
|
+
isEventDataUndefined = alreadyLoadedEventData === undefined;
|
|
1646
|
+
|
|
1647
|
+
if (!isEventDataUndefined) {
|
|
1648
|
+
_context.next = 9;
|
|
1649
|
+
break;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
_context.next = 6;
|
|
1653
|
+
return getEvent(eventId);
|
|
1654
|
+
|
|
1655
|
+
case 6:
|
|
1656
|
+
_context.t0 = _context.sent;
|
|
1657
|
+
_context.next = 10;
|
|
1658
|
+
break;
|
|
1659
|
+
|
|
1660
|
+
case 9:
|
|
1661
|
+
_context.t0 = null;
|
|
1662
|
+
|
|
1663
|
+
case 10:
|
|
1664
|
+
eventResponse = _context.t0;
|
|
1665
|
+
event = isEventDataUndefined ? _get(eventResponse, 'data.data.attributes', {}) : alreadyLoadedEventData || {};
|
|
1641
1666
|
pixel = event[key];
|
|
1642
1667
|
|
|
1643
1668
|
if ((_document = document) != null && _document.head && pixel) {
|
|
1644
|
-
|
|
1669
|
+
nodes = createElementFromHTML(pixel);
|
|
1670
|
+
|
|
1671
|
+
for (i = 0; i < nodes.length; i++) {
|
|
1672
|
+
document.head.append(nodes[i]);
|
|
1673
|
+
}
|
|
1645
1674
|
}
|
|
1646
1675
|
|
|
1647
|
-
case
|
|
1676
|
+
case 14:
|
|
1648
1677
|
case "end":
|
|
1649
1678
|
return _context.stop();
|
|
1650
1679
|
}
|
|
@@ -1658,8 +1687,8 @@ var usePixel = /*#__PURE__*/function () {
|
|
|
1658
1687
|
}();
|
|
1659
1688
|
|
|
1660
1689
|
React.useEffect(function () {
|
|
1661
|
-
getEventData();
|
|
1662
|
-
}, []);
|
|
1690
|
+
getEventData(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1691
|
+
}, [eventId, alreadyLoadedEventData]);
|
|
1663
1692
|
|
|
1664
1693
|
case 2:
|
|
1665
1694
|
case "end":
|
|
@@ -1669,7 +1698,7 @@ var usePixel = /*#__PURE__*/function () {
|
|
|
1669
1698
|
}, _callee2);
|
|
1670
1699
|
}));
|
|
1671
1700
|
|
|
1672
|
-
return function usePixel(_x, _x2) {
|
|
1701
|
+
return function usePixel(_x, _x2, _x3) {
|
|
1673
1702
|
return _ref.apply(this, arguments);
|
|
1674
1703
|
};
|
|
1675
1704
|
}();
|
|
@@ -5057,7 +5086,7 @@ var ConfirmationContainer = function ConfirmationContainer(_ref) {
|
|
|
5057
5086
|
confirmationMain = _confirmationLabels$c2 === void 0 ? 'Your tickets are available in My Tickets section' : _confirmationLabels$c2,
|
|
5058
5087
|
_confirmationLabels$c3 = confirmationLabels.confirmationHelper,
|
|
5059
5088
|
confirmationHelper = _confirmationLabels$c3 === void 0 ? 'Please bring them with you to the event' : _confirmationLabels$c3;
|
|
5060
|
-
usePixel('conversionPixels', data.product_id);
|
|
5089
|
+
usePixel('conversionPixels', data == null ? void 0 : data.product_id);
|
|
5061
5090
|
return React__default.createElement("div", {
|
|
5062
5091
|
className: "confirmation-page"
|
|
5063
5092
|
}, data && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
@@ -5921,7 +5950,7 @@ var TicketsContainer = function TicketsContainer(_ref) {
|
|
|
5921
5950
|
useCookieListener(X_TF_ECOMMERCE, function (value) {
|
|
5922
5951
|
return setIsLogged(Boolean(value));
|
|
5923
5952
|
});
|
|
5924
|
-
usePixel('pagePixels', eventId);
|
|
5953
|
+
usePixel('pagePixels', eventId, event);
|
|
5925
5954
|
React.useEffect(function () {
|
|
5926
5955
|
if (typeof window !== 'undefined') {
|
|
5927
5956
|
var access_token = window.localStorage.getItem('access_token');
|