@mjhls/mjh-framework 1.0.508 → 1.0.510
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/README.md +1 -1
- package/dist/cjs/ArticleQueue.js +512 -9
- package/dist/cjs/InscreenSensor-3aec8492.js +361 -0
- package/dist/cjs/View.js +64 -62
- package/dist/cjs/getQuery.js +3 -3
- package/dist/cjs/getRelatedArticle.js +16 -12
- package/dist/cjs/index.js +3 -3
- package/dist/esm/AD.js +1 -1
- package/dist/esm/AD300x250.js +2 -2
- package/dist/esm/AD300x250x600.js +2 -2
- package/dist/esm/AD728x90.js +2 -2
- package/dist/esm/ADFloatingFooter.js +2 -2
- package/dist/esm/ADGutter.js +2 -2
- package/dist/esm/ADSponsoredResources.js +2 -2
- package/dist/esm/ADWebcast.js +2 -2
- package/dist/esm/ADWelcome.js +2 -2
- package/dist/esm/AdSlot.js +2 -2
- package/dist/esm/ArticleQueue.js +507 -4
- package/dist/esm/CMEDeck.js +2 -2
- package/dist/esm/Column2.js +3 -3
- package/dist/esm/Column3.js +4 -4
- package/dist/esm/DeckContent.js +3 -3
- package/dist/esm/DeckQueue.js +4 -4
- package/dist/esm/{Dfp-58cfc45a.js → Dfp-81a052c2.js} +2 -2
- package/dist/esm/ExternalResources.js +2 -2
- package/dist/esm/GridContent.js +6 -6
- package/dist/esm/InscreenSensor-280b2b10.js +352 -0
- package/dist/esm/IssueLanding.js +4 -4
- package/dist/esm/LeftNav.js +2 -2
- package/dist/esm/MasterDeck.js +4 -4
- package/dist/esm/PartnerDetailListing.js +4 -4
- package/dist/esm/QueueDeckExpanded.js +4 -4
- package/dist/esm/SideFooter.js +3 -3
- package/dist/esm/TemplateNormal.js +4 -4
- package/dist/esm/VideoSeriesListing.js +2 -2
- package/dist/esm/View.js +64 -62
- package/dist/esm/{_arrayMap-a8dd2b2c.js → _arrayMap-64cbe0e4.js} +2 -2
- package/dist/esm/{debounce-8cd9e09c.js → debounce-048d9cb6.js} +1 -1
- package/dist/esm/{get-ae817b75.js → get-0eb56363.js} +2 -2
- package/dist/esm/getQuery.js +3 -3
- package/dist/esm/getRelatedArticle.js +14 -10
- package/dist/esm/getSerializers.js +2 -2
- package/dist/esm/index.js +8 -8
- package/dist/esm/{isSymbol-c1b9be80.js → isSymbol-b7b7434f.js} +1 -1
- package/package.json +1 -1
- package/dist/cjs/InscreenSensor-f9989c04.js +0 -863
- package/dist/esm/InscreenSensor-67905ed5.js +0 -857
- /package/dist/esm/{ADInfeed-15266562.js → ADInfeed-cb0d3a09.js} +0 -0
- /package/dist/esm/{ADlgInfeed-64346b44.js → ADlgInfeed-353fb56a.js} +0 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
4
|
+
|
|
5
|
+
var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
|
|
6
|
+
var inherits = require('./inherits-14962339.js');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var React__default = _interopDefault(React);
|
|
9
|
+
var isSymbol = require('./isSymbol-488934a7.js');
|
|
10
|
+
|
|
11
|
+
/** Used as references for various `Number` constants. */
|
|
12
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Checks if `value` is a valid array-like length.
|
|
16
|
+
*
|
|
17
|
+
* **Note:** This method is loosely based on
|
|
18
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @memberOf _
|
|
22
|
+
* @since 4.0.0
|
|
23
|
+
* @category Lang
|
|
24
|
+
* @param {*} value The value to check.
|
|
25
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
26
|
+
* @example
|
|
27
|
+
*
|
|
28
|
+
* _.isLength(3);
|
|
29
|
+
* // => true
|
|
30
|
+
*
|
|
31
|
+
* _.isLength(Number.MIN_VALUE);
|
|
32
|
+
* // => false
|
|
33
|
+
*
|
|
34
|
+
* _.isLength(Infinity);
|
|
35
|
+
* // => false
|
|
36
|
+
*
|
|
37
|
+
* _.isLength('3');
|
|
38
|
+
* // => false
|
|
39
|
+
*/
|
|
40
|
+
function isLength(value) {
|
|
41
|
+
return typeof value == 'number' &&
|
|
42
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var isLength_1 = isLength;
|
|
46
|
+
|
|
47
|
+
/** `Object#toString` result references. */
|
|
48
|
+
var argsTag = '[object Arguments]';
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The base implementation of `_.isArguments`.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
* @param {*} value The value to check.
|
|
55
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
56
|
+
*/
|
|
57
|
+
function baseIsArguments(value) {
|
|
58
|
+
return isSymbol.isObjectLike_1(value) && isSymbol._baseGetTag(value) == argsTag;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var _baseIsArguments = baseIsArguments;
|
|
62
|
+
|
|
63
|
+
/** Used for built-in method references. */
|
|
64
|
+
var objectProto = Object.prototype;
|
|
65
|
+
|
|
66
|
+
/** Used to check objects for own properties. */
|
|
67
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
68
|
+
|
|
69
|
+
/** Built-in value references. */
|
|
70
|
+
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Checks if `value` is likely an `arguments` object.
|
|
74
|
+
*
|
|
75
|
+
* @static
|
|
76
|
+
* @memberOf _
|
|
77
|
+
* @since 0.1.0
|
|
78
|
+
* @category Lang
|
|
79
|
+
* @param {*} value The value to check.
|
|
80
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
81
|
+
* else `false`.
|
|
82
|
+
* @example
|
|
83
|
+
*
|
|
84
|
+
* _.isArguments(function() { return arguments; }());
|
|
85
|
+
* // => true
|
|
86
|
+
*
|
|
87
|
+
* _.isArguments([1, 2, 3]);
|
|
88
|
+
* // => false
|
|
89
|
+
*/
|
|
90
|
+
var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
|
91
|
+
return isSymbol.isObjectLike_1(value) && hasOwnProperty.call(value, 'callee') &&
|
|
92
|
+
!propertyIsEnumerable.call(value, 'callee');
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var isArguments_1 = isArguments;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* This method returns `false`.
|
|
99
|
+
*
|
|
100
|
+
* @static
|
|
101
|
+
* @memberOf _
|
|
102
|
+
* @since 4.13.0
|
|
103
|
+
* @category Util
|
|
104
|
+
* @returns {boolean} Returns `false`.
|
|
105
|
+
* @example
|
|
106
|
+
*
|
|
107
|
+
* _.times(2, _.stubFalse);
|
|
108
|
+
* // => [false, false]
|
|
109
|
+
*/
|
|
110
|
+
function stubFalse() {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var stubFalse_1 = stubFalse;
|
|
115
|
+
|
|
116
|
+
var isBuffer_1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
117
|
+
/** Detect free variable `exports`. */
|
|
118
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
119
|
+
|
|
120
|
+
/** Detect free variable `module`. */
|
|
121
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
122
|
+
|
|
123
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
124
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
125
|
+
|
|
126
|
+
/** Built-in value references. */
|
|
127
|
+
var Buffer = moduleExports ? isSymbol._root.Buffer : undefined;
|
|
128
|
+
|
|
129
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
130
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Checks if `value` is a buffer.
|
|
134
|
+
*
|
|
135
|
+
* @static
|
|
136
|
+
* @memberOf _
|
|
137
|
+
* @since 4.3.0
|
|
138
|
+
* @category Lang
|
|
139
|
+
* @param {*} value The value to check.
|
|
140
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
141
|
+
* @example
|
|
142
|
+
*
|
|
143
|
+
* _.isBuffer(new Buffer(2));
|
|
144
|
+
* // => true
|
|
145
|
+
*
|
|
146
|
+
* _.isBuffer(new Uint8Array(2));
|
|
147
|
+
* // => false
|
|
148
|
+
*/
|
|
149
|
+
var isBuffer = nativeIsBuffer || stubFalse_1;
|
|
150
|
+
|
|
151
|
+
module.exports = isBuffer;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
/** `Object#toString` result references. */
|
|
155
|
+
var argsTag$1 = '[object Arguments]',
|
|
156
|
+
arrayTag = '[object Array]',
|
|
157
|
+
boolTag = '[object Boolean]',
|
|
158
|
+
dateTag = '[object Date]',
|
|
159
|
+
errorTag = '[object Error]',
|
|
160
|
+
funcTag = '[object Function]',
|
|
161
|
+
mapTag = '[object Map]',
|
|
162
|
+
numberTag = '[object Number]',
|
|
163
|
+
objectTag = '[object Object]',
|
|
164
|
+
regexpTag = '[object RegExp]',
|
|
165
|
+
setTag = '[object Set]',
|
|
166
|
+
stringTag = '[object String]',
|
|
167
|
+
weakMapTag = '[object WeakMap]';
|
|
168
|
+
|
|
169
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
170
|
+
dataViewTag = '[object DataView]',
|
|
171
|
+
float32Tag = '[object Float32Array]',
|
|
172
|
+
float64Tag = '[object Float64Array]',
|
|
173
|
+
int8Tag = '[object Int8Array]',
|
|
174
|
+
int16Tag = '[object Int16Array]',
|
|
175
|
+
int32Tag = '[object Int32Array]',
|
|
176
|
+
uint8Tag = '[object Uint8Array]',
|
|
177
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
178
|
+
uint16Tag = '[object Uint16Array]',
|
|
179
|
+
uint32Tag = '[object Uint32Array]';
|
|
180
|
+
|
|
181
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
182
|
+
var typedArrayTags = {};
|
|
183
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
184
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
185
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
186
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
187
|
+
typedArrayTags[uint32Tag] = true;
|
|
188
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
|
|
189
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
190
|
+
typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
|
191
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
192
|
+
typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
|
193
|
+
typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
|
|
194
|
+
typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
|
195
|
+
typedArrayTags[weakMapTag] = false;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
199
|
+
*
|
|
200
|
+
* @private
|
|
201
|
+
* @param {*} value The value to check.
|
|
202
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
203
|
+
*/
|
|
204
|
+
function baseIsTypedArray(value) {
|
|
205
|
+
return isSymbol.isObjectLike_1(value) &&
|
|
206
|
+
isLength_1(value.length) && !!typedArrayTags[isSymbol._baseGetTag(value)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
var _baseIsTypedArray = baseIsTypedArray;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
213
|
+
*
|
|
214
|
+
* @private
|
|
215
|
+
* @param {Function} func The function to cap arguments for.
|
|
216
|
+
* @returns {Function} Returns the new capped function.
|
|
217
|
+
*/
|
|
218
|
+
function baseUnary(func) {
|
|
219
|
+
return function(value) {
|
|
220
|
+
return func(value);
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
var _baseUnary = baseUnary;
|
|
225
|
+
|
|
226
|
+
var _nodeUtil = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
227
|
+
/** Detect free variable `exports`. */
|
|
228
|
+
var freeExports = exports && !exports.nodeType && exports;
|
|
229
|
+
|
|
230
|
+
/** Detect free variable `module`. */
|
|
231
|
+
var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
|
232
|
+
|
|
233
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
234
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
235
|
+
|
|
236
|
+
/** Detect free variable `process` from Node.js. */
|
|
237
|
+
var freeProcess = moduleExports && isSymbol._freeGlobal.process;
|
|
238
|
+
|
|
239
|
+
/** Used to access faster Node.js helpers. */
|
|
240
|
+
var nodeUtil = (function() {
|
|
241
|
+
try {
|
|
242
|
+
// Use `util.types` for Node.js 10+.
|
|
243
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
244
|
+
|
|
245
|
+
if (types) {
|
|
246
|
+
return types;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
250
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
251
|
+
} catch (e) {}
|
|
252
|
+
}());
|
|
253
|
+
|
|
254
|
+
module.exports = nodeUtil;
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
/* Node.js helper references. */
|
|
258
|
+
var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Checks if `value` is classified as a typed array.
|
|
262
|
+
*
|
|
263
|
+
* @static
|
|
264
|
+
* @memberOf _
|
|
265
|
+
* @since 3.0.0
|
|
266
|
+
* @category Lang
|
|
267
|
+
* @param {*} value The value to check.
|
|
268
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
269
|
+
* @example
|
|
270
|
+
*
|
|
271
|
+
* _.isTypedArray(new Uint8Array);
|
|
272
|
+
* // => true
|
|
273
|
+
*
|
|
274
|
+
* _.isTypedArray([]);
|
|
275
|
+
* // => false
|
|
276
|
+
*/
|
|
277
|
+
var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
|
278
|
+
|
|
279
|
+
var isTypedArray_1 = isTypedArray;
|
|
280
|
+
|
|
281
|
+
var InscreenSensor = function (_React$Component) {
|
|
282
|
+
inherits._inherits(InscreenSensor, _React$Component);
|
|
283
|
+
|
|
284
|
+
function InscreenSensor(props) {
|
|
285
|
+
inherits._classCallCheck(this, InscreenSensor);
|
|
286
|
+
|
|
287
|
+
var _this = inherits._possibleConstructorReturn(this, (InscreenSensor.__proto__ || inherits._Object$getPrototypeOf(InscreenSensor)).call(this, props));
|
|
288
|
+
|
|
289
|
+
_this.scrollHandler = function () {
|
|
290
|
+
var visible = _this.checkInside();
|
|
291
|
+
if (visible !== _this.visible) {
|
|
292
|
+
_this.visible = visible;
|
|
293
|
+
_this.props.onChange(visible);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
_this.checkInside = function () {
|
|
298
|
+
var rect = _this.wraperRef.current.getBoundingClientRect();
|
|
299
|
+
var _this$props$offSetTop = _this.props.offSetTop,
|
|
300
|
+
offSetTop = _this$props$offSetTop === undefined ? 0 : _this$props$offSetTop;
|
|
301
|
+
var top = rect.top,
|
|
302
|
+
bottom = rect.bottom;
|
|
303
|
+
|
|
304
|
+
var viewHeight = window.innerHeight;
|
|
305
|
+
var wrpElem = document.getElementsByClassName('inscreen-wrapper');
|
|
306
|
+
|
|
307
|
+
if (top > 0 && top <= offSetTop) {
|
|
308
|
+
if (wrpElem.length > 1 && top <= viewHeight && bottom > viewHeight) {
|
|
309
|
+
return 'top';
|
|
310
|
+
} else if (wrpElem.length > 1 && bottom < viewHeight) {
|
|
311
|
+
return 'small-top';
|
|
312
|
+
}
|
|
313
|
+
} else if (wrpElem.length > 1 && top < offSetTop && bottom + offSetTop >= viewHeight) {
|
|
314
|
+
return 'bottom';
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
|
|
318
|
+
_this.wraperRef = React__default.createRef();
|
|
319
|
+
_this.visible = false;
|
|
320
|
+
return _this;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
inherits._createClass(InscreenSensor, [{
|
|
324
|
+
key: 'componentDidMount',
|
|
325
|
+
value: function componentDidMount() {
|
|
326
|
+
this.visible = this.checkInside();
|
|
327
|
+
this.props.onChange(this.visible);
|
|
328
|
+
window.addEventListener('scroll', this.scrollHandler);
|
|
329
|
+
}
|
|
330
|
+
}, {
|
|
331
|
+
key: 'componentWillUnmount',
|
|
332
|
+
value: function componentWillUnmount() {
|
|
333
|
+
window.removeEventListener('scroll', this.scrollHandler);
|
|
334
|
+
}
|
|
335
|
+
}, {
|
|
336
|
+
key: 'render',
|
|
337
|
+
value: function render() {
|
|
338
|
+
var _props = this.props,
|
|
339
|
+
_props$className = _props.className,
|
|
340
|
+
className = _props$className === undefined ? '' : _props$className,
|
|
341
|
+
_props$style = _props.style,
|
|
342
|
+
style = _props$style === undefined ? {} : _props$style,
|
|
343
|
+
_props$id = _props.id,
|
|
344
|
+
id = _props$id === undefined ? '' : _props$id;
|
|
345
|
+
|
|
346
|
+
return React__default.createElement(
|
|
347
|
+
'div',
|
|
348
|
+
{ ref: this.wraperRef, className: className, style: style, id: id },
|
|
349
|
+
this.props.children
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
}]);
|
|
353
|
+
|
|
354
|
+
return InscreenSensor;
|
|
355
|
+
}(React__default.Component);
|
|
356
|
+
|
|
357
|
+
exports.InscreenSensor = InscreenSensor;
|
|
358
|
+
exports.isArguments_1 = isArguments_1;
|
|
359
|
+
exports.isBuffer_1 = isBuffer_1;
|
|
360
|
+
exports.isLength_1 = isLength_1;
|
|
361
|
+
exports.isTypedArray_1 = isTypedArray_1;
|
package/dist/cjs/View.js
CHANGED
|
@@ -36,7 +36,6 @@ var asyncToGenerator = require('./asyncToGenerator-8e707718.js');
|
|
|
36
36
|
require('./_set-species-4458e975.js');
|
|
37
37
|
require('./beam-2745329b.js');
|
|
38
38
|
var AdSlot = require('./AdSlot.js');
|
|
39
|
-
require('./_arrayMap-3b4a0f75.js');
|
|
40
39
|
var BlockContent = require('./BlockContent-f942392e.js');
|
|
41
40
|
require('./smoothscroll-95231a70.js');
|
|
42
41
|
require('./GroupDeck.js');
|
|
@@ -52,9 +51,9 @@ require('react-share');
|
|
|
52
51
|
var SocialShare = require('./SocialShare.js');
|
|
53
52
|
var Form = _interopDefault(require('react-bootstrap/Form'));
|
|
54
53
|
var FormControl = _interopDefault(require('react-bootstrap/FormControl'));
|
|
55
|
-
var keys = require('./keys-a586b7a0.js');
|
|
54
|
+
var keys$1 = require('./keys-a586b7a0.js');
|
|
56
55
|
var Dropdown = _interopDefault(require('react-bootstrap/Dropdown'));
|
|
57
|
-
var InscreenSensor = require('./InscreenSensor-
|
|
56
|
+
var InscreenSensor = require('./InscreenSensor-3aec8492.js');
|
|
58
57
|
var getKeywords = require('./getKeywords.js');
|
|
59
58
|
var getSeriesDetail = require('./getSeriesDetail.js');
|
|
60
59
|
var getQuery = require('./getQuery.js');
|
|
@@ -293,7 +292,8 @@ var Article = function Article(props) {
|
|
|
293
292
|
lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
|
|
294
293
|
queueData = props.queueData,
|
|
295
294
|
_props$sponsoredFlag = props.sponsoredFlag,
|
|
296
|
-
sponsoredFlag = _props$sponsoredFlag === undefined ? false : _props$sponsoredFlag
|
|
295
|
+
sponsoredFlag = _props$sponsoredFlag === undefined ? false : _props$sponsoredFlag,
|
|
296
|
+
Ads = props.Ads;
|
|
297
297
|
var onChangeArticle = props.onChangeArticle;
|
|
298
298
|
|
|
299
299
|
//If sponsored flag, disable contextual ads
|
|
@@ -302,6 +302,13 @@ var Article = function Article(props) {
|
|
|
302
302
|
article.contextualVideoAD = false;
|
|
303
303
|
article.contextualAD = false;
|
|
304
304
|
}
|
|
305
|
+
//This was being done in ArticleQueue2 which wasnt effecting articles excluded from infinite scroll, moved inside article component
|
|
306
|
+
if (!sponsoredFlag && Ads.getVideoContextualAD) {
|
|
307
|
+
article.contextualVideoAD = Ads.getVideoContextualAD(getTargeting.getTargeting(props, 'in-context_video'));
|
|
308
|
+
}
|
|
309
|
+
if (!sponsoredFlag && Ads.getNativeContextualAD) {
|
|
310
|
+
article.contextualAD = Ads.getNativeContextualAD(getTargeting.getTargeting(props, 'native-ad'));
|
|
311
|
+
}
|
|
305
312
|
|
|
306
313
|
var _useState = React.useState(null),
|
|
307
314
|
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
@@ -435,7 +442,7 @@ var Article = function Article(props) {
|
|
|
435
442
|
if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && payload.contextualVideoAD) {
|
|
436
443
|
payload = _extends._extends({}, payload, {
|
|
437
444
|
contextualAD: _extends._extends({}, payload.contextualAD, {
|
|
438
|
-
slotId: (payload.contextualAD.slotId || '
|
|
445
|
+
slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id
|
|
439
446
|
}),
|
|
440
447
|
contextualVideoAD: _extends._extends({}, payload.contextualVideoAD, {
|
|
441
448
|
slotId: (payload.contextualVideoAD.slotId || 'in-context_video') + '-' + payload._id
|
|
@@ -497,7 +504,8 @@ var Article = function Article(props) {
|
|
|
497
504
|
} else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
|
|
498
505
|
payload = _extends._extends({}, payload, {
|
|
499
506
|
contextualAD: _extends._extends({}, payload.contextualAD, {
|
|
500
|
-
slotId: (payload.contextualAD.slotId || '
|
|
507
|
+
slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
|
|
508
|
+
className: 'ADFluid',
|
|
501
509
|
// Fetching new contextual targeting based on the current active article.
|
|
502
510
|
targeting: getTargeting.getTargeting(props, 'native-ad'),
|
|
503
511
|
// Adding new ad size for large contextual ad for desktop screen width >= 1400
|
|
@@ -505,24 +513,37 @@ var Article = function Article(props) {
|
|
|
505
513
|
sizeMapping: lgContextAd ? [{
|
|
506
514
|
viewport: [1400, 0],
|
|
507
515
|
sizes: [[728, 90], 'fluid', [300, 100]]
|
|
508
|
-
}, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : ['fluid', [300, 100]]
|
|
516
|
+
}, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : { viewport: [0, 0], sizes: ['fluid', [300, 100]] }
|
|
509
517
|
})
|
|
510
518
|
});
|
|
511
519
|
var _selectedIndex = indexes[1] + 1;
|
|
512
520
|
|
|
513
|
-
var _checkIsAdFound = function _checkIsAdFound(isFound) {
|
|
514
|
-
var parent = document.getElementById('contextual-native-ad-' + payload._id);
|
|
521
|
+
var _checkIsAdFound = function _checkIsAdFound(isFound, adData) {
|
|
515
522
|
if (!isFound) {
|
|
523
|
+
var parent = document.getElementById('contextual-native-ad-' + payload._id);
|
|
516
524
|
parent.style.height = '0%';
|
|
517
525
|
parent.style.width = '0%';
|
|
518
526
|
parent.style.display = 'none';
|
|
519
527
|
setContextualADFlag(false);
|
|
520
528
|
} else {
|
|
521
|
-
|
|
529
|
+
var _parent = document.getElementById('contextual-native-ad-' + payload._id);
|
|
530
|
+
if (adData && adData.event && adData.event.size && _parent) {
|
|
531
|
+
// Adding fix for fluid contextual ad to avoid from collapsing when size is [0,0]
|
|
532
|
+
var fluidSizes = [[0, 0]];
|
|
533
|
+
var checkAdSize = function checkAdSize(size) {
|
|
534
|
+
return stringify._JSON$stringify(size) === stringify._JSON$stringify(adData.event.size);
|
|
535
|
+
};
|
|
536
|
+
if (!fluidSizes.some(checkAdSize)) {
|
|
537
|
+
_parent.style.width = adData.event.size[0] + 'px';
|
|
538
|
+
_parent.style.height = adData.event.size[1] + 'px';
|
|
539
|
+
}
|
|
540
|
+
_parent.style.margin = 'auto';
|
|
541
|
+
// Adding margin below to create a seperation from text.
|
|
542
|
+
_parent.style.marginBottom = '15px';
|
|
543
|
+
}
|
|
544
|
+
if (body[0]._type === 'figure' || body[1]._type === 'figure' || body[2]._type === 'figure' || body[3]._type === 'figure') {
|
|
522
545
|
setContextualADFlag(true);
|
|
523
546
|
}
|
|
524
|
-
// Adding margin below to create a seperation from text.
|
|
525
|
-
if (parent && parent.style) parent.style.marginBottom = '15px';
|
|
526
547
|
}
|
|
527
548
|
};
|
|
528
549
|
|
|
@@ -535,9 +556,7 @@ var Article = function Article(props) {
|
|
|
535
556
|
imageOptions: { w: 320, h: 240, fit: 'max' }
|
|
536
557
|
}, client.config())),
|
|
537
558
|
contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
|
|
538
|
-
(visibleFlag || queueData && queueData.length === 1) &&
|
|
539
|
-
// Adding margin below to create a seperation from text.
|
|
540
|
-
React__default.createElement(
|
|
559
|
+
(visibleFlag || queueData && queueData.length === 1 || !props.infiniteScroll) && React__default.createElement(
|
|
541
560
|
'div',
|
|
542
561
|
{ id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
|
|
543
562
|
React__default.createElement(AdSlot, _extends._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
|
|
@@ -705,24 +724,20 @@ var Article = function Article(props) {
|
|
|
705
724
|
),
|
|
706
725
|
issue && React__default.createElement(
|
|
707
726
|
'div',
|
|
708
|
-
|
|
727
|
+
{ className: 'volume-issue' },
|
|
709
728
|
React__default.createElement(
|
|
710
|
-
'
|
|
711
|
-
|
|
712
|
-
React__default.createElement(
|
|
713
|
-
'
|
|
729
|
+
'p',
|
|
730
|
+
null,
|
|
731
|
+
issue.volume && React__default.createElement(
|
|
732
|
+
'span',
|
|
733
|
+
null,
|
|
734
|
+
'Volume ' + issue.volume,
|
|
735
|
+
','
|
|
736
|
+
),
|
|
737
|
+
issue.issueNumber && React__default.createElement(
|
|
738
|
+
'span',
|
|
714
739
|
null,
|
|
715
|
-
|
|
716
|
-
'span',
|
|
717
|
-
null,
|
|
718
|
-
'Volume ' + issue.volume,
|
|
719
|
-
','
|
|
720
|
-
),
|
|
721
|
-
issue.issueNumber && React__default.createElement(
|
|
722
|
-
'span',
|
|
723
|
-
null,
|
|
724
|
-
' Issue ' + issue.issueNumber
|
|
725
|
-
)
|
|
740
|
+
' Issue ' + issue.issueNumber
|
|
726
741
|
)
|
|
727
742
|
)
|
|
728
743
|
),
|
|
@@ -896,7 +911,6 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
896
911
|
_props$maxListLength = props.maxListLength,
|
|
897
912
|
maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
|
|
898
913
|
_props$sponsoredTaxon = props.sponsoredTaxonomies,
|
|
899
|
-
sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
|
|
900
914
|
_props$cpModification = props.cpModificationRequired,
|
|
901
915
|
cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification,
|
|
902
916
|
_props$authorPrefix = props.authorPrefix,
|
|
@@ -929,7 +943,7 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
929
943
|
var pos = slot.getTargeting('pos');
|
|
930
944
|
|
|
931
945
|
slot.clearTargeting();
|
|
932
|
-
keys._Object$keys(targeting).forEach(function (key) {
|
|
946
|
+
keys$1._Object$keys(targeting).forEach(function (key) {
|
|
933
947
|
slot.setTargeting(key, targeting[key]);
|
|
934
948
|
});
|
|
935
949
|
slot.setTargeting('pos', pos);
|
|
@@ -950,7 +964,7 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
950
964
|
//gets the slotId of the leaderboard ad to refresh
|
|
951
965
|
leaderboardSlotId = slot.getSlotId().getDomId();
|
|
952
966
|
slot.clearTargeting();
|
|
953
|
-
keys._Object$keys(targeting).forEach(function (key) {
|
|
967
|
+
keys$1._Object$keys(targeting).forEach(function (key) {
|
|
954
968
|
slot.setTargeting(key, targeting[key]);
|
|
955
969
|
});
|
|
956
970
|
slot.setTargeting('pos', pos);
|
|
@@ -962,19 +976,6 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
962
976
|
}
|
|
963
977
|
};
|
|
964
978
|
|
|
965
|
-
var checkSponseredArticle = function checkSponseredArticle(article) {
|
|
966
|
-
var _article$taxonomyMapp = article.taxonomyMapping,
|
|
967
|
-
taxonomyMapping = _article$taxonomyMapp === undefined ? [] : _article$taxonomyMapp;
|
|
968
|
-
|
|
969
|
-
if (props.checkSponsered) {
|
|
970
|
-
return taxonomyMapping.some(function (item) {
|
|
971
|
-
return InscreenSensor.includes_1(sponsoredTaxonomies, item._ref);
|
|
972
|
-
});
|
|
973
|
-
} else {
|
|
974
|
-
return false;
|
|
975
|
-
}
|
|
976
|
-
};
|
|
977
|
-
|
|
978
979
|
var preVscroll = 0;
|
|
979
980
|
var isScrollDown = true;
|
|
980
981
|
|
|
@@ -1006,9 +1007,11 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1006
1007
|
|
|
1007
1008
|
React.useEffect(function () {
|
|
1008
1009
|
// Fetching related article after component mounted if vertical scroll not found
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1010
|
+
setTimeout(function () {
|
|
1011
|
+
if (!hasVerticalScroll()) {
|
|
1012
|
+
loadmore();
|
|
1013
|
+
}
|
|
1014
|
+
}, 1000);
|
|
1012
1015
|
}, [queueData.length]);
|
|
1013
1016
|
|
|
1014
1017
|
var loadmore = function loadmore() {
|
|
@@ -1079,12 +1082,6 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1079
1082
|
index_es.InfiniteScroll,
|
|
1080
1083
|
{ dataLength: queueData.length, next: loadmore, scrollThreshold: '60%', hasMore: true, style: { overflow: 'hidden' } },
|
|
1081
1084
|
queueData.map(function (article, index) {
|
|
1082
|
-
if (!checkSponseredArticle(article) && Ads.getVideoContextualAD) {
|
|
1083
|
-
article.contextualVideoAD = Ads.getVideoContextualAD(getTargeting.getTargeting(props, 'in-context_video'));
|
|
1084
|
-
}
|
|
1085
|
-
if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
|
|
1086
|
-
article.contextualAD = Ads.getNativeContextualAD(getTargeting.getTargeting(props, 'native-ad'));
|
|
1087
|
-
}
|
|
1088
1085
|
return React__default.createElement(Article, _extends._extends({
|
|
1089
1086
|
key: index
|
|
1090
1087
|
}, props, {
|
|
@@ -1183,6 +1180,9 @@ var View = function View(props) {
|
|
|
1183
1180
|
//disable infinite scroll
|
|
1184
1181
|
|
|
1185
1182
|
var checkVideoSeries = function checkVideoSeries(article) {
|
|
1183
|
+
if (!article || !article.body) {
|
|
1184
|
+
return false;
|
|
1185
|
+
}
|
|
1186
1186
|
for (var i = 0; i < article.body.length; i++) {
|
|
1187
1187
|
var row = article.body[i];
|
|
1188
1188
|
if (typeof row.videos !== 'undefined') {
|
|
@@ -1240,7 +1240,7 @@ var View = function View(props) {
|
|
|
1240
1240
|
);
|
|
1241
1241
|
};
|
|
1242
1242
|
|
|
1243
|
-
//This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
|
|
1243
|
+
//This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
|
|
1244
1244
|
View.returnGetInitialProps = function () {
|
|
1245
1245
|
var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(url, prevUrl, seriesVid, client, sao) {
|
|
1246
1246
|
var article, relatedArticleQuery, statusCode, sponsoredFlag;
|
|
@@ -1264,11 +1264,13 @@ View.returnGetInitialProps = function () {
|
|
|
1264
1264
|
sponsoredFlag = false;
|
|
1265
1265
|
//check for disableAds flag on each taxonomoy
|
|
1266
1266
|
|
|
1267
|
-
article.content_placement
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1267
|
+
if (article && article.content_placement) {
|
|
1268
|
+
article.content_placement.forEach(function (x) {
|
|
1269
|
+
if (x.disableAds) {
|
|
1270
|
+
sponsoredFlag = true;
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1272
1274
|
//check for disableAds flag on content category
|
|
1273
1275
|
if (article.category && article.category.disableAds) {
|
|
1274
1276
|
sponsoredFlag = true;
|
package/dist/cjs/getQuery.js
CHANGED
|
@@ -12,13 +12,13 @@ var getQuery = function getQuery(type) {
|
|
|
12
12
|
var today = moment.moment().utc().format();
|
|
13
13
|
switch (type) {
|
|
14
14
|
case 'related':
|
|
15
|
-
return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && published <= \'' + today + '\'\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[$index]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
|
|
15
|
+
return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && published <= \'' + today + '\'\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[$index]{\n ' + params + '\n title,\n published,\n \'showPublished\':select(contentCategory->name !=\'Webcasts\' => true,false),\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
|
|
16
16
|
case 'article':
|
|
17
|
-
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
|
|
17
|
+
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n \'showPublished\':select(contentCategory->name !=\'Webcasts\' => true,false),\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
|
|
18
18
|
case 'publication':
|
|
19
19
|
return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
|
|
20
20
|
case 'issue':
|
|
21
|
-
return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n &&
|
|
21
|
+
return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && published <= $currentDate\n && references(^._id)] {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
|
|
22
22
|
case 'externalResources':
|
|
23
23
|
return '{\n \'archived\': *[_type == "external" && archived && isVisible ' + conditions + '] | order(displayDate desc),\n \'recent\': *[_type == "external" && archived != true && isVisible ' + conditions + '] | order(displayDate asc)\n }';
|
|
24
24
|
}
|