@atlaskit/help 6.0.5 → 7.0.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 +24 -0
- package/dist/cjs/components/Article/HelpArticle/index.js +6 -8
- package/dist/cjs/components/Article/index.js +2 -2
- package/dist/cjs/components/Help.js +3 -1
- package/dist/cjs/components/Search/SearchResults/index.js +8 -11
- package/dist/cjs/components/WhatsNew/WhatsNewButton/index.js +6 -8
- package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +1 -1
- package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +6 -8
- package/dist/cjs/components/WhatsNew/WhatsNewResults/index.js +4 -4
- package/dist/cjs/components/contexts/navigationContext.js +110 -49
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/Article/HelpArticle/index.js +6 -8
- package/dist/es2019/components/Search/SearchResults/index.js +6 -9
- package/dist/es2019/components/WhatsNew/WhatsNewButton/index.js +6 -8
- package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +1 -1
- package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +6 -8
- package/dist/es2019/components/WhatsNew/WhatsNewResults/index.js +2 -2
- package/dist/es2019/components/contexts/navigationContext.js +98 -38
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/Article/HelpArticle/index.js +6 -8
- package/dist/esm/components/Article/index.js +2 -2
- package/dist/esm/components/Help.js +2 -1
- package/dist/esm/components/Search/SearchResults/index.js +8 -11
- package/dist/esm/components/WhatsNew/WhatsNewButton/index.js +6 -8
- package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +1 -1
- package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +6 -8
- package/dist/esm/components/WhatsNew/WhatsNewResults/index.js +4 -4
- package/dist/esm/components/contexts/navigationContext.js +107 -49
- package/dist/esm/version.json +1 -1
- package/dist/types/components/contexts/navigationContext.d.ts +12 -7
- package/dist/types/model/Help.d.ts +8 -4
- package/package.json +5 -5
|
@@ -49,7 +49,7 @@ export const WhatsNewResults = ({
|
|
|
49
49
|
searchWhatsNewArticlesResult,
|
|
50
50
|
onSearchWhatsNewArticles,
|
|
51
51
|
searchWhatsNewArticlesState,
|
|
52
|
-
|
|
52
|
+
onWhatsNewResultItemClick
|
|
53
53
|
} = useWhatsNewArticleContext();
|
|
54
54
|
const SELECT_DEFAULT_VALUE = {
|
|
55
55
|
value: '',
|
|
@@ -129,7 +129,7 @@ export const WhatsNewResults = ({
|
|
|
129
129
|
}
|
|
130
130
|
})), /*#__PURE__*/React.createElement(WhatsNewResultsListContainer, null, searchWhatsNewArticlesResult.articles.length > 0 ? /*#__PURE__*/React.createElement(WhatsNewResultsList, {
|
|
131
131
|
whatsNewArticles: searchWhatsNewArticlesResult.articles,
|
|
132
|
-
onWhatsNewResultItemClick:
|
|
132
|
+
onWhatsNewResultItemClick: onWhatsNewResultItemClick,
|
|
133
133
|
onShowMoreButtonClick: handleOnShowMoreButtonClick,
|
|
134
134
|
hasNextPage: searchWhatsNewArticlesResult === null || searchWhatsNewArticlesResult === void 0 ? void 0 : searchWhatsNewArticlesResult.hasNextPage,
|
|
135
135
|
nextPage: searchWhatsNewArticlesResult === null || searchWhatsNewArticlesResult === void 0 ? void 0 : searchWhatsNewArticlesResult.nextPage,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useReducer, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
+
import isEqual from 'lodash/isEqual';
|
|
2
3
|
import { REQUEST_STATE } from '../../model/Requests';
|
|
3
4
|
import { ARTICLE_TYPE } from '../../model/Help';
|
|
4
5
|
import { createCtx } from '../../util/hooks/ctx';
|
|
@@ -8,6 +9,10 @@ import { useWhatsNewArticleContext } from './whatsNewArticleContext';
|
|
|
8
9
|
import { useHomeContext } from './homeContext';
|
|
9
10
|
import { useSearchContext } from './searchContext';
|
|
10
11
|
import { useHeaderContext } from './headerContext';
|
|
12
|
+
const DEFAULT_ARTICLE_ID = {
|
|
13
|
+
id: '',
|
|
14
|
+
type: ARTICLE_TYPE.HELP_ARTICLE
|
|
15
|
+
};
|
|
11
16
|
export const [useNavigationContext, CtxProvider] = createCtx();
|
|
12
17
|
|
|
13
18
|
const getNewHistoryItem = (id, type) => {
|
|
@@ -39,6 +44,21 @@ const getSimpleHistory = history => history.map(historyItem => {
|
|
|
39
44
|
type
|
|
40
45
|
};
|
|
41
46
|
});
|
|
47
|
+
/**
|
|
48
|
+
* Get history data (list of IDs and UID)
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const getHistoryData = history => history.map(historyItem => {
|
|
53
|
+
const {
|
|
54
|
+
id,
|
|
55
|
+
uid
|
|
56
|
+
} = historyItem;
|
|
57
|
+
return {
|
|
58
|
+
id,
|
|
59
|
+
uid
|
|
60
|
+
};
|
|
61
|
+
});
|
|
42
62
|
/**
|
|
43
63
|
* Get the last article in the history
|
|
44
64
|
*/
|
|
@@ -111,10 +131,28 @@ const navigationReducer = ({
|
|
|
111
131
|
const {
|
|
112
132
|
payload: newArticleId
|
|
113
133
|
} = action;
|
|
134
|
+
|
|
135
|
+
if (isEqual(newArticleId, DEFAULT_ARTICLE_ID)) {
|
|
136
|
+
newState = {
|
|
137
|
+
articleId: newArticleId,
|
|
138
|
+
history: [],
|
|
139
|
+
view: VIEW.DEFAULT_CONTENT
|
|
140
|
+
};
|
|
141
|
+
} else {
|
|
142
|
+
newState = {
|
|
143
|
+
articleId: newArticleId,
|
|
144
|
+
history: [...currentHistory, getNewHistoryItem(newArticleId.id, newArticleId.type)],
|
|
145
|
+
view: getViewForArticleId(newArticleId)
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
} else if (action.type === 'addNewHistoryItem' && action.payload) {
|
|
149
|
+
const {
|
|
150
|
+
payload: newArticleId
|
|
151
|
+
} = action;
|
|
114
152
|
newState = {
|
|
115
|
-
articleId:
|
|
153
|
+
articleId: currentArticleId,
|
|
116
154
|
history: [...currentHistory, getNewHistoryItem(newArticleId.id, newArticleId.type)],
|
|
117
|
-
view: getViewForArticleId(
|
|
155
|
+
view: getViewForArticleId(currentArticleId)
|
|
118
156
|
};
|
|
119
157
|
} else if (action.type === 'updateHistoryItem' && action.payload) {
|
|
120
158
|
const {
|
|
@@ -175,13 +213,11 @@ const navigationReducer = ({
|
|
|
175
213
|
};
|
|
176
214
|
|
|
177
215
|
export const NavigationContextProvider = ({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
216
|
+
navigationData = {
|
|
217
|
+
articleId: DEFAULT_ARTICLE_ID,
|
|
218
|
+
history: []
|
|
181
219
|
},
|
|
182
|
-
|
|
183
|
-
history: propsHistory = [],
|
|
184
|
-
historySetter,
|
|
220
|
+
setNavigationData,
|
|
185
221
|
children
|
|
186
222
|
}) => {
|
|
187
223
|
const {
|
|
@@ -202,6 +238,10 @@ export const NavigationContextProvider = ({
|
|
|
202
238
|
const {
|
|
203
239
|
onCloseButtonClick
|
|
204
240
|
} = useHeaderContext();
|
|
241
|
+
const {
|
|
242
|
+
articleId: propsArticleId,
|
|
243
|
+
history: propsHistory
|
|
244
|
+
} = navigationData;
|
|
205
245
|
const [{
|
|
206
246
|
articleId: currentArticleId,
|
|
207
247
|
history: currentHistory,
|
|
@@ -221,8 +261,6 @@ export const NavigationContextProvider = ({
|
|
|
221
261
|
/**
|
|
222
262
|
* - If default content isn't defined and the history only has one article,
|
|
223
263
|
* we should not display the back button
|
|
224
|
-
* - If the prop.article.setArticleId is not defined, we should also hide the back
|
|
225
|
-
* button because we are not able to navigate though the history without it
|
|
226
264
|
*/
|
|
227
265
|
if (currentHistory.length === 1 && !isDefaultContentDefined || currentView === VIEW.WHATS_NEW && !isDefaultContentDefined) {
|
|
228
266
|
return false;
|
|
@@ -339,6 +377,12 @@ export const NavigationContextProvider = ({
|
|
|
339
377
|
onCloseButtonClick(event, analyticsEvent);
|
|
340
378
|
}
|
|
341
379
|
}, [onCloseButtonClick]);
|
|
380
|
+
const onOpenArticle = useCallback(newArticleId => {
|
|
381
|
+
dispatchNavigationAction({
|
|
382
|
+
type: 'addNewHistoryItem',
|
|
383
|
+
payload: newArticleId
|
|
384
|
+
});
|
|
385
|
+
}, []);
|
|
342
386
|
useEffect(() => {
|
|
343
387
|
if (isSearchResultVisible) {
|
|
344
388
|
dispatchNavigationAction({
|
|
@@ -348,43 +392,59 @@ export const NavigationContextProvider = ({
|
|
|
348
392
|
}
|
|
349
393
|
}, [isSearchResultVisible]);
|
|
350
394
|
useEffect(() => {
|
|
351
|
-
const
|
|
352
|
-
historySetter && historySetter(simpleHistory);
|
|
353
|
-
}, [historySetter, currentHistory]);
|
|
354
|
-
useEffect(() => {
|
|
395
|
+
const lastHistoryItem = currentHistory.length > 0 ? getCurrentArticle(currentHistory) : getNewHistoryItem(DEFAULT_ARTICLE_ID.id, DEFAULT_ARTICLE_ID.type);
|
|
355
396
|
/**
|
|
356
397
|
* If the propsArticleId.id (host articleId) is different from currentArticleId.id (internal articleId)
|
|
357
|
-
* it means the host updated propsArticleId and we need to use this new value to load a new article.
|
|
358
398
|
* */
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
type: 'newArticle',
|
|
362
|
-
payload: propsArticleId
|
|
363
|
-
});
|
|
364
|
-
} else {
|
|
399
|
+
|
|
400
|
+
if (!isEqual(propsArticleId, currentArticleId)) {
|
|
365
401
|
/**
|
|
366
|
-
* If the
|
|
367
|
-
*
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
* */
|
|
371
|
-
const lastHistoryItem = currentHistory.length > 0 ? getCurrentArticle(currentHistory) : getNewHistoryItem('', ARTICLE_TYPE.HELP_ARTICLE);
|
|
372
|
-
|
|
373
|
-
if (articleIdSetter && lastHistoryItem && (currentArticleId.id !== lastHistoryItem.id || currentArticleId.type !== lastHistoryItem.type)) {
|
|
402
|
+
* If propsArticleId and lastHistoryItem are the same, we just need to update the articleId
|
|
403
|
+
* because is out of sync
|
|
404
|
+
*/
|
|
405
|
+
if (propsArticleId.id === lastHistoryItem.id && propsArticleId.type === lastHistoryItem.type) {
|
|
374
406
|
dispatchNavigationAction({
|
|
375
407
|
type: 'updateArticleId',
|
|
376
|
-
payload:
|
|
377
|
-
id: lastHistoryItem.id,
|
|
378
|
-
type: lastHistoryItem.type
|
|
379
|
-
}
|
|
408
|
+
payload: propsArticleId
|
|
380
409
|
});
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
410
|
+
} else {
|
|
411
|
+
/**
|
|
412
|
+
* Otherwise we need to add a new article
|
|
413
|
+
*/
|
|
414
|
+
dispatchNavigationAction({
|
|
415
|
+
type: 'newArticle',
|
|
416
|
+
payload: propsArticleId
|
|
384
417
|
});
|
|
385
418
|
}
|
|
419
|
+
} else {
|
|
420
|
+
// console.log('same articleId');
|
|
421
|
+
if (setNavigationData) {
|
|
422
|
+
const simpleHistory = getSimpleHistory(currentHistory);
|
|
423
|
+
|
|
424
|
+
if (currentArticleId.id !== lastHistoryItem.id || currentArticleId.type !== lastHistoryItem.type) {
|
|
425
|
+
/**
|
|
426
|
+
* If the propsArticleId.id (host articleId) is equal to currentArticleId.id (internal articleId)
|
|
427
|
+
* and the id from the last history item is different from currentArticleId.id, it means the history
|
|
428
|
+
* changed
|
|
429
|
+
* */
|
|
430
|
+
if (setNavigationData) {
|
|
431
|
+
setNavigationData({
|
|
432
|
+
articleId: {
|
|
433
|
+
id: lastHistoryItem.id,
|
|
434
|
+
type: lastHistoryItem.type
|
|
435
|
+
},
|
|
436
|
+
history: simpleHistory
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
} else if (!isEqual(getHistoryData(propsHistory), getHistoryData(currentHistory))) {
|
|
440
|
+
setNavigationData({
|
|
441
|
+
articleId: propsArticleId,
|
|
442
|
+
history: simpleHistory
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
}
|
|
386
446
|
}
|
|
387
|
-
}, [currentArticleId, propsArticleId, currentHistory,
|
|
447
|
+
}, [currentArticleId, propsArticleId, currentHistory, setNavigationData, propsHistory]);
|
|
388
448
|
useEffect(() => {
|
|
389
449
|
const requestNewArticle = async historyItem => {
|
|
390
450
|
const historyItemUpdate = await fetchArticleData(historyItem);
|
|
@@ -408,7 +468,7 @@ export const NavigationContextProvider = ({
|
|
|
408
468
|
value: {
|
|
409
469
|
view: currentView,
|
|
410
470
|
articleId: currentArticleId,
|
|
411
|
-
|
|
471
|
+
openArticle: onOpenArticle,
|
|
412
472
|
history: currentHistory,
|
|
413
473
|
getCurrentArticle: () => getCurrentArticle(currentHistory),
|
|
414
474
|
getCurrentArticleItemData: () => getCurrentArticleItemSlim(currentHistory),
|
package/dist/es2019/version.json
CHANGED
|
@@ -14,7 +14,7 @@ export var HelpArticle = function HelpArticle(_ref) {
|
|
|
14
14
|
isLoading = _ref.isLoading;
|
|
15
15
|
|
|
16
16
|
var _useNavigationContext = useNavigationContext(),
|
|
17
|
-
|
|
17
|
+
openArticle = _useNavigationContext.openArticle,
|
|
18
18
|
getCurrentArticleItemData = _useNavigationContext.getCurrentArticleItemData;
|
|
19
19
|
|
|
20
20
|
var _useHelpArticleContex = useHelpArticleContext(),
|
|
@@ -56,13 +56,11 @@ export var HelpArticle = function HelpArticle(_ref) {
|
|
|
56
56
|
onRelatedArticlesListItemClick(event, analyticsEvent, articleData);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}, [setArticleId, onRelatedArticlesListItemClick]);
|
|
59
|
+
openArticle({
|
|
60
|
+
id: articleData.id,
|
|
61
|
+
type: ARTICLE_TYPE.HELP_ARTICLE
|
|
62
|
+
});
|
|
63
|
+
}, [openArticle, onRelatedArticlesListItemClick]);
|
|
66
64
|
var handleOnRelatedArticlesShowMoreClick = useCallback(function (event, analyticsEvent, isCollapsed) {
|
|
67
65
|
analyticsEvent.payload.attributes = {
|
|
68
66
|
componentName: 'Article',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
|
|
8
8
|
import React, { useState, useLayoutEffect, useRef, useEffect, useCallback } from 'react';
|
|
9
9
|
import { Transition } from 'react-transition-group';
|
|
@@ -5,6 +5,7 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
+
var _excluded = ["children", "footer"];
|
|
8
9
|
|
|
9
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
11
|
|
|
@@ -39,7 +40,7 @@ export var Help = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
39
40
|
var _this$props = this.props,
|
|
40
41
|
children = _this$props.children,
|
|
41
42
|
footer = _this$props.footer,
|
|
42
|
-
rest = _objectWithoutProperties(_this$props,
|
|
43
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
43
44
|
|
|
44
45
|
return /*#__PURE__*/React.createElement(HeaderContextProvider, rest.header, /*#__PURE__*/React.createElement(HomeContextProvider, _extends({}, rest.home, {
|
|
45
46
|
homeContent: children
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
|
|
3
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
|
|
5
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
6
|
|
|
7
7
|
import React, { useCallback } from 'react';
|
|
8
8
|
import { Transition } from 'react-transition-group';
|
|
@@ -50,19 +50,16 @@ export var SearchResults = function SearchResults() {
|
|
|
50
50
|
onSearchExternalUrlClick = _useSearchContext.onSearchExternalUrlClick;
|
|
51
51
|
|
|
52
52
|
var _useNavigationContext = useNavigationContext(),
|
|
53
|
-
|
|
53
|
+
openArticle = _useNavigationContext.openArticle,
|
|
54
54
|
view = _useNavigationContext.view;
|
|
55
55
|
|
|
56
56
|
var handleOnSearchResultItemClick = useCallback(function (event, analyticsEvent, articleData) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
57
|
+
openArticle({
|
|
58
|
+
id: articleData.id,
|
|
59
|
+
type: ARTICLE_TYPE.HELP_ARTICLE
|
|
60
|
+
});
|
|
64
61
|
onSearchResultItemClick(event, analyticsEvent, articleData);
|
|
65
|
-
}, [onSearchResultItemClick,
|
|
62
|
+
}, [onSearchResultItemClick, openArticle]);
|
|
66
63
|
return /*#__PURE__*/React.createElement(Transition, {
|
|
67
64
|
in: view === VIEW.SEARCH && isSearchResultVisible,
|
|
68
65
|
timeout: FADEIN_OVERLAY_TRANSITION_DURATION_MS
|
|
@@ -23,20 +23,18 @@ export var WhatsNewButton = function WhatsNewButton(_ref) {
|
|
|
23
23
|
whatsNewGetNotificationProvider = _useWhatsNewArticleCo.whatsNewGetNotificationProvider;
|
|
24
24
|
|
|
25
25
|
var _useNavigationContext = useNavigationContext(),
|
|
26
|
-
|
|
26
|
+
openArticle = _useNavigationContext.openArticle;
|
|
27
27
|
|
|
28
28
|
var handleOnButtonClick = useCallback(function (id, analytics, event) {
|
|
29
29
|
if (onWhatsNewButtonClick) {
|
|
30
30
|
onWhatsNewButtonClick(event, analytics);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}, [onWhatsNewButtonClick, setArticleId]);
|
|
33
|
+
openArticle({
|
|
34
|
+
id: '',
|
|
35
|
+
type: ARTICLE_TYPE.WHATS_NEW
|
|
36
|
+
});
|
|
37
|
+
}, [onWhatsNewButtonClick, openArticle]);
|
|
40
38
|
return /*#__PURE__*/React.createElement(HelpContentButton, {
|
|
41
39
|
id: "whats-new",
|
|
42
40
|
key: "whats-new",
|
package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js
CHANGED
|
@@ -27,7 +27,7 @@ var WhatsNewResultsList = function WhatsNewResultsList(_ref) {
|
|
|
27
27
|
var featureRolloutDateString = whatsNewArticle === null || whatsNewArticle === void 0 ? void 0 : whatsNewArticle.featureRolloutDate;
|
|
28
28
|
|
|
29
29
|
if (featureRolloutDateString) {
|
|
30
|
-
var featureRolloutDateArray = featureRolloutDateString.replace('
|
|
30
|
+
var featureRolloutDateArray = featureRolloutDateString.replace('/-/g', '/');
|
|
31
31
|
var featureRolloutDate = toDate(new Date(featureRolloutDateArray));
|
|
32
32
|
|
|
33
33
|
if (whatsNewArticlesGroupedByDateTemp[featureRolloutDateString]) {
|
|
@@ -31,7 +31,7 @@ var WhatsNewResultsList = function WhatsNewResultsList(_ref) {
|
|
|
31
31
|
onShowMoreButtonClick = _ref.onShowMoreButtonClick;
|
|
32
32
|
|
|
33
33
|
var _useNavigationContext = useNavigationContext(),
|
|
34
|
-
|
|
34
|
+
openArticle = _useNavigationContext.openArticle;
|
|
35
35
|
|
|
36
36
|
var handleShowMoreButtonClick = function handleShowMoreButtonClick(event, analyticsEvent) {
|
|
37
37
|
if (onShowMoreButtonClick) {
|
|
@@ -40,17 +40,15 @@ var WhatsNewResultsList = function WhatsNewResultsList(_ref) {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
var handleOnWhatsNewResultItemClick = useCallback(function (event, analyticsEvent, articleData) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
}
|
|
43
|
+
openArticle({
|
|
44
|
+
id: articleData.id,
|
|
45
|
+
type: ARTICLE_TYPE.WHATS_NEW
|
|
46
|
+
});
|
|
49
47
|
|
|
50
48
|
if (onWhatsNewResultItemClick) {
|
|
51
49
|
onWhatsNewResultItemClick(event, analyticsEvent, articleData);
|
|
52
50
|
}
|
|
53
|
-
}, [onWhatsNewResultItemClick,
|
|
51
|
+
}, [onWhatsNewResultItemClick, openArticle]);
|
|
54
52
|
return whatsNewArticles && whatsNewArticles.length > 0 ? /*#__PURE__*/React.createElement(WhatsNewResultsListContainer, null, /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
55
53
|
theme: _defineProperty({}, itemThemeNamespace, ITEM_THEME)
|
|
56
54
|
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ArticlesList, {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
4
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
|
|
6
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
|
|
8
8
|
import React, { useCallback, useState } from 'react';
|
|
9
9
|
import { Transition } from 'react-transition-group';
|
|
@@ -54,7 +54,7 @@ export var WhatsNewResults = function WhatsNewResults(_ref) {
|
|
|
54
54
|
searchWhatsNewArticlesResult = _useWhatsNewArticleCo.searchWhatsNewArticlesResult,
|
|
55
55
|
onSearchWhatsNewArticles = _useWhatsNewArticleCo.onSearchWhatsNewArticles,
|
|
56
56
|
searchWhatsNewArticlesState = _useWhatsNewArticleCo.searchWhatsNewArticlesState,
|
|
57
|
-
|
|
57
|
+
onWhatsNewResultItemClick = _useWhatsNewArticleCo.onWhatsNewResultItemClick;
|
|
58
58
|
|
|
59
59
|
var SELECT_DEFAULT_VALUE = {
|
|
60
60
|
value: '',
|
|
@@ -136,7 +136,7 @@ export var WhatsNewResults = function WhatsNewResults(_ref) {
|
|
|
136
136
|
}
|
|
137
137
|
})), /*#__PURE__*/React.createElement(WhatsNewResultsListContainer, null, searchWhatsNewArticlesResult.articles.length > 0 ? /*#__PURE__*/React.createElement(WhatsNewResultsList, {
|
|
138
138
|
whatsNewArticles: searchWhatsNewArticlesResult.articles,
|
|
139
|
-
onWhatsNewResultItemClick:
|
|
139
|
+
onWhatsNewResultItemClick: onWhatsNewResultItemClick,
|
|
140
140
|
onShowMoreButtonClick: handleOnShowMoreButtonClick,
|
|
141
141
|
hasNextPage: searchWhatsNewArticlesResult === null || searchWhatsNewArticlesResult === void 0 ? void 0 : searchWhatsNewArticlesResult.hasNextPage,
|
|
142
142
|
nextPage: searchWhatsNewArticlesResult === null || searchWhatsNewArticlesResult === void 0 ? void 0 : searchWhatsNewArticlesResult.nextPage,
|