@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
@@ -4,13 +4,10 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
5
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
6
6
  var _excluded = ["body", "relatedArticles"],
7
- _excluded2 = ["description"];
7
+ _excluded2 = ["description"];
8
8
  import _regeneratorRuntime from "@babel/runtime/regenerator";
9
-
10
9
  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; }
11
-
12
10
  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; }
13
-
14
11
  import React, { useReducer, useEffect, useCallback, useMemo } from 'react';
15
12
  import isEqual from 'lodash/isEqual';
16
13
  import { REQUEST_STATE } from '../../model/Requests';
@@ -26,14 +23,11 @@ var DEFAULT_ARTICLE_ID = {
26
23
  id: '',
27
24
  type: ARTICLE_TYPE.HELP_ARTICLE
28
25
  };
29
-
30
26
  var _createCtx = createCtx(),
31
- _createCtx2 = _slicedToArray(_createCtx, 2),
32
- useNavigationContext = _createCtx2[0],
33
- CtxProvider = _createCtx2[1];
34
-
27
+ _createCtx2 = _slicedToArray(_createCtx, 2),
28
+ useNavigationContext = _createCtx2[0],
29
+ CtxProvider = _createCtx2[1];
35
30
  export { useNavigationContext, CtxProvider };
36
-
37
31
  var getNewHistoryItem = function getNewHistoryItem(id, type) {
38
32
  var uid = Math.floor(Math.random() * Math.pow(10, 17));
39
33
  var newHistoryItem = {
@@ -44,17 +38,16 @@ var getNewHistoryItem = function getNewHistoryItem(id, type) {
44
38
  };
45
39
  return newHistoryItem;
46
40
  };
41
+
47
42
  /**
48
43
  * Get a simplified version of the history. The items in this array should
49
44
  * have only the ID, UID and state === 'reload'
50
45
  */
51
-
52
-
53
46
  var getSimpleHistory = function getSimpleHistory(history) {
54
47
  return history.map(function (historyItem) {
55
48
  var id = historyItem.id,
56
- uid = historyItem.uid,
57
- type = historyItem.type;
49
+ uid = historyItem.uid,
50
+ type = historyItem.type;
58
51
  return {
59
52
  id: id,
60
53
  uid: uid,
@@ -63,62 +56,54 @@ var getSimpleHistory = function getSimpleHistory(history) {
63
56
  };
64
57
  });
65
58
  };
59
+
66
60
  /**
67
61
  * Get history data (list of IDs and UID)
68
62
  */
69
-
70
-
71
63
  var getHistoryData = function getHistoryData(history) {
72
64
  return history.map(function (historyItem) {
73
65
  var id = historyItem.id,
74
- uid = historyItem.uid;
66
+ uid = historyItem.uid;
75
67
  return {
76
68
  id: id,
77
69
  uid: uid
78
70
  };
79
71
  });
80
72
  };
73
+
81
74
  /**
82
75
  * Get the last article in the history
83
76
  */
84
-
85
-
86
77
  var _getCurrentArticle2 = function getCurrentArticle(history) {
87
78
  return history[history.length - 1];
88
79
  };
80
+
89
81
  /**
90
82
  * Get an ArticleItem/WhatsNewArticleItem based on the last article in the history
91
83
  */
92
-
93
-
94
84
  var getCurrentArticleItemSlim = function getCurrentArticleItemSlim(history) {
95
85
  var _getCurrentArticle = _getCurrentArticle2(history),
96
- article = _getCurrentArticle.article,
97
- type = _getCurrentArticle.type;
98
-
86
+ article = _getCurrentArticle.article,
87
+ type = _getCurrentArticle.type;
99
88
  if (article) {
100
89
  if (type === ARTICLE_TYPE.HELP_ARTICLE) {
101
90
  var _ref = article,
102
- body = _ref.body,
103
- relatedArticles = _ref.relatedArticles,
104
- articleItemData = _objectWithoutProperties(_ref, _excluded);
105
-
91
+ body = _ref.body,
92
+ relatedArticles = _ref.relatedArticles,
93
+ articleItemData = _objectWithoutProperties(_ref, _excluded);
106
94
  var currentArticleSlimData = articleItemData;
107
95
  return currentArticleSlimData;
108
96
  } else if (type === ARTICLE_TYPE.WHATS_NEW) {
109
97
  var _ref2 = article,
110
- description = _ref2.description,
111
- whatsNewArticleItemData = _objectWithoutProperties(_ref2, _excluded2);
112
-
98
+ description = _ref2.description,
99
+ whatsNewArticleItemData = _objectWithoutProperties(_ref2, _excluded2);
113
100
  var currentWhatsNewArticleSlimData = whatsNewArticleItemData;
114
101
  return currentWhatsNewArticleSlimData;
115
102
  }
116
103
  }
117
104
  };
118
-
119
105
  var getViewForArticleId = function getViewForArticleId(articleId) {
120
106
  var view = VIEW.DEFAULT_CONTENT;
121
-
122
107
  if (articleId.type === ARTICLE_TYPE.HELP_ARTICLE) {
123
108
  if (articleId.id) {
124
109
  view = VIEW.ARTICLE;
@@ -132,23 +117,19 @@ var getViewForArticleId = function getViewForArticleId(articleId) {
132
117
  view = VIEW.WHATS_NEW;
133
118
  }
134
119
  }
135
-
136
120
  return view;
137
121
  };
138
-
139
122
  var navigationReducer = function navigationReducer(_ref3, action) {
140
123
  var currentArticleId = _ref3.articleId,
141
- currentHistory = _ref3.history,
142
- currentView = _ref3.view;
124
+ currentHistory = _ref3.history,
125
+ currentView = _ref3.view;
143
126
  var newState = {
144
127
  articleId: currentArticleId,
145
128
  history: currentHistory,
146
129
  view: currentView
147
130
  };
148
-
149
131
  if (action.type === 'newArticle' && action.payload) {
150
132
  var newArticleId = action.payload;
151
-
152
133
  if (isEqual(newArticleId, DEFAULT_ARTICLE_ID)) {
153
134
  newState = {
154
135
  articleId: newArticleId,
@@ -174,10 +155,8 @@ var navigationReducer = function navigationReducer(_ref3, action) {
174
155
  var index = currentHistory.findIndex(function (historyItemTemp) {
175
156
  return historyItemTemp.uid === HistoryItemUpdate.uid;
176
157
  });
177
-
178
158
  if (index !== -1) {
179
159
  var newHistory = _toConsumableArray(currentHistory);
180
-
181
160
  newHistory[index] = _objectSpread({}, HistoryItemUpdate);
182
161
  newState = {
183
162
  articleId: currentArticleId,
@@ -187,11 +166,9 @@ var navigationReducer = function navigationReducer(_ref3, action) {
187
166
  }
188
167
  } else if (action.type === 'removeLastHistoryItem') {
189
168
  var _newHistory = currentHistory.length > 0 ? _toConsumableArray(currentHistory) : [];
190
-
191
169
  if (_newHistory.length > 0) {
192
170
  _newHistory.splice(-1);
193
171
  }
194
-
195
172
  newState = {
196
173
  articleId: currentArticleId,
197
174
  history: _newHistory,
@@ -219,52 +196,42 @@ var navigationReducer = function navigationReducer(_ref3, action) {
219
196
  view: newView
220
197
  };
221
198
  }
222
-
223
199
  return newState;
224
200
  };
225
-
226
201
  export var NavigationContextProvider = function NavigationContextProvider(_ref4) {
227
202
  var _ref4$navigationData = _ref4.navigationData,
228
- navigationData = _ref4$navigationData === void 0 ? {
229
- articleId: DEFAULT_ARTICLE_ID,
230
- history: []
231
- } : _ref4$navigationData,
232
- setNavigationData = _ref4.setNavigationData,
233
- children = _ref4.children;
234
-
203
+ navigationData = _ref4$navigationData === void 0 ? {
204
+ articleId: DEFAULT_ARTICLE_ID,
205
+ history: []
206
+ } : _ref4$navigationData,
207
+ setNavigationData = _ref4.setNavigationData,
208
+ children = _ref4.children;
235
209
  var _useHelpArticleContex = useHelpArticleContext(),
236
- onGetHelpArticle = _useHelpArticleContex.onGetHelpArticle;
237
-
210
+ onGetHelpArticle = _useHelpArticleContex.onGetHelpArticle;
238
211
  var _useWhatsNewArticleCo = useWhatsNewArticleContext(),
239
- onGetWhatsNewArticle = _useWhatsNewArticleCo.onGetWhatsNewArticle;
240
-
212
+ onGetWhatsNewArticle = _useWhatsNewArticleCo.onGetWhatsNewArticle;
241
213
  var _useHomeContext = useHomeContext(),
242
- homeContent = _useHomeContext.homeContent,
243
- homeOptions = _useHomeContext.homeOptions;
244
-
214
+ homeContent = _useHomeContext.homeContent,
215
+ homeOptions = _useHomeContext.homeOptions;
245
216
  var _useSearchContext = useSearchContext(),
246
- onSearch = _useSearchContext.onSearch,
247
- isSearchResultVisible = _useSearchContext.isSearchResultVisible,
248
- searchValue = _useSearchContext.searchValue;
249
-
217
+ onSearch = _useSearchContext.onSearch,
218
+ isSearchResultVisible = _useSearchContext.isSearchResultVisible,
219
+ searchValue = _useSearchContext.searchValue;
250
220
  var _useHeaderContext = useHeaderContext(),
251
- onCloseButtonClick = _useHeaderContext.onCloseButtonClick;
252
-
221
+ onCloseButtonClick = _useHeaderContext.onCloseButtonClick;
253
222
  var propsArticleId = navigationData.articleId,
254
- propsHistory = navigationData.history;
255
-
223
+ propsHistory = navigationData.history;
256
224
  var _useReducer = useReducer(navigationReducer, {
257
- articleId: propsArticleId,
258
- history: !isEqual(propsArticleId, DEFAULT_ARTICLE_ID) && propsHistory.length === 0 ? [getNewHistoryItem(propsArticleId.id, propsArticleId.type)] : propsHistory,
259
- view: VIEW.DEFAULT_CONTENT
260
- }),
261
- _useReducer2 = _slicedToArray(_useReducer, 2),
262
- _useReducer2$ = _useReducer2[0],
263
- currentArticleId = _useReducer2$.articleId,
264
- currentHistory = _useReducer2$.history,
265
- currentView = _useReducer2$.view,
266
- dispatchNavigationAction = _useReducer2[1];
267
-
225
+ articleId: propsArticleId,
226
+ history: !isEqual(propsArticleId, DEFAULT_ARTICLE_ID) && propsHistory.length === 0 ? [getNewHistoryItem(propsArticleId.id, propsArticleId.type)] : propsHistory,
227
+ view: VIEW.DEFAULT_CONTENT
228
+ }),
229
+ _useReducer2 = _slicedToArray(_useReducer, 2),
230
+ _useReducer2$ = _useReducer2[0],
231
+ currentArticleId = _useReducer2$.articleId,
232
+ currentHistory = _useReducer2$.history,
233
+ currentView = _useReducer2$.view,
234
+ dispatchNavigationAction = _useReducer2[1];
268
235
  var isOverlayVisible = useMemo(function () {
269
236
  return currentView === VIEW.ARTICLE || currentView === VIEW.SEARCH || currentView === VIEW.WHATS_NEW || currentView === VIEW.WHATS_NEW_ARTICLE;
270
237
  }, [currentView]);
@@ -279,11 +246,10 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
279
246
  if (currentHistory.length === 1 && !isDefaultContentDefined || currentView === VIEW.WHATS_NEW && !isDefaultContentDefined) {
280
247
  return false;
281
248
  }
249
+
282
250
  /**
283
251
  * if an overlay is visible return true to display the back buton
284
252
  */
285
-
286
-
287
253
  return isOverlayVisible;
288
254
  }, [currentHistory.length, isDefaultContentDefined, isOverlayVisible, currentView]);
289
255
  var fetchArticleData = useCallback( /*#__PURE__*/function () {
@@ -297,70 +263,56 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
297
263
  _context.t0 = historyItem.type;
298
264
  _context.next = _context.t0 === ARTICLE_TYPE.HELP_ARTICLE ? 4 : _context.t0 === ARTICLE_TYPE.WHATS_NEW ? 10 : 18;
299
265
  break;
300
-
301
266
  case 4:
302
267
  if (onGetHelpArticle) {
303
268
  _context.next = 6;
304
269
  break;
305
270
  }
306
-
307
271
  throw new Error('onGetHelpArticle prop not defined');
308
-
309
272
  case 6:
310
273
  _context.next = 8;
311
274
  return onGetHelpArticle({
312
275
  id: historyItem.id,
313
276
  type: historyItem.type
314
277
  });
315
-
316
278
  case 8:
317
279
  article = _context.sent;
318
280
  return _context.abrupt("break", 20);
319
-
320
281
  case 10:
321
282
  if (onGetWhatsNewArticle) {
322
283
  _context.next = 12;
323
284
  break;
324
285
  }
325
-
326
286
  throw new Error('onGetWhatsNewArticle prop not defined');
327
-
328
287
  case 12:
329
288
  if (!(historyItem.id === '')) {
330
289
  _context.next = 14;
331
290
  break;
332
291
  }
333
-
334
292
  return _context.abrupt("break", 20);
335
-
336
293
  case 14:
337
294
  _context.next = 16;
338
295
  return onGetWhatsNewArticle({
339
296
  id: historyItem.id,
340
297
  type: historyItem.type
341
298
  });
342
-
343
299
  case 16:
344
300
  article = _context.sent;
345
301
  return _context.abrupt("break", 20);
346
-
347
302
  case 18:
348
303
  throw new Error('onGetHelpArticle prop not defined');
349
-
350
304
  case 20:
351
305
  return _context.abrupt("return", _objectSpread(_objectSpread(_objectSpread({}, historyItem), article && {
352
306
  article: article
353
307
  }), {}, {
354
308
  state: REQUEST_STATE.done
355
309
  }));
356
-
357
310
  case 23:
358
311
  _context.prev = 23;
359
312
  _context.t1 = _context["catch"](0);
360
313
  return _context.abrupt("return", _objectSpread(_objectSpread({}, historyItem), {}, {
361
314
  state: REQUEST_STATE.error
362
315
  }));
363
-
364
316
  case 26:
365
317
  case "end":
366
318
  return _context.stop();
@@ -368,7 +320,6 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
368
320
  }
369
321
  }, _callee, null, [[0, 23]]);
370
322
  }));
371
-
372
323
  return function (_x) {
373
324
  return _ref5.apply(this, arguments);
374
325
  };
@@ -381,18 +332,15 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
381
332
  switch (_context2.prev = _context2.next) {
382
333
  case 0:
383
334
  historyItemToReload = _objectSpread({}, historyItem);
384
-
385
335
  if (historyItem.type === ARTICLE_TYPE.HELP_ARTICLE || historyItem.type === ARTICLE_TYPE.WHATS_NEW) {
386
336
  historyItemToReload.state = REQUEST_STATE.loading;
387
337
  } else {
388
338
  historyItemToReload.state = REQUEST_STATE.error;
389
339
  }
390
-
391
340
  dispatchNavigationAction({
392
341
  type: 'updateHistoryItem',
393
342
  payload: historyItemToReload
394
343
  });
395
-
396
344
  case 3:
397
345
  case "end":
398
346
  return _context2.stop();
@@ -400,7 +348,6 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
400
348
  }
401
349
  }, _callee2);
