@atlaskit/help 7.1.24 → 7.1.26

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.
Files changed (201) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics.js +0 -6
  3. package/dist/cjs/assets/ErrorImage.js +0 -4
  4. package/dist/cjs/assets/NotFoundImage.js +0 -4
  5. package/dist/cjs/assets/SomethingWrongImage.js +0 -4
  6. package/dist/cjs/assets/WhatsNewIcoExperiment.js +0 -4
  7. package/dist/cjs/assets/WhatsNewIconFix.js +0 -4
  8. package/dist/cjs/assets/WhatsNewIconImprovement.js +0 -4
  9. package/dist/cjs/assets/WhatsNewIconNew.js +0 -4
  10. package/dist/cjs/assets/WhatsNewIconRemoved.js +0 -4
  11. package/dist/cjs/components/Article/ArticleContent/index.js +2 -16
  12. package/dist/cjs/components/Article/ArticleLoadingFail/index.js +2 -20
  13. package/dist/cjs/components/Article/ArticleLoadingFail/styled.js +0 -9
  14. package/dist/cjs/components/Article/HelpArticle/Loading/index.js +0 -9
  15. package/dist/cjs/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulNoButton.js +4 -21
  16. package/dist/cjs/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulYesButton.js +4 -21
  17. package/dist/cjs/components/Article/HelpArticle/WasHelpfulForm/index.js +26 -78
  18. package/dist/cjs/components/Article/HelpArticle/WasHelpfulForm/styled.js +0 -15
  19. package/dist/cjs/components/Article/HelpArticle/index.js +9 -39
  20. package/dist/cjs/components/Article/WhatsNewArticle/Loading/index.js +0 -10
  21. package/dist/cjs/components/Article/WhatsNewArticle/index.js +2 -28
  22. package/dist/cjs/components/Article/WhatsNewArticle/styled.js +0 -21
  23. package/dist/cjs/components/Article/index.js +16 -46
  24. package/dist/cjs/components/Article/styled.js +0 -7
  25. package/dist/cjs/components/ArticlesList/ArticlesList.js +8 -19
  26. package/dist/cjs/components/ArticlesList/ArticlesListItem/index.js +6 -28
  27. package/dist/cjs/components/ArticlesList/ArticlesListItem/styled.js +0 -21
  28. package/dist/cjs/components/ArticlesList/index.js +8 -28
  29. package/dist/cjs/components/ArticlesList/styled.js +0 -12
  30. package/dist/cjs/components/Help.js +5 -36
  31. package/dist/cjs/components/HelpContent.js +14 -47
  32. package/dist/cjs/components/HelpContentButton/index.js +10 -28
  33. package/dist/cjs/components/HelpContentButton/styled.js +0 -19
  34. package/dist/cjs/components/RelatedArticles/RelatedArticlesLoading.js +0 -9
  35. package/dist/cjs/components/RelatedArticles/index.js +17 -57
  36. package/dist/cjs/components/RelatedArticles/styled.js +1 -22
  37. package/dist/cjs/components/Search/SearchInput/index.js +6 -40
  38. package/dist/cjs/components/Search/SearchInput/styled.js +0 -11
  39. package/dist/cjs/components/Search/SearchResults/SearchExternalSite.js +3 -23
  40. package/dist/cjs/components/Search/SearchResults/SearchResults.js +2 -7
  41. package/dist/cjs/components/Search/SearchResults/SearchResultsEmpty.js +3 -24
  42. package/dist/cjs/components/Search/SearchResults/SearchResultsError.js +1 -12
  43. package/dist/cjs/components/Search/SearchResults/index.js +9 -33
  44. package/dist/cjs/components/Search/SearchResults/styled.js +0 -19
  45. package/dist/cjs/components/ShowMoreButton/index.js +7 -18
  46. package/dist/cjs/components/WhatsNew/WhatsNewButton/index.js +4 -29
  47. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsEmpty/index.js +2 -16
  48. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsEmpty/styled.js +0 -13
  49. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsError/index.js +1 -12
  50. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsError/styled.js +0 -13
  51. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultItem/index.js +6 -27
  52. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultItem/styled.js +0 -17
  53. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +7 -27
  54. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +8 -25
  55. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/styled.js +0 -20
  56. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsLoading/index.js +0 -12
  57. package/dist/cjs/components/WhatsNew/WhatsNewResults/WhatsNewResultsLoading/styled.js +0 -9
  58. package/dist/cjs/components/WhatsNew/WhatsNewResults/index.js +9 -49
  59. package/dist/cjs/components/WhatsNew/WhatsNewResults/styled.js +0 -13
  60. package/dist/cjs/components/constants.js +0 -4
  61. package/dist/cjs/components/contexts/headerContext.js +5 -13
  62. package/dist/cjs/components/contexts/helpArticleContext.js +8 -18
  63. package/dist/cjs/components/contexts/homeContext.js +5 -13
  64. package/dist/cjs/components/contexts/navigationContext.js +48 -132
  65. package/dist/cjs/components/contexts/relatedArticlesContext.js +8 -16
  66. package/dist/cjs/components/contexts/searchContext.js +23 -57
  67. package/dist/cjs/components/contexts/whatsNewArticleContext.js +26 -58
  68. package/dist/cjs/components/styled.js +0 -11
  69. package/dist/cjs/i18n/index.js +0 -25
  70. package/dist/cjs/index.js +0 -9
  71. package/dist/cjs/messages.js +0 -2
  72. package/dist/cjs/model/Article.js +0 -1
  73. package/dist/cjs/model/Help.js +0 -3
  74. package/dist/cjs/model/Requests.js +0 -1
  75. package/dist/cjs/model/WhatsNew.js +0 -1
  76. package/dist/cjs/util/hooks/cancellablePromise.js +2 -7
  77. package/dist/cjs/util/hooks/ctx.js +0 -6
  78. package/dist/cjs/util/hooks/previous.js +3 -4
  79. package/dist/cjs/util/i18n-util.js +1 -7
  80. package/dist/cjs/util/index.js +0 -21
  81. package/dist/cjs/util/styled.js +3 -28
  82. package/dist/cjs/util/testing/mock.js +2 -18
  83. package/dist/cjs/version.json +1 -1
  84. package/dist/es2019/components/Article/ArticleContent/index.js +0 -4
  85. package/dist/es2019/components/Article/ArticleLoadingFail/index.js +0 -4
  86. package/dist/es2019/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulNoButton.js +0 -4
  87. package/dist/es2019/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulYesButton.js +0 -4
  88. package/dist/es2019/components/Article/HelpArticle/WasHelpfulForm/index.js +2 -17
  89. package/dist/es2019/components/Article/HelpArticle/WasHelpfulForm/styled.js +1 -0
  90. package/dist/es2019/components/Article/HelpArticle/index.js +0 -10
  91. package/dist/es2019/components/Article/WhatsNewArticle/index.js +0 -4
  92. package/dist/es2019/components/Article/index.js +2 -7
  93. package/dist/es2019/components/Article/styled.js +1 -0
  94. package/dist/es2019/components/ArticlesList/ArticlesList.js +0 -4
  95. package/dist/es2019/components/ArticlesList/ArticlesListItem/index.js +0 -5
  96. package/dist/es2019/components/ArticlesList/index.js +0 -9
  97. package/dist/es2019/components/ArticlesList/styled.js +1 -0
  98. package/dist/es2019/components/Help.js +0 -3
  99. package/dist/es2019/components/HelpContent.js +0 -3
  100. package/dist/es2019/components/HelpContentButton/index.js +0 -2
  101. package/dist/es2019/components/HelpContentButton/styled.js +1 -0
  102. package/dist/es2019/components/RelatedArticles/RelatedArticlesLoading.js +0 -2
  103. package/dist/es2019/components/RelatedArticles/index.js +0 -4
  104. package/dist/es2019/components/RelatedArticles/styled.js +2 -3
  105. package/dist/es2019/components/Search/SearchInput/index.js +0 -8
  106. package/dist/es2019/components/Search/SearchResults/SearchExternalSite.js +0 -2
  107. package/dist/es2019/components/Search/SearchResults/SearchResultsEmpty.js +0 -2
  108. package/dist/es2019/components/Search/SearchResults/index.js +2 -1
  109. package/dist/es2019/components/WhatsNew/WhatsNewButton/index.js +0 -3
  110. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsEmpty/index.js +0 -2
  111. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultItem/index.js +0 -5
  112. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +0 -4
  113. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +0 -5
  114. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/styled.js +1 -0
  115. package/dist/es2019/components/WhatsNew/WhatsNewResults/WhatsNewResultsLoading/styled.js +1 -1
  116. package/dist/es2019/components/WhatsNew/WhatsNewResults/index.js +2 -7
  117. package/dist/es2019/components/constants.js +2 -3
  118. package/dist/es2019/components/contexts/navigationContext.js +19 -44
  119. package/dist/es2019/components/contexts/searchContext.js +0 -6
  120. package/dist/es2019/components/contexts/whatsNewArticleContext.js +2 -4
  121. package/dist/es2019/components/styled.js +1 -0
  122. package/dist/es2019/model/Article.js +0 -1
  123. package/dist/es2019/model/Help.js +0 -1
  124. package/dist/es2019/model/Requests.js +0 -1
  125. package/dist/es2019/model/WhatsNew.js +0 -1
  126. package/dist/es2019/util/hooks/cancellablePromise.js +2 -6
  127. package/dist/es2019/util/hooks/ctx.js +0 -4
  128. package/dist/es2019/util/hooks/previous.js +5 -3
  129. package/dist/es2019/util/i18n-util.js +1 -4
  130. package/dist/es2019/util/index.js +0 -9
  131. package/dist/es2019/util/styled.js +4 -5
  132. package/dist/es2019/util/testing/mock.js +2 -5
  133. package/dist/es2019/version.json +1 -1
  134. package/dist/esm/components/Article/ArticleContent/index.js +2 -7
  135. package/dist/esm/components/Article/ArticleLoadingFail/index.js +2 -7
  136. package/dist/esm/components/Article/ArticleLoadingFail/styled.js +0 -2
  137. package/dist/esm/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulNoButton.js +4 -10
  138. package/dist/esm/components/Article/HelpArticle/WasHelpfulForm/WasHelpfulYesButton.js +4 -10
  139. package/dist/esm/components/Article/HelpArticle/WasHelpfulForm/index.js +27 -52
  140. package/dist/esm/components/Article/HelpArticle/WasHelpfulForm/styled.js +1 -2
  141. package/dist/esm/components/Article/HelpArticle/index.js +9 -23
  142. package/dist/esm/components/Article/WhatsNewArticle/index.js +2 -7
  143. package/dist/esm/components/Article/WhatsNewArticle/styled.js +0 -2
  144. package/dist/esm/components/Article/index.js +16 -31
  145. package/dist/esm/components/Article/styled.js +1 -2
  146. package/dist/esm/components/ArticlesList/ArticlesList.js +8 -12
  147. package/dist/esm/components/ArticlesList/ArticlesListItem/index.js +6 -13
  148. package/dist/esm/components/ArticlesList/ArticlesListItem/styled.js +0 -2
  149. package/dist/esm/components/ArticlesList/index.js +8 -18
  150. package/dist/esm/components/ArticlesList/styled.js +1 -2
  151. package/dist/esm/components/Help.js +5 -16
  152. package/dist/esm/components/HelpContent.js +14 -24
  153. package/dist/esm/components/HelpContentButton/index.js +10 -14
  154. package/dist/esm/components/HelpContentButton/styled.js +1 -2
  155. package/dist/esm/components/RelatedArticles/RelatedArticlesLoading.js +0 -2
  156. package/dist/esm/components/RelatedArticles/index.js +17 -33
  157. package/dist/esm/components/RelatedArticles/styled.js +2 -5
  158. package/dist/esm/components/Search/SearchInput/index.js +6 -18
  159. package/dist/esm/components/Search/SearchInput/styled.js +0 -2
  160. package/dist/esm/components/Search/SearchResults/SearchExternalSite.js +3 -7
  161. package/dist/esm/components/Search/SearchResults/SearchResults.js +2 -2
  162. package/dist/esm/components/Search/SearchResults/SearchResultsEmpty.js +3 -7
  163. package/dist/esm/components/Search/SearchResults/SearchResultsError.js +1 -1
  164. package/dist/esm/components/Search/SearchResults/index.js +9 -14
  165. package/dist/esm/components/Search/SearchResults/styled.js +0 -2
  166. package/dist/esm/components/ShowMoreButton/index.js +7 -7
  167. package/dist/esm/components/WhatsNew/WhatsNewButton/index.js +4 -10
  168. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsEmpty/index.js +2 -5
  169. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsEmpty/styled.js +0 -2
  170. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsError/index.js +1 -1
  171. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsError/styled.js +0 -2
  172. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultItem/index.js +6 -14
  173. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultItem/styled.js +0 -2
  174. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/WhatsNewResultsList.js +7 -13
  175. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/index.js +8 -14
  176. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsList/styled.js +1 -2
  177. package/dist/esm/components/WhatsNew/WhatsNewResults/WhatsNewResultsLoading/styled.js +1 -3
  178. package/dist/esm/components/WhatsNew/WhatsNewResults/index.js +9 -23
  179. package/dist/esm/components/WhatsNew/WhatsNewResults/styled.js +0 -2
  180. package/dist/esm/components/constants.js +2 -3
  181. package/dist/esm/components/contexts/headerContext.js +5 -7
  182. package/dist/esm/components/contexts/helpArticleContext.js +8 -10
  183. package/dist/esm/components/contexts/homeContext.js +5 -7
  184. package/dist/esm/components/contexts/navigationContext.js +48 -112
  185. package/dist/esm/components/contexts/relatedArticlesContext.js +8 -10
  186. package/dist/esm/components/contexts/searchContext.js +23 -43
  187. package/dist/esm/components/contexts/whatsNewArticleContext.js +26 -44
  188. package/dist/esm/components/styled.js +1 -2
  189. package/dist/esm/model/Article.js +0 -1
  190. package/dist/esm/model/Help.js +0 -1
  191. package/dist/esm/model/Requests.js +0 -1
  192. package/dist/esm/model/WhatsNew.js +0 -1
  193. package/dist/esm/util/hooks/cancellablePromise.js +2 -4
  194. package/dist/esm/util/hooks/ctx.js +0 -4
  195. package/dist/esm/util/hooks/previous.js +5 -3
  196. package/dist/esm/util/i18n-util.js +1 -4
  197. package/dist/esm/util/index.js +0 -9
  198. package/dist/esm/util/styled.js +4 -8
  199. package/dist/esm/util/testing/mock.js +2 -5
  200. package/dist/esm/version.json +1 -1
  201. package/package.json +6 -4
