@mjhls/mjh-framework 1.0.885 → 1.0.886
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/ContentCardPaginated.js +414 -0
- package/dist/cjs/DeckQueuePaginated.js +345 -0
- package/dist/cjs/GridContent.js +44 -157
- package/dist/cjs/GridContentPaginated.js +704 -0
- package/dist/cjs/ImageSlider-b96720eb.js +2813 -0
- package/dist/cjs/MasterDeckPaginated.js +446 -0
- package/dist/cjs/MediaSeriesCard-8b4efd28.js +9505 -0
- package/dist/cjs/MediaSeriesLanding.js +20 -9502
- package/dist/cjs/MediaSeriesLandingPaginated.js +524 -0
- package/dist/cjs/Pagination-8f2038bf.js +53 -0
- package/dist/cjs/PartnerDetailListing.js +12 -2807
- package/dist/cjs/PartnerDetailListingPaginated.js +314 -0
- package/dist/cjs/PublicationFeature-5ccf9b13.js +130 -0
- package/dist/cjs/QueueDeckExpandedPaginated.js +1378 -0
- package/dist/cjs/index.js +2 -0
- package/dist/esm/ContentCardPaginated.js +403 -0
- package/dist/esm/DeckQueuePaginated.js +334 -0
- package/dist/esm/GridContent.js +2 -114
- package/dist/esm/GridContentPaginated.js +693 -0
- package/dist/esm/ImageSlider-de7846ea.js +2804 -0
- package/dist/esm/MasterDeckPaginated.js +438 -0
- package/dist/esm/MediaSeriesCard-51ebf1c0.js +9495 -0
- package/dist/esm/MediaSeriesLanding.js +16 -9496
- package/dist/esm/MediaSeriesLandingPaginated.js +517 -0
- package/dist/esm/Pagination-c0db7ca1.js +46 -0
- package/dist/esm/PartnerDetailListing.js +13 -2807
- package/dist/esm/PartnerDetailListingPaginated.js +308 -0
- package/dist/esm/PublicationFeature-d88e76b9.js +121 -0
- package/dist/esm/QueueDeckExpandedPaginated.js +1372 -0
- package/dist/esm/index.js +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var stringify = require('./stringify-f7a37a8d.js');
|
|
4
|
+
var asyncToGenerator = require('./asyncToGenerator-77821af0.js');
|
|
5
|
+
var _extends = require('./extends-7c86182f.js');
|
|
6
|
+
var toConsumableArray = require('./toConsumableArray-d7797c2b.js');
|
|
7
|
+
var inherits = require('./inherits-de66ea16.js');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var index = require('./index-fc2f1ca2.js');
|
|
10
|
+
var Container = require('react-bootstrap/Container');
|
|
11
|
+
var Spinner = require('react-bootstrap/Spinner');
|
|
12
|
+
var Router = require('next/router');
|
|
13
|
+
var lodash = require('./lodash-f0783643.js');
|
|
14
|
+
var main = require('./main-f1c77adb.js');
|
|
15
|
+
var ADlgInfeed = require('./ADlgInfeed-950b414b.js');
|
|
16
|
+
var ADInfeed = require('./ADInfeed-bce0ba07.js');
|
|
17
|
+
var Pagination = require('./Pagination-8f2038bf.js');
|
|
18
|
+
require('./_commonjsHelpers-06173234.js');
|
|
19
|
+
require('./core.get-iterator-method-5643aa10.js');
|
|
20
|
+
require('./web.dom.iterable-d98303e0.js');
|
|
21
|
+
require('./_library-dd23b178.js');
|
|
22
|
+
require('./_iter-detect-b1df62f0.js');
|
|
23
|
+
require('./_object-pie-083f2dd6.js');
|
|
24
|
+
require('./_object-sap-d1978572.js');
|
|
25
|
+
require('./define-property-e8404b64.js');
|
|
26
|
+
require('./typeof-567e31ff.js');
|
|
27
|
+
require('./_is-array-54228b29.js');
|
|
28
|
+
require('./events-1b438fe7.js');
|
|
29
|
+
require('prop-types');
|
|
30
|
+
require('./slicedToArray-067dd3bc.js');
|
|
31
|
+
require('react-bootstrap/Card');
|
|
32
|
+
require('./AdSlot.js');
|
|
33
|
+
require('./debounce-d4a2369b.js');
|
|
34
|
+
require('./isSymbol-03abbdf0.js');
|
|
35
|
+
require('./toNumber-5e1fac58.js');
|
|
36
|
+
require('./Beam.js');
|
|
37
|
+
require('./Segment.js');
|
|
38
|
+
require('react-paginate');
|
|
39
|
+
|
|
40
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
41
|
+
|
|
42
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
43
|
+
var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
|
|
44
|
+
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
45
|
+
|
|
46
|
+
var MasterDeck = function (_React$Component) {
|
|
47
|
+
inherits._inherits(MasterDeck, _React$Component);
|
|
48
|
+
|
|
49
|
+
function MasterDeck() {
|
|
50
|
+
var _ref,
|
|
51
|
+
_this2 = this;
|
|
52
|
+
|
|
53
|
+
var _temp, _this, _ret;
|
|
54
|
+
|
|
55
|
+
inherits._classCallCheck(this, MasterDeck);
|
|
56
|
+
|
|
57
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
58
|
+
args[_key] = arguments[_key];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return _ret = (_temp = (_this = inherits._possibleConstructorReturn(this, (_ref = MasterDeck.__proto__ || inherits._Object$getPrototypeOf(MasterDeck)).call.apply(_ref, [this].concat(args))), _this), _this.Deck = _this.props.deck, _this.data = _this.props.dataRecord || [], _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.rightItems = _this.props.rightItems ? _this.props.rightItems : false, _this.isSeriesLanding = _this.props.isSeriesLanding ? _this.props.isSeriesLanding : false, _this.state = {
|
|
62
|
+
isDataLoading: false,
|
|
63
|
+
data: _this.data,
|
|
64
|
+
prevData: _this.data,
|
|
65
|
+
currentPage: _this.props.currentPage || 1,
|
|
66
|
+
dataRemapped: !_this.props.showBI || !_this.props.brandInsightAd,
|
|
67
|
+
itemsPerPage: _this.props.params ? _this.props.params.to - _this.props.params.from : 2,
|
|
68
|
+
mobileView: false
|
|
69
|
+
}, _this.seoPagination = function (pageNumber) {
|
|
70
|
+
var _this$props = _this.props,
|
|
71
|
+
pageview = _this$props.pageview,
|
|
72
|
+
router = _this$props.router;
|
|
73
|
+
|
|
74
|
+
var path = router.asPath;
|
|
75
|
+
var qrIndex = path.indexOf('?');
|
|
76
|
+
var pathname = router.pathname;
|
|
77
|
+
var queryString = '';
|
|
78
|
+
|
|
79
|
+
if (qrIndex > 0) {
|
|
80
|
+
path = path.substring(1, qrIndex);
|
|
81
|
+
|
|
82
|
+
var partialQS = router.asPath.substring(qrIndex + 1);
|
|
83
|
+
var partialQSArr = partialQS.split('&');
|
|
84
|
+
|
|
85
|
+
// exclude page=xxx from query string
|
|
86
|
+
partialQSArr.map(function (item) {
|
|
87
|
+
var itemArr = item.split('=');
|
|
88
|
+
var key = itemArr[0];
|
|
89
|
+
var val = itemArr[1];
|
|
90
|
+
|
|
91
|
+
if (key !== 'page') {
|
|
92
|
+
queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (queryString.length > 0) {
|
|
98
|
+
path += '?' + queryString;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
pageNumber = parseInt(pageNumber);
|
|
102
|
+
|
|
103
|
+
if (path[0] !== '/') {
|
|
104
|
+
path = '/' + path;
|
|
105
|
+
}
|
|
106
|
+
var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
|
|
107
|
+
if (window.location.href.includes('?')) {
|
|
108
|
+
if (window.location.href.includes('?page')) {
|
|
109
|
+
newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
|
|
110
|
+
} else {
|
|
111
|
+
newPath = pageNumber === 1 ? '' + path : path + '&page=' + pageNumber;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// please leave this for later debug purpose : Yong Jun.
|
|
116
|
+
/* console.log('page change reported', {
|
|
117
|
+
currentPage: currentPage,
|
|
118
|
+
pageNumber: pageNumber,
|
|
119
|
+
pathname: pathname,
|
|
120
|
+
path: path,
|
|
121
|
+
newPath: newPath,
|
|
122
|
+
firstPage: pageNumber === 1,
|
|
123
|
+
queryString: queryString
|
|
124
|
+
}) */
|
|
125
|
+
|
|
126
|
+
if (pageview) {
|
|
127
|
+
pageview(newPath);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
router.push(pathname, newPath, {
|
|
131
|
+
shallow: true
|
|
132
|
+
});
|
|
133
|
+
}, _this.cardLoader = function (_ref2) {
|
|
134
|
+
var variant = _ref2.variant,
|
|
135
|
+
brandInsightAd = _ref2.brandInsightAd,
|
|
136
|
+
showBI = _ref2.showBI,
|
|
137
|
+
lgInfeedAd = _ref2.lgInfeedAd;
|
|
138
|
+
|
|
139
|
+
var numberOfItemsBeforeAd = 6;
|
|
140
|
+
var data = _this.state.data;
|
|
141
|
+
var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
|
|
142
|
+
return [].concat(toConsumableArray._toConsumableArray(arr.slice(0, index)), [newElement], toConsumableArray._toConsumableArray(arr.slice(index)));
|
|
143
|
+
};
|
|
144
|
+
// Need to pass flag "lgInfeedAd={true}" along with brandInsightAd from site level for large infeed-ad to render
|
|
145
|
+
// Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
|
|
146
|
+
// Integrating large infeed AD
|
|
147
|
+
if (lgInfeedAd && brandInsightAd && typeof window !== 'undefined' && window.innerWidth >= 1400) {
|
|
148
|
+
var lgInfeed = {
|
|
149
|
+
_type: 'lg-infeed',
|
|
150
|
+
adUnit: brandInsightAd.adUnit,
|
|
151
|
+
className: 'lg-infeed',
|
|
152
|
+
networkID: brandInsightAd.networkID,
|
|
153
|
+
sizes: [728, 90],
|
|
154
|
+
sizeMapping: [{
|
|
155
|
+
viewport: [1400, 0],
|
|
156
|
+
sizes: [[728, 90]]
|
|
157
|
+
}, { viewport: [0, 0], sizes: [] }],
|
|
158
|
+
targeting: {
|
|
159
|
+
content_placement: brandInsightAd.targeting.content_placement,
|
|
160
|
+
document_url: brandInsightAd.targeting.document_url,
|
|
161
|
+
rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
|
|
162
|
+
},
|
|
163
|
+
/* Passing refresh flag */
|
|
164
|
+
refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var chunks = lodash.lodash.chunk(data, 6).map(function (chunk) {
|
|
168
|
+
var set = lodash.lodash.chunk(chunk, 2);
|
|
169
|
+
for (var i = 0; i < set.length; i++) {
|
|
170
|
+
if (i !== set.length - 1) {
|
|
171
|
+
set[i].push(lgInfeed);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return lodash.lodash.flattenDeep(set);
|
|
175
|
+
});
|
|
176
|
+
data = lodash.lodash.flatten(chunks);
|
|
177
|
+
!_this.state.dataRemapped && _this.setState({ dataRemapped: true }); // To detect if appending of insights ads are completed
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Integrating infeed AD
|
|
181
|
+
if (showBI && brandInsightAd) {
|
|
182
|
+
// Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
|
|
183
|
+
if (lgInfeedAd && typeof window !== 'undefined' && window.innerWidth >= 1400) brandInsightAd.interval = 8;
|
|
184
|
+
var pos = 0;
|
|
185
|
+
for (var i = 1; pos < data.length; i++) {
|
|
186
|
+
var inFeedAd = {
|
|
187
|
+
adUnit: brandInsightAd.adUnit,
|
|
188
|
+
className: brandInsightAd.className,
|
|
189
|
+
networkID: brandInsightAd.networkID,
|
|
190
|
+
sizes: brandInsightAd.sizes,
|
|
191
|
+
slotId: brandInsightAd.slotId + '_' + i,
|
|
192
|
+
targeting: {
|
|
193
|
+
pos: 'infeed',
|
|
194
|
+
content_placement: brandInsightAd.targeting.content_placement,
|
|
195
|
+
document_url: brandInsightAd.targeting.document_url,
|
|
196
|
+
rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
|
|
197
|
+
},
|
|
198
|
+
_type: 'brandInsightAd',
|
|
199
|
+
/* Passing refresh flag */
|
|
200
|
+
refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
data = insertBrandInsightAd(data, pos, inFeedAd);
|
|
204
|
+
pos += brandInsightAd.interval + 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// 'index' was including the indexes for infeed ads along with article count making the page number change before it reaches last article.
|
|
209
|
+
data = data.map(function (ele, i) {
|
|
210
|
+
if (ele._type === 'lg-infeed') {
|
|
211
|
+
// Setting pos as top2 for the first occurence of large infeed ad
|
|
212
|
+
// const pos = data.indexOf(data.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
|
|
213
|
+
return _extends._extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends._extends({}, ele.targeting, { pos: 'lg-infeed' }) });
|
|
214
|
+
} else {
|
|
215
|
+
return ele;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
return React__default['default'].createElement(
|
|
220
|
+
'div',
|
|
221
|
+
null,
|
|
222
|
+
data && _this.state.dataRemapped && data.length > 0 ? // If JS enabled and Data remapped with ads
|
|
223
|
+
data.map(function (row, index) {
|
|
224
|
+
if (row._type === 'lg-infeed' && row.adUnit) {
|
|
225
|
+
return React__default['default'].createElement(ADlgInfeed.ADlgInfeed, _extends._extends({ index: index }, row));
|
|
226
|
+
// Returning view for infeed Ad
|
|
227
|
+
} else if (row._type === 'brandInsightAd' && row.adUnit) {
|
|
228
|
+
return React__default['default'].createElement(ADInfeed.ADInfeed, { index: index, infeedAd: row });
|
|
229
|
+
} else if (!row._type || !['lg-infeed', 'brandInsightAd'].includes(row._type)) {
|
|
230
|
+
// Returning view for articles
|
|
231
|
+
return React__default['default'].createElement(
|
|
232
|
+
React__default['default'].Fragment,
|
|
233
|
+
{ key: index },
|
|
234
|
+
React__default['default'].createElement(_this2.Deck, { data: row, variant: variant, index: index, client: _this.props.client, defaultImage: _this.defaultImage, isSeriesLanding: _this.isSeriesLanding }),
|
|
235
|
+
_this.state.mobileView && _this.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && React__default['default'].createElement(
|
|
236
|
+
'div',
|
|
237
|
+
{ className: 'ad-container', style: { margin: '0 auto' } },
|
|
238
|
+
_this.renderMobileAd(index, numberOfItemsBeforeAd, _this.rightItems)
|
|
239
|
+
)
|
|
240
|
+
);
|
|
241
|
+
} else {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}) : data && data.length > 0 ? // For Javascript Disabled Cases. data is not remapped if JS is disabled.
|
|
245
|
+
data.map(function (row, index) {
|
|
246
|
+
if (!row._type || !['lg-infeed', 'brandInsightAd'].includes(row._type)) {
|
|
247
|
+
return React__default['default'].createElement(
|
|
248
|
+
React__default['default'].Fragment,
|
|
249
|
+
{ key: index },
|
|
250
|
+
React__default['default'].createElement(_this2.Deck, { data: row, variant: variant, index: index, client: _this.props.client, defaultImage: _this.defaultImage, isSeriesLanding: _this.isSeriesLanding })
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}) : React__default['default'].createElement(
|
|
254
|
+
'div',
|
|
255
|
+
null,
|
|
256
|
+
React__default['default'].createElement(
|
|
257
|
+
'em',
|
|
258
|
+
null,
|
|
259
|
+
'New content coming soon, please check back later.'
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
);
|
|
263
|
+
}, _this.renderMobileAd = function (index, numberOfItemsBeforeAd, rightItems) {
|
|
264
|
+
var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
|
|
265
|
+
return React__default['default'].createElement(
|
|
266
|
+
'div',
|
|
267
|
+
{ className: 'ad-container', style: { display: 'flex', flex: '1 0 auto', width: '100%', textAlign: 'center', marginBottom: '2rem' } },
|
|
268
|
+
rightItems[i].component
|
|
269
|
+
);
|
|
270
|
+
}, _this.handlePageChange = function () {
|
|
271
|
+
var _ref3 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(selectedPage) {
|
|
272
|
+
var itemsPerPage, _this$props2, query, params, client, dataHandler, seoPaginate, start, newParams, dataHandlerPromise, newData;
|
|
273
|
+
|
|
274
|
+
return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
|
|
275
|
+
while (1) {
|
|
276
|
+
switch (_context.prev = _context.next) {
|
|
277
|
+
case 0:
|
|
278
|
+
itemsPerPage = _this.state.itemsPerPage;
|
|
279
|
+
_this$props2 = _this.props, query = _this$props2.query, params = _this$props2.params, client = _this$props2.client, dataHandler = _this$props2.dataHandler, seoPaginate = _this$props2.seoPaginate;
|
|
280
|
+
|
|
281
|
+
_this.setState({ isDataLoading: true, currentPage: selectedPage });
|
|
282
|
+
seoPaginate && _this.seoPagination(selectedPage);
|
|
283
|
+
index.lib_3.refresh();
|
|
284
|
+
document.body.scrollTop = 0;
|
|
285
|
+
document.documentElement.scrollTop = 0;
|
|
286
|
+
start = (selectedPage - 1) * itemsPerPage;
|
|
287
|
+
newParams = _extends._extends({}, params, {
|
|
288
|
+
from: start,
|
|
289
|
+
to: start + itemsPerPage
|
|
290
|
+
});
|
|
291
|
+
dataHandlerPromise = null;
|
|
292
|
+
|
|
293
|
+
if (dataHandler) {
|
|
294
|
+
dataHandlerPromise = new asyncToGenerator._Promise(function (resolve, reject) {
|
|
295
|
+
try {
|
|
296
|
+
var result = dataHandler(newParams);
|
|
297
|
+
resolve(result);
|
|
298
|
+
} catch (e) {
|
|
299
|
+
reject(e);
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
_context.prev = 11;
|
|
305
|
+
|
|
306
|
+
if (!dataHandlerPromise) {
|
|
307
|
+
_context.next = 18;
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
_context.next = 15;
|
|
312
|
+
return dataHandlerPromise;
|
|
313
|
+
|
|
314
|
+
case 15:
|
|
315
|
+
_context.t0 = _context.sent;
|
|
316
|
+
_context.next = 21;
|
|
317
|
+
break;
|
|
318
|
+
|
|
319
|
+
case 18:
|
|
320
|
+
_context.next = 20;
|
|
321
|
+
return client.fetch(query, newParams);
|
|
322
|
+
|
|
323
|
+
case 20:
|
|
324
|
+
_context.t0 = _context.sent;
|
|
325
|
+
|
|
326
|
+
case 21:
|
|
327
|
+
newData = _context.t0;
|
|
328
|
+
|
|
329
|
+
if (_this.pointer && _this.pointerArray) newData = newData[_this.pointerArray][_this.pointer];
|
|
330
|
+
if (newData && newData.length > 0) {
|
|
331
|
+
_this.setState({ isDataLoading: false, data: newData });
|
|
332
|
+
}
|
|
333
|
+
_context.next = 29;
|
|
334
|
+
break;
|
|
335
|
+
|
|
336
|
+
case 26:
|
|
337
|
+
_context.prev = 26;
|
|
338
|
+
_context.t1 = _context['catch'](11);
|
|
339
|
+
|
|
340
|
+
console.error(_context.t1);
|
|
341
|
+
|
|
342
|
+
case 29:
|
|
343
|
+
case 'end':
|
|
344
|
+
return _context.stop();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}, _callee, _this2, [[11, 26]]);
|
|
348
|
+
}));
|
|
349
|
+
|
|
350
|
+
return function (_x) {
|
|
351
|
+
return _ref3.apply(this, arguments);
|
|
352
|
+
};
|
|
353
|
+
}(), _temp), inherits._possibleConstructorReturn(_this, _ret);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
inherits._createClass(MasterDeck, [{
|
|
357
|
+
key: 'componentDidUpdate',
|
|
358
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
359
|
+
if (stringify._JSON$stringify(this.state.prevData) !== stringify._JSON$stringify(prevState.prevData) && this.props.seoPaginate) {
|
|
360
|
+
this.seoPagination(this.state.currentPage);
|
|
361
|
+
}
|
|
362
|
+
// set dataRemap to true as there are no infeed or BI ads or window width is less than limit
|
|
363
|
+
if (typeof window !== 'undefined' && (!this.props.lgInfeedAd || !this.props.brandInsightAd || window.innerWidth < 1400) && !this.state.dataRemapped) {
|
|
364
|
+
!this.state.dataRemapped && this.setState({ dataRemapped: true });
|
|
365
|
+
}
|
|
366
|
+
if (typeof window !== 'undefined' && window.innerWidth <= 1191) {
|
|
367
|
+
!this.state.mobileView && this.setState({ mobileView: true });
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}, {
|
|
371
|
+
key: 'render',
|
|
372
|
+
value: function render() {
|
|
373
|
+
// Setting default value for 'showBI' and 'lgInfeedAd'
|
|
374
|
+
var _props = this.props,
|
|
375
|
+
variant = _props.variant,
|
|
376
|
+
brandInsightAd = _props.brandInsightAd,
|
|
377
|
+
_props$showBI = _props.showBI,
|
|
378
|
+
showBI = _props$showBI === undefined ? false : _props$showBI,
|
|
379
|
+
_props$lgInfeedAd = _props.lgInfeedAd,
|
|
380
|
+
lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd,
|
|
381
|
+
totalDataCount = _props.totalDataCount;
|
|
382
|
+
var _state = this.state,
|
|
383
|
+
data = _state.data,
|
|
384
|
+
itemsPerPage = _state.itemsPerPage,
|
|
385
|
+
currentPage = _state.currentPage,
|
|
386
|
+
isDataLoading = _state.isDataLoading;
|
|
387
|
+
|
|
388
|
+
return React__default['default'].createElement(
|
|
389
|
+
'div',
|
|
390
|
+
{ className: 'contentDeck' },
|
|
391
|
+
isDataLoading ? React__default['default'].createElement(
|
|
392
|
+
'div',
|
|
393
|
+
{ className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
|
|
394
|
+
React__default['default'].createElement(
|
|
395
|
+
Spinner__default['default'],
|
|
396
|
+
{ animation: 'border', role: 'status' },
|
|
397
|
+
React__default['default'].createElement(
|
|
398
|
+
'span',
|
|
399
|
+
{ className: 'sr-only' },
|
|
400
|
+
'Loading...'
|
|
401
|
+
)
|
|
402
|
+
)
|
|
403
|
+
) : data && data.length > 0 ? React__default['default'].createElement(
|
|
404
|
+
Container__default['default'],
|
|
405
|
+
null,
|
|
406
|
+
this.cardLoader({ variant: variant, brandInsightAd: brandInsightAd, showBI: showBI, lgInfeedAd: lgInfeedAd }),
|
|
407
|
+
React__default['default'].createElement(
|
|
408
|
+
'div',
|
|
409
|
+
{ className: 'pagination-wrapper' },
|
|
410
|
+
React__default['default'].createElement(Pagination.Pagination, {
|
|
411
|
+
pageCount: Math.ceil(totalDataCount / itemsPerPage),
|
|
412
|
+
pageRangeDisplayed: main.main_43 ? 3 : 9,
|
|
413
|
+
currentPage: currentPage,
|
|
414
|
+
onPageChange: this.handlePageChange
|
|
415
|
+
}),
|
|
416
|
+
React__default['default'].createElement(
|
|
417
|
+
'style',
|
|
418
|
+
{ jsx: 'true' },
|
|
419
|
+
'\n .pagination-wrapper {\n margin: 3rem 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-wrapper {\n margin-bottom: 6rem;\n }\n }\n '
|
|
420
|
+
)
|
|
421
|
+
)
|
|
422
|
+
) : null
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
}], [{
|
|
426
|
+
key: 'getDerivedStateFromProps',
|
|
427
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
428
|
+
if (stringify._JSON$stringify(props.dataRecord) !== stringify._JSON$stringify(state.prevData)) {
|
|
429
|
+
return {
|
|
430
|
+
data: props.dataRecord,
|
|
431
|
+
prevData: props.dataRecord,
|
|
432
|
+
currentPage: props.currentPage
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
return null;
|
|
436
|
+
}
|
|
437
|
+
// Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
|
|
438
|
+
|
|
439
|
+
}]);
|
|
440
|
+
|
|
441
|
+
return MasterDeck;
|
|
442
|
+
}(React__default['default'].Component);
|
|
443
|
+
|
|
444
|
+
var MasterDeck$1 = Router.withRouter(MasterDeck);
|
|
445
|
+
|
|
446
|
+
module.exports = MasterDeck$1;
|