@times-components/article 7.20.4 → 7.21.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [7.21.0](https://github.com/newsuk/times-components/compare/@times-components/article@7.20.4...@times-components/article@7.21.0) (2025-11-04)
7
+
8
+
9
+ ### Features
10
+
11
+ * **TGGA-653:** added algolia conversion event ([#4228](https://github.com/newsuk/times-components/issues/4228)) ([c7553b2](https://github.com/newsuk/times-components/commit/c7553b266d39c7b7b8fc831669f0d896fe21ff63))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [7.20.4](https://github.com/newsuk/times-components/compare/@times-components/article@7.20.3...@times-components/article@7.20.4) (2025-11-03)
7
18
 
8
19
  **Note:** Version bump only for package @times-components/article
package/dist/article.js CHANGED
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = exports.TakeoverBailout = exports.templates = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _articleMagazineComment = _interopRequireDefault(require("@times-components/article-magazine-comment"));
11
11
 
@@ -25,10 +25,16 @@ var _tsStyleguide = require("@times-components/ts-styleguide");
25
25
 
26
26
  var _messageBar = require("@times-components/message-bar");
27
27
 
28
+ var _tsComponents = require("@times-components/ts-components");
29
+
28
30
  var _utils = require("./utils");
29
31
 
30
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
33
 
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
32
38
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
33
39
 
34
40
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -65,6 +71,16 @@ const Article = props => {
65
71
  leadAsset = _ref.leadAsset,
66
72
  template = _ref.template;
67
73
 
74
+ (0, _react.useEffect)(() => {
75
+ if (typeof window !== "undefined" && typeof localStorage !== "undefined") {
76
+ const conversionData = (0, _tsComponents.getValidConversionData)();
77
+
78
+ if (conversionData) {
79
+ (0, _tsComponents.trackAlgoliaConversionWithDwellTime)(conversionData);
80
+ }
81
+ }
82
+ }, []);
83
+
68
84
  let _ref2 = article || {},
69
85
  content = _ref2.content;
70
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-components/article",
3
- "version": "7.20.4",
3
+ "version": "7.21.0",
4
4
  "description": "The article",
5
5
  "main": "dist/article",
6
6
  "dev": "src/article",
@@ -36,9 +36,9 @@
36
36
  "@times-components/eslint-config-thetimes": "0.8.18",
37
37
  "@times-components/jest-configurator-web": "0.8.2",
38
38
  "@times-components/provider-test-tools": "1.33.3",
39
- "@times-components/storybook": "4.16.10",
39
+ "@times-components/storybook": "4.16.11",
40
40
  "@times-components/tealium-utils": "0.9.1",
41
- "@times-components/user-state": "0.7.19",
41
+ "@times-components/user-state": "0.7.20",
42
42
  "@times-components/webpack-configurator": "2.1.1",
43
43
  "babel-jest": "24.8.0",
44
44
  "babel-loader": "8.0.5",
@@ -52,18 +52,19 @@
52
52
  "webpack": "4.30.0"
53
53
  },
54
54
  "dependencies": {
55
- "@times-components/ad": "2.23.16",
56
- "@times-components/article-in-depth": "3.103.13",
57
- "@times-components/article-magazine-comment": "3.98.13",
58
- "@times-components/article-magazine-standard": "3.98.13",
59
- "@times-components/article-main-comment": "2.102.13",
60
- "@times-components/article-main-standard": "3.111.13",
61
- "@times-components/article-main-video": "1.20.10",
55
+ "@times-components/ad": "2.23.17",
56
+ "@times-components/article-in-depth": "3.103.14",
57
+ "@times-components/article-magazine-comment": "3.98.14",
58
+ "@times-components/article-magazine-standard": "3.98.14",
59
+ "@times-components/article-main-comment": "2.102.14",
60
+ "@times-components/article-main-standard": "3.111.14",
61
+ "@times-components/article-main-video": "1.20.11",
62
62
  "@times-components/context": "1.28.0",
63
- "@times-components/message-bar": "0.7.119",
64
- "@times-components/provider": "1.48.10",
65
- "@times-components/responsive": "0.31.2",
66
- "@times-components/ts-styleguide": "1.56.11"
63
+ "@times-components/message-bar": "0.7.120",
64
+ "@times-components/provider": "1.48.11",
65
+ "@times-components/responsive": "0.32.0",
66
+ "@times-components/ts-components": "1.141.0",
67
+ "@times-components/ts-styleguide": "1.56.12"
67
68
  },
68
69
  "resolutions": {
69
70
  "react": "16.9.0",
@@ -76,5 +77,5 @@
76
77
  "publishConfig": {
77
78
  "access": "public"
78
79
  },
79
- "gitHead": "29db6ddd0562d8fd54104934848460d48aca23f4"
80
+ "gitHead": "cbce3e9f9f5621262b1850877e8c94280b9999fe"
80
81
  }
package/rnw.js CHANGED
@@ -1 +1 @@
1
- module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=10)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/article-main-standard/rnw")},function(e,t){e.exports=require("@times-components/article-magazine-comment/rnw")},function(e,t){e.exports=require("@times-components/article-in-depth/rnw")},function(e,t){e.exports=require("@times-components/article-magazine-standard/rnw")},function(e,t){e.exports=require("@times-components/article-main-comment/rnw")},function(e,t){e.exports=require("@times-components/article-main-video/rnw")},function(e,t){e.exports=require("@times-components/responsive/rnw")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("@times-components/message-bar/rnw")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(2),i=n.n(a),c=n(3),s=n.n(c),u=n(4),l=n.n(u),m=n(1),p=n.n(m),f=n(5),d=n.n(f),b=n(6),g=n.n(b),v=n(7),y=n.n(v),O=n(8),j=n(9);function x(){return(x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"templates",(function(){return q})),n.d(t,"TakeoverBailout",(function(){return E}));const q={indepth:s.a,magazinecomment:i.a,magazinestandard:l.a,maincomment:d.a,mainstandard:p.a,mainvideo:g.a};class E extends Error{constructor(e){super(e),this.name="TakeoverBailout"}}t.default=e=>{const t=e.article,n=e.onImagePress,r=t||{},a=r.leadAsset,i=r.template;let c=(t||{}).content;if("takeoverpage"===i)throw new E("Aborted react render: Takeover page");let s=null;if(n){c=((e,t)=>{const n=e||[];let r=t?1:0;return n.forEach(e=>{const t=e;"image"!==t.name&&"video"!==t.name||(t.attributes.imageIndex=r,r+=1)}),n})(c,a);const e=((e,t)=>{const n=e||[];let r=0;const o=[];t&&(r+=1,o.push({index:0,name:"leadAsset",value:t}));return n.filter(e=>"image"===e.name||"video"===e.name).forEach(e=>{let t;if("video"===e.name){const n=e.attributes,o=n.caption,a=n.posterImageUrl;t={index:r,name:"inlineVideo",value:{caption:o,posterImageUrl:a}}}else t={index:r,name:"inlineImage",value:e.attributes};r+=1,o.push(t)}),o})(c,a);s=t=>n(t,e)}const u=q[i]||p.a,l=P(P({},e),{},{article:P(P({},t),{},{template:t&&t.template?t.template:"mainstandard"})});return o.a.createElement(y.a,null,o.a.createElement(j.MessageManager,{delay:3e3,scale:O.scales.medium},o.a.createElement(u,x({},l,{onImagePress:s}))))}}]);
1
+ module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/article-main-standard/rnw")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/article-magazine-comment/rnw")},function(e,t){e.exports=require("@times-components/article-in-depth/rnw")},function(e,t){e.exports=require("@times-components/article-magazine-standard/rnw")},function(e,t){e.exports=require("@times-components/article-main-comment/rnw")},function(e,t){e.exports=require("@times-components/article-main-video/rnw")},function(e,t){e.exports=require("@times-components/responsive/rnw")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("@times-components/message-bar/rnw")},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(3),i=n.n(a),c=n(4),s=n.n(c),u=n(5),l=n.n(u),m=n(1),p=n.n(m),f=n(6),d=n.n(f),b=n(7),g=n.n(b),v=n(8),y=n.n(v),O=n(9),j=n(10),w=n(2);function x(){return(x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){q(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"templates",(function(){return E})),n.d(t,"TakeoverBailout",(function(){return S}));const E={indepth:s.a,magazinecomment:i.a,magazinestandard:l.a,maincomment:d.a,mainstandard:p.a,mainvideo:g.a};class S extends Error{constructor(e){super(e),this.name="TakeoverBailout"}}t.default=e=>{const t=e.article,n=e.onImagePress,a=t||{},i=a.leadAsset,c=a.template;Object(r.useEffect)(()=>{if("undefined"!=typeof window&&"undefined"!=typeof localStorage){const e=Object(w.getValidConversionData)();e&&Object(w.trackAlgoliaConversionWithDwellTime)(e)}},[]);let s=(t||{}).content;if("takeoverpage"===c)throw new S("Aborted react render: Takeover page");let u=null;if(n){s=((e,t)=>{const n=e||[];let r=t?1:0;return n.forEach(e=>{const t=e;"image"!==t.name&&"video"!==t.name||(t.attributes.imageIndex=r,r+=1)}),n})(s,i);const e=((e,t)=>{const n=e||[];let r=0;const o=[];t&&(r+=1,o.push({index:0,name:"leadAsset",value:t}));return n.filter(e=>"image"===e.name||"video"===e.name).forEach(e=>{let t;if("video"===e.name){const n=e.attributes,o=n.caption,a=n.posterImageUrl;t={index:r,name:"inlineVideo",value:{caption:o,posterImageUrl:a}}}else t={index:r,name:"inlineImage",value:e.attributes};r+=1,o.push(t)}),o})(s,i);u=t=>n(t,e)}const l=E[c]||p.a,m=P(P({},e),{},{article:P(P({},t),{},{template:t&&t.template?t.template:"mainstandard"})});return o.a.createElement(y.a,null,o.a.createElement(j.MessageManager,{delay:3e3,scale:O.scales.medium},o.a.createElement(l,x({},m,{onImagePress:u}))))}}]);