@@ -1,72 +1,44 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.useNavigationContext = exports.NavigationContextProvider = exports.CtxProvider = void 0;
11
-
12
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
-
14
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
15
-
16
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
-
18
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
19
-
20
13
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
21
-
22
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
23
-
24
15
  var _react = _interopRequireWildcard(require("react"));
25
-
26
16
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
27
-
28
17
  var _Requests = require("../../model/Requests");
29
-
30
18
  var _Help = require("../../model/Help");
31
-
32
19
  var _ctx = require("../../util/hooks/ctx");
33
-
34
20
  var _constants = require("../constants");
35
-
36
21
  var _helpArticleContext = require("./helpArticleContext");
37
-
38
22
  var _whatsNewArticleContext = require("./whatsNewArticleContext");
39
-
40
23
  var _homeContext = require("./homeContext");
41
-
42
24
  var _searchContext = require("./searchContext");
43
-
44
25
  var _headerContext = require("./headerContext");
45
-
46
26
  var _excluded = ["body", "relatedArticles"],
47
- _excluded2 = ["description"];
48
-
27
+ _excluded2 = ["description"];
49
28
  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); }
50
-
51
29
  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; }
52
-
53
30
  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; }
54
-
55
31
  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) { (0, _defineProperty2.default)(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; }
56
-
57
32
  var DEFAULT_ARTICLE_ID = {
58
33
  id: '',
59
34
  type: _Help.ARTICLE_TYPE.HELP_ARTICLE
60
35
  };
61
-
62
36
  var _createCtx = (0, _ctx.createCtx)(),
63
- _createCtx2 = (0, _slicedToArray2.default)(_createCtx, 2),
64
- useNavigationContext = _createCtx2[0],
65
- CtxProvider = _createCtx2[1];
66
-
37
+ _createCtx2 = (0, _slicedToArray2.default)(_createCtx, 2),
38
+ useNavigationContext = _createCtx2[0],
39
+ CtxProvider = _createCtx2[1];
67
40
  exports.CtxProvider = CtxProvider;
68
41
  exports.useNavigationContext = useNavigationContext;
69
-
70
42
  var getNewHistoryItem = function getNewHistoryItem(id, type) {
71
43
  var uid = Math.floor(Math.random() * Math.pow(10, 17));
72
44
  var newHistoryItem = {
@@ -77,17 +49,16 @@ var getNewHistoryItem = function getNewHistoryItem(id, type) {
77
49
  };
78
50
  return newHistoryItem;
79
51
  };
52
+
80
53
  /**
81
54
  * Get a simplified version of the history. The items in this array should
82
55
  * have only the ID, UID and state === 'reload'
83
56
  */
84
-
85
-
86
57
  var getSimpleHistory = function getSimpleHistory(history) {
87
58
  return history.map(function (historyItem) {
88
59
  var id = historyItem.id,
89
- uid = historyItem.uid,
90
- type = historyItem.type;
60
+ uid = historyItem.uid,
61
+ type = historyItem.type;
91
62
  return {
92
63
  id: id,
93
64
  uid: uid,
@@ -96,60 +67,54 @@ var getSimpleHistory = function getSimpleHistory(history) {
96
67
  };
97
68
  });
98
69
  };
70
+
99
71
  /**
100
72
  * Get history data (list of IDs and UID)
101
73
  */
102
-
103
-
104
74
  var getHistoryData = function getHistoryData(history) {
105
75
  return history.map(function (historyItem) {
106
76
  var id = historyItem.id,
107
- uid = historyItem.uid;
77
+ uid = historyItem.uid;
108
78
  return {
109
79
  id: id,
110
80
  uid: uid
111
81
  };
112
82
  });
113
83
  };
84
+
114
85
  /**
115
86
  * Get the last article in the history
116
87
  */
117
-
118
-
119
88
  var _getCurrentArticle2 = function getCurrentArticle(history) {
120
89
  return history[history.length - 1];
121
90
  };
91
+
122
92
  /**
123
93
  * Get an ArticleItem/WhatsNewArticleItem based on the last article in the history
124
94
  */
125
-
126
-
127
95
  var getCurrentArticleItemSlim = function getCurrentArticleItemSlim(history) {
128
96
  var _getCurrentArticle = _getCurrentArticle2(history),
129
- article = _getCurrentArticle.article,
130
- type = _getCurrentArticle.type;
131
-
97
+ article = _getCurrentArticle.article,
98
+ type = _getCurrentArticle.type;
132
99
  if (article) {
133
100
  if (type === _Help.ARTICLE_TYPE.HELP_ARTICLE) {
134
101
  var _ref = article,
135
- body = _ref.body,
136
- relatedArticles = _ref.relatedArticles,
137
- articleItemData = (0, _objectWithoutProperties2.default)(_ref, _excluded);
102
+ body = _ref.body,
103
+ relatedArticles = _ref.relatedArticles,
104
+ articleItemData = (0, _objectWithoutProperties2.default)(_ref, _excluded);
138
105
  var currentArticleSlimData = articleItemData;
139
106
  return currentArticleSlimData;
140
107
  } else if (type === _Help.ARTICLE_TYPE.WHATS_NEW) {
141
108
  var _ref2 = article,
142
- description = _ref2.description,
143
- whatsNewArticleItemData = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
109
+ description = _ref2.description,
110
+ whatsNewArticleItemData = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
144
111
  var currentWhatsNewArticleSlimData = whatsNewArticleItemData;
145
112
  return currentWhatsNewArticleSlimData;
146
113
  }
147
114
  }
148
115
  };
149
-
150
116
  var getViewForArticleId = function getViewForArticleId(articleId) {
151
117
  var view = _constants.VIEW.DEFAULT_CONTENT;
152
-
153
118
  if (articleId.type === _Help.ARTICLE_TYPE.HELP_ARTICLE) {
154
119
  if (articleId.id) {
155
120
  view = _constants.VIEW.ARTICLE;
@@ -163,23 +128,19 @@ var getViewForArticleId = function getViewForArticleId(articleId) {
163
128
  view = _constants.VIEW.WHATS_NEW;
164
129
  }
165
130
  }
166
-
167
131
  return view;
168
132
  };
169
-
170
133
  var navigationReducer = function navigationReducer(_ref3, action) {
171
134
  var currentArticleId = _ref3.articleId,
172
- currentHistory = _ref3.history,
173
- currentView = _ref3.view;
135
+ currentHistory = _ref3.history,
136
+ currentView = _ref3.view;
174
137
  var newState = {
175
138
  articleId: currentArticleId,
176
139
  history: currentHistory,
177
140
  view: currentView
178
141
  };
179
-
180
142
  if (action.type === 'newArticle' && action.payload) {
181
143
  var newArticleId = action.payload;
182
-
183
144
  if ((0, _isEqual.default)(newArticleId, DEFAULT_ARTICLE_ID)) {
184
145
  newState = {
185
146
  articleId: newArticleId,
@@ -205,7 +166,6 @@ var navigationReducer = function navigationReducer(_ref3, action) {
205
166
  var index = currentHistory.findIndex(function (historyItemTemp) {
206
167
  return historyItemTemp.uid === HistoryItemUpdate.uid;
207
168
  });
208
-
209
169
  if (index !== -1) {
210
170
  var newHistory = (0, _toConsumableArray2.default)(currentHistory);
211
171
  newHistory[index] = _objectSpread({}, HistoryItemUpdate);
@@ -217,11 +177,9 @@ var navigationReducer = function navigationReducer(_ref3, action) {
217
177
  }
218
178
  } else if (action.type === 'removeLastHistoryItem') {
219
179
  var _newHistory = currentHistory.length > 0 ? (0, _toConsumableArray2.default)(currentHistory) : [];
220
-
221
180
  if (_newHistory.length > 0) {
222
181
  _newHistory.splice(-1);
223
182
  }
224
-
225
183
  newState = {
226
184
  articleId: currentArticleId,
227
185
  history: _newHistory,
@@ -249,52 +207,42 @@ var navigationReducer = function navigationReducer(_ref3, action) {
249
207
  view: newView
250
208
  };
251
209
  }
252
-
253
210
  return newState;
254
211
  };
255
-
256
212
  var NavigationContextProvider = function NavigationContextProvider(_ref4) {
257
213
  var _ref4$navigationData = _ref4.navigationData,
258
- navigationData = _ref4$navigationData === void 0 ? {
259
- articleId: DEFAULT_ARTICLE_ID,
260
- history: []
261
- } : _ref4$navigationData,
262
- setNavigationData = _ref4.setNavigationData,
263
- children = _ref4.children;
264
-
214
+ navigationData = _ref4$navigationData === void 0 ? {
215
+ articleId: DEFAULT_ARTICLE_ID,
216
+ history: []
217
+ } : _ref4$navigationData,
218
+ setNavigationData = _ref4.setNavigationData,
219
+ children = _ref4.children;
265
220
  var _useHelpArticleContex = (0, _helpArticleContext.useHelpArticleContext)(),
266
- onGetHelpArticle = _useHelpArticleContex.onGetHelpArticle;
267
-
221
+ onGetHelpArticle = _useHelpArticleContex.onGetHelpArticle;
268
222
  var _useWhatsNewArticleCo = (0, _whatsNewArticleContext.useWhatsNewArticleContext)(),
269
- onGetWhatsNewArticle = _useWhatsNewArticleCo.onGetWhatsNewArticle;
270
-
223
+ onGetWhatsNewArticle = _useWhatsNewArticleCo.onGetWhatsNewArticle;
271
224
  var _useHomeContext = (0, _homeContext.useHomeContext)(),
272
- homeContent = _useHomeContext.homeContent,
273
- homeOptions = _useHomeContext.homeOptions;
274
-
225
+ homeContent = _useHomeContext.homeContent,
226
+ homeOptions = _useHomeContext.homeOptions;
275
227
  var _useSearchContext = (0, _searchContext.useSearchContext)(),
276
- onSearch = _useSearchContext.onSearch,
277
- isSearchResultVisible = _useSearchContext.isSearchResultVisible,
278
- searchValue = _useSearchContext.searchValue;
279
-
228
+ onSearch = _useSearchContext.onSearch,
229
+ isSearchResultVisible = _useSearchContext.isSearchResultVisible,
230
+ searchValue = _useSearchContext.searchValue;
280
231
  var _useHeaderContext = (0, _headerContext.useHeaderContext)(),
281
- onCloseButtonClick = _useHeaderContext.onCloseButtonClick;
282
-
232
+ onCloseButtonClick = _useHeaderContext.onCloseButtonClick;
283
233
  var propsArticleId = navigationData.articleId,
284
- propsHistory = navigationData.history;
285
-
234
+ propsHistory = navigationData.history;
286
235
  var _useReducer = (0, _react.useReducer)(navigationReducer, {
287
- articleId: propsArticleId,
288
- history: !(0, _isEqual.default)(propsArticleId, DEFAULT_ARTICLE_ID) && propsHistory.length === 0 ? [getNewHistoryItem(propsArticleId.id, propsArticleId.type)] : propsHistory,
289
- view: _constants.VIEW.DEFAULT_CONTENT
290
- }),
291
- _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
292
- _useReducer2$ = _useReducer2[0],
293
- currentArticleId = _useReducer2$.articleId,
294
- currentHistory = _useReducer2$.history,
295
- currentView = _useReducer2$.view,
296
- dispatchNavigationAction = _useReducer2[1];
297
-
236
+ articleId: propsArticleId,
237
+ history: !(0, _isEqual.default)(propsArticleId, DEFAULT_ARTICLE_ID) && propsHistory.length === 0 ? [getNewHistoryItem(propsArticleId.id, propsArticleId.type)] : propsHistory,
238
+ view: _constants.VIEW.DEFAULT_CONTENT
239
+ }),
240
+ _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
241
+ _useReducer2$ = _useReducer2[0],
242
+ currentArticleId = _useReducer2$.articleId,
243
+ currentHistory = _useReducer2$.history,
244
+ currentView = _useReducer2$.view,
245
+ dispatchNavigationAction = _useReducer2[1];
298
246
  var isOverlayVisible = (0, _react.useMemo)(function () {
299
247
  return currentView === _constants.VIEW.ARTICLE || currentView === _constants.VIEW.SEARCH || currentView === _constants.VIEW.WHATS_NEW || currentView === _constants.VIEW.WHATS_NEW_ARTICLE;
300
248
  }, [currentView]);
@@ -309,11 +257,10 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
309
257
  if (currentHistory.length === 1 && !isDefaultContentDefined || currentView === _constants.VIEW.WHATS_NEW && !isDefaultContentDefined) {
310
258
  return false;
311
259
  }
260
+
312
261
  /**
313
262
  * if an overlay is visible return true to display the back buton
314
263
  */
315
-
316
-
317
264
  return isOverlayVisible;
318
265
  }, [currentHistory.length, isDefaultContentDefined, isOverlayVisible, currentView]);
319
266
  var fetchArticleData = (0, _react.useCallback)( /*#__PURE__*/function () {
@@ -327,70 +274,56 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
327
274
  _context.t0 = historyItem.type;
328
275
  _context.next = _context.t0 === _Help.ARTICLE_TYPE.HELP_ARTICLE ? 4 : _context.t0 === _Help.ARTICLE_TYPE.WHATS_NEW ? 10 : 18;
329
276
  break;
330
-
331
277
  case 4:
332
278
  if (onGetHelpArticle) {
333
279
  _context.next = 6;
334
280
  break;
335
281
  }
336
-
337
282
  throw new Error('onGetHelpArticle prop not defined');
338
-
339
283
  case 6:
340
284
  _context.next = 8;
341
285
  return onGetHelpArticle({
342
286
  id: historyItem.id,
343
287
  type: historyItem.type
344
288
  });
345
-
346
289
  case 8:
347
290
  article = _context.sent;
348
291
  return _context.abrupt("break", 20);
349
-
350
292
  case 10:
351
293
  if (onGetWhatsNewArticle) {
352
294
  _context.next = 12;
353
295
  break;
354
296
  }
355
-
356
297
  throw new Error('onGetWhatsNewArticle prop not defined');
357
-
358
298
  case 12:
359
299
  if (!(historyItem.id === '')) {
360
300
  _context.next = 14;
361
301
  break;
362
302
  }
363
-
364
303
  return _context.abrupt("break", 20);
365
-
366
304
  case 14:
367
305
  _context.next = 16;
368
306
  return onGetWhatsNewArticle({
369
307
  id: historyItem.id,
370
308
  type: historyItem.type
371
309
  });
372
-
373
310
  case 16:
374
311
  article = _context.sent;
375
312
  return _context.abrupt("break", 20);
376
-
377
313
  case 18:
378
314
  throw new Error('onGetHelpArticle prop not defined');
379
-
380
315
  case 20:
381
316
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, historyItem), article && {
382
317
  article: article
383
318
  }), {}, {
384
319
  state: _Requests.REQUEST_STATE.done
385
320
  }));
386
-
387
321
  case 23:
388
322
  _context.prev = 23;
389
323
  _context.t1 = _context["catch"](0);
390
324
  return _context.abrupt("return", _objectSpread(_objectSpread({}, historyItem), {}, {
391
325
  state: _Requests.REQUEST_STATE.error
392
326
  }));
393
-
394
327
  case 26:
395
328
  case "end":
396
329
  return _context.stop();
@@ -398,7 +331,6 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
398
331
  }
399
332
  }, _callee, null, [[0, 23]]);
400
333
  }));