402
350
  }));
403
-
404
351
  return function (_x2) {
405
352
  return _ref6.apply(this, arguments);
406
353
  };
@@ -414,22 +361,18 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
414
361
  _context3.next = 8;
415
362
  break;
416
363
  }
417
-
418
364
  if (!(searchValue !== '')) {
419
365
  _context3.next = 6;
420
366
  break;
421
367
  }
422
-
423
368
  onSearch('');
424
369
  return _context3.abrupt("return");
425
-
426
370
  case 6:
427
371
  dispatchNavigationAction({
428
372
  type: 'updateView',
429
373
  payload: currentArticleId.type
430
374
  });
431
375
  return _context3.abrupt("return");
432
-
433
376
  case 8:
434
377
  // if the history is not empty and ...
435
378
  if (currentHistory.length > 0) {
@@ -446,7 +389,6 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
446
389
  });
447
390
  }
448
391
  }
449
-
450
392
  case 9:
451
393
  case "end":
452
394
  return _context3.stop();
@@ -478,10 +420,10 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
478
420
  }, [isSearchResultVisible]);
479
421
  useEffect(function () {
480
422
  var lastHistoryItem = currentHistory.length > 0 ? _getCurrentArticle2(currentHistory) : getNewHistoryItem(DEFAULT_ARTICLE_ID.id, DEFAULT_ARTICLE_ID.type);
423
+
481
424
  /**
482
425
  * If the propsArticleId.id (host articleId) is different from currentArticleId.id (internal articleId)
483
426
  * */
484
-
485
427
  if (!isEqual(propsArticleId, currentArticleId)) {
486
428
  /**
487
429
  * If propsArticleId and lastHistoryItem are the same, we just need to update the articleId
@@ -504,7 +446,6 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
504
446
  } else {
505
447
  if (setNavigationData) {
506
448
  var simpleHistory = getSimpleHistory(currentHistory);
507
-
508
449
  if (currentArticleId.id !== lastHistoryItem.id || currentArticleId.type !== lastHistoryItem.type) {
509
450
  /**
510
451
  * If the propsArticleId.id (host articleId) is equal to currentArticleId.id (internal articleId)
@@ -539,14 +480,12 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
539
480
  case 0:
540
481
  _context4.next = 2;
541
482
  return fetchArticleData(historyItem);
542
-
543
483
  case 2:
544
484
  historyItemUpdate = _context4.sent;
545
485
  dispatchNavigationAction({
546
486
  type: 'updateHistoryItem',
547
487
  payload: historyItemUpdate
548
488
  });
549
-
550
489
  case 4:
551
490
  case "end":
552
491
  return _context4.stop();
@@ -554,18 +493,15 @@ export var NavigationContextProvider = function NavigationContextProvider(_ref4)
554
493
  }
555
494
  }, _callee4);
556
495
  }));
557
-
558
496
  return function requestNewArticle(_x3) {
559
497
  return _ref8.apply(this, arguments);
560
498
  };
561
499
  }();
500
+
562
501
  /**
563
502
  * If the last history item state is "loading" or "reload", we need to request the article (fetch article from API)
564
503
  */
565
-
566
-
567
504
  var lastHistoryItem = _getCurrentArticle2(currentHistory);
568
-
569
505
  if ((lastHistoryItem === null || lastHistoryItem === void 0 ? void 0 : lastHistoryItem.state) === REQUEST_STATE.load || (lastHistoryItem === null || lastHistoryItem === void 0 ? void 0 : lastHistoryItem.state) === REQUEST_STATE.reload) {
570
506
  requestNewArticle(lastHistoryItem);
571
507
  dispatchNavigationAction({
@@ -1,20 +1,18 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React from 'react';
3
3
  import { createCtx } from '../../util/hooks/ctx';
4
-
5
4
  var _createCtx = createCtx(),
6
- _createCtx2 = _slicedToArray(_createCtx, 2),
7
- useRelatedArticlesContext = _createCtx2[0],
8
- CtxProvider = _createCtx2[1];
9
-
5
+ _createCtx2 = _slicedToArray(_createCtx, 2),
6
+ useRelatedArticlesContext = _createCtx2[0],
7
+ CtxProvider = _createCtx2[1];
10
8
  export { useRelatedArticlesContext, CtxProvider };
11
9
  export var RelatedArticlesContextProvider = function RelatedArticlesContextProvider(_ref) {
12
10
  var routeGroup = _ref.routeGroup,
13
- routeName = _ref.routeName,
14
- onGetRelatedArticles = _ref.onGetRelatedArticles,
15
- onRelatedArticlesShowMoreClick = _ref.onRelatedArticlesShowMoreClick,
16
- onRelatedArticlesListItemClick = _ref.onRelatedArticlesListItemClick,
17
- children = _ref.children;
11
+ routeName = _ref.routeName,
12
+ onGetRelatedArticles = _ref.onGetRelatedArticles,
13
+ onRelatedArticlesShowMoreClick = _ref.onRelatedArticlesShowMoreClick,
14
+ onRelatedArticlesListItemClick = _ref.onRelatedArticlesListItemClick,
15
+ children = _ref.children;
18
16
  return /*#__PURE__*/React.createElement(CtxProvider, {
19
17
  value: {
20
18
  routeGroup: routeGroup,
@@ -6,82 +6,68 @@ import debounce from 'lodash/debounce';
6
6
  import { REQUEST_STATE } from '../../model/Requests';
7
7
  import { createCtx } from '../../util/hooks/ctx';
8
8
  import { MIN_CHARACTERS_FOR_SEARCH } from '../constants';
9
-
10
9
  var _createCtx = createCtx(),
11
- _createCtx2 = _slicedToArray(_createCtx, 2),
12
- useSearchContext = _createCtx2[0],
13
- CtxProvider = _createCtx2[1];
14
-
10
+ _createCtx2 = _slicedToArray(_createCtx, 2),
11
+ useSearchContext = _createCtx2[0],
12
+ CtxProvider = _createCtx2[1];
15
13
  export { useSearchContext, CtxProvider };
16
14
  export var SearchContextProvider = function SearchContextProvider(_ref) {
17
15
  var onSearch = _ref.onSearch,
18
- onSearchInputChanged = _ref.onSearchInputChanged,
19
- onSearchInputCleared = _ref.onSearchInputCleared,
20
- onSearchResultItemClick = _ref.onSearchResultItemClick,
21
- onSearchExternalUrlClick = _ref.onSearchExternalUrlClick,
22
- searchExternalUrl = _ref.searchExternalUrl,
23
- children = _ref.children;
24
-
16
+ onSearchInputChanged = _ref.onSearchInputChanged,
17
+ onSearchInputCleared = _ref.onSearchInputCleared,
18
+ onSearchResultItemClick = _ref.onSearchResultItemClick,
19
+ onSearchExternalUrlClick = _ref.onSearchExternalUrlClick,
20
+ searchExternalUrl = _ref.searchExternalUrl,
21
+ children = _ref.children;
25
22
  // Search
26
23
  var _useState = useState(''),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- searchValue = _useState2[0],
29
- setSearchValue = _useState2[1];
30
-
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ searchValue = _useState2[0],
26
+ setSearchValue = _useState2[1];
31
27
  var _useState3 = useState(null),
32
- _useState4 = _slicedToArray(_useState3, 2),
33
- searchResult = _useState4[0],
34
- setSearchResult = _useState4[1];
35
-
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ searchResult = _useState4[0],
30
+ setSearchResult = _useState4[1];
36
31
  var _useState5 = useState(REQUEST_STATE.done),
37
- _useState6 = _slicedToArray(_useState5, 2),
38
- searchState = _useState6[0],
39
- setSearchState = _useState6[1];
40
-
32
+ _useState6 = _slicedToArray(_useState5, 2),
33
+ searchState = _useState6[0],
34
+ setSearchState = _useState6[1];
41
35
  var _useState7 = useState(false),
42
- _useState8 = _slicedToArray(_useState7, 2),
43
- searchResultsVisible = _useState8[0],
44
- setSearchResultsVisible = _useState8[1];
45
-
36
+ _useState8 = _slicedToArray(_useState7, 2),
37
+ searchResultsVisible = _useState8[0],
38
+ setSearchResultsVisible = _useState8[1];
46
39
  var doSearch = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47
40
  var value,
48
- results,
49
- _args = arguments;
41
+ results,
42
+ _args = arguments;
50
43
  return _regeneratorRuntime.wrap(function _callee$(_context) {
51
44
  while (1) {
52
45
  switch (_context.prev = _context.next) {
53
46
  case 0:
54
47
  value = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
55
-
56
48
  if (!onSearch) {
57
49
  _context.next = 16;
58
50
  break;
59
51
  }
60
-
61
52
  _context.prev = 2;
62
53
  _context.next = 5;
63
54
  return onSearch(value);
64
-
65
55
  case 5:
66
56
  results = _context.sent;
67
57
  setSearchResult(results);
68
58
  setSearchState(REQUEST_STATE.done);
69
59
  _context.next = 14;
70
60
  break;
71
-
72
61
  case 10:
73
62
  _context.prev = 10;
74
63
  _context.t0 = _context["catch"](2);
75
64
  setSearchResult([]);
76
65
  setSearchState(REQUEST_STATE.error);
77
-
78
66
  case 14:
79
67
  _context.next = 17;
80
68
  break;
81
-
82
69
  case 16:
83
70
  setSearchState(REQUEST_STATE.error);
84
-
85
71
  case 17:
86
72
  case "end":
87
73
  return _context.stop();
@@ -90,7 +76,6 @@ export var SearchContextProvider = function SearchContextProvider(_ref) {
90
76
  }, _callee, null, [[2, 10]]);
91
77
  })), [onSearch]);
92
78
  var debouncedDoSearch = debounce(doSearch, 500);
93
-
94
79
  var search = onSearch && function (newSearchValue) {
95
80
  if (newSearchValue !== searchValue) {
96
81
  if (newSearchValue.length >= MIN_CHARACTERS_FOR_SEARCH) {
@@ -101,7 +86,6 @@ export var SearchContextProvider = function SearchContextProvider(_ref) {
101
86
  setSearchState(REQUEST_STATE.error);
102
87
  setSearchResult([]);
103
88
  }
104
-
105
89
  setSearchResultsVisible(true);
106
90
  } else if (newSearchValue.length === 0) {
107
91
  // If the search input is empty, the search results should be empty and
@@ -109,7 +93,6 @@ export var SearchContextProvider = function SearchContextProvider(_ref) {
109
93
  setSearchResult(null);
110
94
  setSearchResultsVisible(false);
111
95
  }
112
-
113
96
  setSearchValue(newSearchValue);
114
97
  } else {
115
98
  setSearchState(REQUEST_STATE.loading);
@@ -117,15 +100,12 @@ export var SearchContextProvider = function SearchContextProvider(_ref) {
117
100
  setSearchResultsVisible(true);
118
101
  }
119
102
  };
120
-
121
103
  var searchResultItemClick = function searchResultItemClick(event, analyticsEvent, articleData) {
122
104
  if (onSearchResultItemClick) {
123
105
  onSearchResultItemClick(event, analyticsEvent, articleData);
124
106
  }
125
-
126
107
  setSearchResultsVisible(false);
127
108
  };
128
-
129
109
  return /*#__PURE__*/React.createElement(CtxProvider, {
130
110
  value: {
131
111
  onSearch: search,