401
-
402
334
  return function (_x) {
403
335
  return _ref5.apply(this, arguments);
404
336
  };
@@ -411,18 +343,15 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
411
343
  switch (_context2.prev = _context2.next) {
412
344
  case 0:
413
345
  historyItemToReload = _objectSpread({}, historyItem);
414
-
415
346
  if (historyItem.type === _Help.ARTICLE_TYPE.HELP_ARTICLE || historyItem.type === _Help.ARTICLE_TYPE.WHATS_NEW) {
416
347
  historyItemToReload.state = _Requests.REQUEST_STATE.loading;
417
348
  } else {
418
349
  historyItemToReload.state = _Requests.REQUEST_STATE.error;
419
350
  }
420
-
421
351
  dispatchNavigationAction({
422
352
  type: 'updateHistoryItem',
423
353
  payload: historyItemToReload
424
354
  });
425
-
426
355
  case 3:
427
356
  case "end":
428
357
  return _context2.stop();
@@ -430,7 +359,6 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
430
359
  }
431
360
  }, _callee2);
432
361
  }));
433
-
434
362
  return function (_x2) {
435
363
  return _ref6.apply(this, arguments);
436
364
  };
@@ -444,22 +372,18 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
444
372
  _context3.next = 8;
445
373
  break;
446
374
  }
447
-
448
375
  if (!(searchValue !== '')) {
449
376
  _context3.next = 6;
450
377
  break;
451
378
  }
452
-
453
379
  onSearch('');
454
380
  return _context3.abrupt("return");
455
-
456
381
  case 6:
457
382
  dispatchNavigationAction({
458
383
  type: 'updateView',
459
384
  payload: currentArticleId.type
460
385
  });
461
386
  return _context3.abrupt("return");
462
-
463
387
  case 8:
464
388
  // if the history is not empty and ...
465
389
  if (currentHistory.length > 0) {
@@ -476,7 +400,6 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
476
400
  });
477
401
  }
478
402
  }
479
-
480
403
  case 9:
481
404
  case "end":
482
405
  return _context3.stop();
@@ -508,10 +431,10 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
508
431
  }, [isSearchResultVisible]);
509
432
  (0, _react.useEffect)(function () {
510
433
  var lastHistoryItem = currentHistory.length > 0 ? _getCurrentArticle2(currentHistory) : getNewHistoryItem(DEFAULT_ARTICLE_ID.id, DEFAULT_ARTICLE_ID.type);
434
+
511
435
  /**
512
436
  * If the propsArticleId.id (host articleId) is different from currentArticleId.id (internal articleId)
513
437
  * */
514
-
515
438
  if (!(0, _isEqual.default)(propsArticleId, currentArticleId)) {
516
439
  /**
517
440
  * If propsArticleId and lastHistoryItem are the same, we just need to update the articleId
@@ -534,7 +457,6 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
534
457
  } else {
535
458
  if (setNavigationData) {
536
459
  var simpleHistory = getSimpleHistory(currentHistory);
537
-
538
460
  if (currentArticleId.id !== lastHistoryItem.id || currentArticleId.type !== lastHistoryItem.type) {
539
461
  /**
540
462
  * If the propsArticleId.id (host articleId) is equal to currentArticleId.id (internal articleId)
@@ -569,14 +491,12 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
569
491
  case 0:
570
492
  _context4.next = 2;
571
493
  return fetchArticleData(historyItem);
572
-
573
494
  case 2:
574
495
  historyItemUpdate = _context4.sent;
575
496
  dispatchNavigationAction({
576
497
  type: 'updateHistoryItem',
577
498
  payload: historyItemUpdate
578
499
  });
579
-
580
500
  case 4:
581
501
  case "end":
582
502
  return _context4.stop();
@@ -584,18 +504,15 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
584
504
  }
585
505
  }, _callee4);
586
506
  }));
587
-
588
507
  return function requestNewArticle(_x3) {
589
508
  return _ref8.apply(this, arguments);
590
509
  };
591
510
  }();
511
+
592
512
  /**
593
513
  * If the last history item state is "loading" or "reload", we need to request the article (fetch article from API)
594
514
  */
595
-
596
-
597
515
  var lastHistoryItem = _getCurrentArticle2(currentHistory);
598
-
599
516
  if ((lastHistoryItem === null || lastHistoryItem === void 0 ? void 0 : lastHistoryItem.state) === _Requests.REQUEST_STATE.load || (lastHistoryItem === null || lastHistoryItem === void 0 ? void 0 : lastHistoryItem.state) === _Requests.REQUEST_STATE.reload) {
600
517
  requestNewArticle(lastHistoryItem);
601
518
  dispatchNavigationAction({
@@ -627,5 +544,4 @@ var NavigationContextProvider = function NavigationContextProvider(_ref4) {
627
544
  }
628
545
  }, children);
629
546
  };
630
-
631
547
  exports.NavigationContextProvider = NavigationContextProvider;
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.useRelatedArticlesContext = exports.RelatedArticlesContextProvider = exports.CtxProvider = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _react = _interopRequireDefault(require("react"));
13
-
14
10
  var _ctx = require("../../util/hooks/ctx");
15
-
16
11
  var _createCtx = (0, _ctx.createCtx)(),
17
- _createCtx2 = (0, _slicedToArray2.default)(_createCtx, 2),
18
- useRelatedArticlesContext = _createCtx2[0],
19
- CtxProvider = _createCtx2[1];
20
-
12
+ _createCtx2 = (0, _slicedToArray2.default)(_createCtx, 2),
13
+ useRelatedArticlesContext = _createCtx2[0],
14
+ CtxProvider = _createCtx2[1];
21
15
  exports.CtxProvider = CtxProvider;
22
16
  exports.useRelatedArticlesContext = useRelatedArticlesContext;
23
-
24
17
  var RelatedArticlesContextProvider = function RelatedArticlesContextProvider(_ref) {
25
18
  var routeGroup = _ref.routeGroup,
26
- routeName = _ref.routeName,
27
- onGetRelatedArticles = _ref.onGetRelatedArticles,
28
- onRelatedArticlesShowMoreClick = _ref.onRelatedArticlesShowMoreClick,
29
- onRelatedArticlesListItemClick = _ref.onRelatedArticlesListItemClick,
30
- children = _ref.children;
19
+ routeName = _ref.routeName,
20
+ onGetRelatedArticles = _ref.onGetRelatedArticles,
21
+ onRelatedArticlesShowMoreClick = _ref.onRelatedArticlesShowMoreClick,
22
+ onRelatedArticlesListItemClick = _ref.onRelatedArticlesListItemClick,
23
+ children = _ref.children;
31
24
  return /*#__PURE__*/_react.default.createElement(CtxProvider, {
32
25
  value: {
33
26
  routeGroup: routeGroup,
@@ -38,5 +31,4 @@ var RelatedArticlesContextProvider = function RelatedArticlesContextProvider(_re
38
31
  }
39
32
  }, children);
40
33
  };
41
-
42
34
  exports.RelatedArticlesContextProvider = RelatedArticlesContextProvider;