@shopgate/pwa-common 7.30.0-alpha.7 → 7.30.0-alpha.8

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 (306) hide show
  1. package/App.js +48 -6
  2. package/action-creators/app/index.js +75 -12
  3. package/action-creators/app/spec.js +96 -1
  4. package/action-creators/client/index.js +27 -5
  5. package/action-creators/client/spec.js +44 -1
  6. package/action-creators/error/index.js +15 -3
  7. package/action-creators/index.js +9 -1
  8. package/action-creators/menu/index.js +23 -4
  9. package/action-creators/menu/spec.js +37 -1
  10. package/action-creators/modal/index.js +15 -3
  11. package/action-creators/modal/spec.js +26 -1
  12. package/action-creators/page/index.js +24 -4
  13. package/action-creators/page/spec.js +38 -1
  14. package/action-creators/router/index.js +48 -7
  15. package/action-creators/url/index.js +24 -4
  16. package/action-creators/url/spec.js +45 -1
  17. package/action-creators/user/index.js +90 -13
  18. package/action-creators/user/spec.js +186 -2
  19. package/actions/app/handleDeepLink.js +11 -2
  20. package/actions/app/handleLink.js +62 -6
  21. package/actions/app/handlePushNotification.js +32 -4
  22. package/actions/app/handleUniversalLink.js +11 -2
  23. package/actions/app/registerLinkEvents.js +24 -3
  24. package/actions/client/fetchClientInformation.js +26 -2
  25. package/actions/menu/fetchMenu.js +23 -2
  26. package/actions/modal/closeModal.js +18 -2
  27. package/actions/modal/promiseMap.js +3 -1
  28. package/actions/modal/showModal.js +54 -8
  29. package/actions/page/fetchPageConfig.js +69 -2
  30. package/actions/page/getPageConfig.js +6 -2
  31. package/actions/page/index.js +1 -1
  32. package/actions/router/historyPop.js +12 -2
  33. package/actions/router/historyPopToRoute.js +27 -2
  34. package/actions/router/historyPush.js +12 -2
  35. package/actions/router/historyRedirect.js +21 -2
  36. package/actions/router/historyReplace.js +20 -3
  37. package/actions/router/historyReset.js +11 -2
  38. package/actions/router/historyResetTo.js +12 -2
  39. package/actions/router/index.js +17 -1
  40. package/actions/router/routeDidPop.js +11 -2
  41. package/actions/router/routeDidPush.js +13 -2
  42. package/actions/router/routeDidReplace.js +11 -2
  43. package/actions/router/routeDidReset.js +11 -2
  44. package/actions/router/routeDidUpdate.js +10 -2
  45. package/actions/router/routeWillPop.js +11 -2
  46. package/actions/router/routeWillPush.js +13 -2
  47. package/actions/router/routeWillReplace.js +11 -2
  48. package/actions/router/routeWillReset.js +11 -2
  49. package/actions/router/windowOpenOverride.js +10 -2
  50. package/actions/user/fetchRegisterUrl.js +36 -2
  51. package/actions/user/fetchUser.js +29 -3
  52. package/actions/user/getUser.js +6 -2
  53. package/actions/user/index.js +1 -1
  54. package/actions/user/login.js +76 -9
  55. package/actions/user/logout.js +30 -2
  56. package/collections/AuthRoutes.js +73 -14
  57. package/collections/Configuration.js +54 -7
  58. package/collections/EmbeddedMedia.js +84 -11
  59. package/collections/PersistedReducers.js +41 -6
  60. package/collections/Redirects.js +103 -17
  61. package/collections/index.js +5 -1
  62. package/collections/media-providers/MediaProvider.js +151 -26
  63. package/collections/media-providers/Vimeo.js +113 -19
  64. package/collections/media-providers/YouTube.js +74 -14
  65. package/collections/media-providers/index.js +3 -1
  66. package/collections/media-providers/style.js +52 -2
  67. package/components/Backdrop/index.js +95 -6
  68. package/components/Backdrop/spec.js +23 -1
  69. package/components/Backdrop/style.js +11 -2
  70. package/components/Button/index.js +47 -5
  71. package/components/Button/spec.js +36 -1
  72. package/components/Button/style.js +6 -1
  73. package/components/Checkbox/index.js +126 -32
  74. package/components/Checkbox/spec.js +94 -3
  75. package/components/Consume/helpers/buildParams.js +13 -2
  76. package/components/Consume/index.js +14 -2
  77. package/components/CountdownTimer/index.js +115 -17
  78. package/components/CountdownTimer/spec.js +126 -12
  79. package/components/Drawer/index.js +131 -16
  80. package/components/Drawer/spec.js +76 -1
  81. package/components/Drawer/style.js +37 -1
  82. package/components/Dropdown/index.js +65 -6
  83. package/components/Dropdown/style.js +4 -1
  84. package/components/Dropdown/transitions.js +34 -1
  85. package/components/Ellipsis/index.js +16 -2
  86. package/components/Ellipsis/spec.js +13 -1
  87. package/components/EmbeddedMedia/index.js +56 -6
  88. package/components/EmbeddedMedia/spec.js +52 -3
  89. package/components/ErrorBoundary/connector.js +9 -2
  90. package/components/ErrorBoundary/index.js +43 -7
  91. package/components/Grid/components/Item/index.js +40 -4
  92. package/components/Grid/components/Item/spec.js +23 -1
  93. package/components/Grid/components/Item/style.js +17 -3
  94. package/components/Grid/index.js +36 -4
  95. package/components/Grid/spec.js +23 -1
  96. package/components/Grid/style.js +11 -2
  97. package/components/HtmlSanitizer/connector.js +24 -3
  98. package/components/HtmlSanitizer/index.js +104 -12
  99. package/components/HtmlSanitizer/spec.js +207 -6
  100. package/components/I18n/components/FormatDate/index.js +26 -2
  101. package/components/I18n/components/FormatDate/spec.js +46 -1
  102. package/components/I18n/components/FormatNumber/index.js +34 -2
  103. package/components/I18n/components/FormatNumber/spec.js +41 -2
  104. package/components/I18n/components/FormatPrice/index.js +32 -2
  105. package/components/I18n/components/FormatPrice/spec.js +46 -1
  106. package/components/I18n/components/FormatTime/index.js +26 -2
  107. package/components/I18n/components/FormatTime/spec.js +43 -2
  108. package/components/I18n/components/I18nProvider/index.js +52 -9
  109. package/components/I18n/components/I18nProvider/spec.js +39 -1
  110. package/components/I18n/components/Placeholder/index.js +8 -2
  111. package/components/I18n/components/Placeholder/spec.js +30 -1
  112. package/components/I18n/components/Translate/index.js +68 -7
  113. package/components/I18n/components/Translate/spec.js +30 -1
  114. package/components/I18n/index.js +16 -1
  115. package/components/Icon/index.js +25 -2
  116. package/components/Icon/style.js +6 -1
  117. package/components/Image/Image.js +176 -19
  118. package/components/Image/ImageInner.js +48 -2
  119. package/components/Image/index.js +1 -1
  120. package/components/Image/style.js +29 -2
  121. package/components/InfiniteContainer/index.js +381 -49
  122. package/components/InfiniteContainer/spec.js +199 -10
  123. package/components/Input/components/DateInput.js +262 -6
  124. package/components/Input/components/MultiLineInput.js +98 -12
  125. package/components/Input/components/SimpleInput.js +207 -31
  126. package/components/Input/index.js +32 -3
  127. package/components/Input/spec.js +122 -1
  128. package/components/KeyboardConsumer/index.js +48 -7
  129. package/components/Link/connector.js +7 -1
  130. package/components/Link/index.js +96 -11
  131. package/components/Link/spec.js +56 -1
  132. package/components/Link/style.js +10 -1
  133. package/components/List/components/Item/index.js +35 -3
  134. package/components/List/components/Item/style.js +16 -1
  135. package/components/List/index.js +20 -2
  136. package/components/List/spec.js +31 -1
  137. package/components/Loading/index.js +6 -2
  138. package/components/Modal/index.js +38 -3
  139. package/components/Modal/style.js +36 -1
  140. package/components/ModalContainer/connector.js +17 -3
  141. package/components/ModalContainer/index.js +36 -3
  142. package/components/ModalContainer/spec.js +105 -5
  143. package/components/Picker/components/Button/index.js +34 -2
  144. package/components/Picker/components/Button/style.js +19 -1
  145. package/components/Picker/components/List/index.js +33 -2
  146. package/components/Picker/components/List/style.js +17 -1
  147. package/components/Picker/components/Modal/index.js +60 -7
  148. package/components/Picker/components/Modal/style.js +78 -1
  149. package/components/Picker/index.js +167 -21
  150. package/components/Picker/spec.js +83 -2
  151. package/components/Portal/index.js +130 -19
  152. package/components/ProductCharacteristics/connector.js +33 -4
  153. package/components/ProductCharacteristics/context.js +2 -1
  154. package/components/ProductCharacteristics/helpers/index.js +135 -21
  155. package/components/ProductCharacteristics/index.js +266 -31
  156. package/components/RangeSlider/components/Handle/index.js +25 -2
  157. package/components/RangeSlider/components/Handle/style.js +14 -1
  158. package/components/RangeSlider/helper.js +43 -8
  159. package/components/RangeSlider/index.js +228 -38
  160. package/components/RangeSlider/style.js +14 -1
  161. package/components/Route/RouteNotFound.js +46 -3
  162. package/components/Route/index.js +78 -10
  163. package/components/Router/connector.js +9 -2
  164. package/components/Router/index.js +237 -31
  165. package/components/ScannerContainer/connector.js +9 -2
  166. package/components/ScannerContainer/index.js +42 -6
  167. package/components/Select/components/Item/index.js +20 -4
  168. package/components/Select/components/Item/style.js +4 -1
  169. package/components/Select/index.js +149 -28
  170. package/components/Select/spec.js +86 -2
  171. package/components/Select/style.js +17 -1
  172. package/components/SelectBox/components/Item/index.js +47 -5
  173. package/components/SelectBox/components/Item/style.js +7 -1
  174. package/components/SelectBox/index.js +173 -17
  175. package/components/SelectBox/spec.js +59 -3
  176. package/components/SelectBox/style.js +18 -1
  177. package/components/Slider/index.js +6 -2
  178. package/components/SurroundPortals/index.js +26 -2
  179. package/components/Swiper/components/SwiperItem/index.js +28 -4
  180. package/components/Swiper/components/SwiperItem/spec.js +17 -1
  181. package/components/Swiper/components/SwiperItem/styles.js +5 -1
  182. package/components/Swiper/index.js +210 -18
  183. package/components/Swiper/styles.js +75 -7
  184. package/components/Toaster/index.js +10 -2
  185. package/components/Transition/index.js +89 -13
  186. package/components/Widgets/components/Widget/index.js +52 -4
  187. package/components/Widgets/components/Widget/spec.js +68 -3
  188. package/components/Widgets/components/Widget/style.js +21 -3
  189. package/components/Widgets/components/WidgetGrid/index.js +52 -7
  190. package/components/Widgets/components/WidgetGrid/spec.js +46 -2
  191. package/components/Widgets/components/WidgetGrid/style.js +8 -1
  192. package/components/Widgets/helpers/shouldShowWidget.js +44 -7
  193. package/components/Widgets/index.js +127 -15
  194. package/components/Widgets/spec.js +213 -6
  195. package/components/index.js +9 -1
  196. package/constants/ActionTypes.js +97 -19
  197. package/constants/Configuration.js +12 -2
  198. package/constants/Device.js +29 -2
  199. package/constants/DisplayOptions.js +8 -1
  200. package/constants/MenuIDs.js +2 -1
  201. package/constants/ModalTypes.js +1 -1
  202. package/constants/PageIDs.js +1 -1
  203. package/constants/Pipelines.js +7 -1
  204. package/constants/Portals.js +136 -3
  205. package/constants/Registration.js +3 -1
  206. package/constants/RoutePaths.js +13 -2
  207. package/constants/Tracking.js +3 -1
  208. package/constants/client.js +6 -1
  209. package/constants/ui.js +2 -1
  210. package/constants/user.js +6 -2
  211. package/context/index.js +33 -3
  212. package/helpers/config/index.js +139 -21
  213. package/helpers/config/mock.js +200 -8
  214. package/helpers/config/theme.js +50 -4
  215. package/helpers/data/index.js +204 -29
  216. package/helpers/data/spec.js +187 -7
  217. package/helpers/date/index.js +58 -6
  218. package/helpers/date/spec.js +92 -1
  219. package/helpers/dom/index.js +48 -11
  220. package/helpers/environment/index.js +14 -2
  221. package/helpers/html/decodeHTML.js +7 -1
  222. package/helpers/html/handleDOM.js +172 -21
  223. package/helpers/html/parseHTML.js +67 -12
  224. package/helpers/i18n/getDateFormatter.js +23 -4
  225. package/helpers/i18n/getNumberFormatter.js +32 -4
  226. package/helpers/i18n/getPriceFormatter.js +38 -4
  227. package/helpers/i18n/getTimeFormatter.js +23 -4
  228. package/helpers/i18n/getTranslator.js +62 -8
  229. package/helpers/i18n/index.js +5 -1
  230. package/helpers/i18n/mergeTranslations.js +36 -9
  231. package/helpers/i18n/messageCache.js +3 -1
  232. package/helpers/legacy/index.js +47 -9
  233. package/helpers/modal/withShowModal.js +13 -2
  234. package/helpers/portals/portalCollection.js +28 -6
  235. package/helpers/portals/routePortals.js +12 -1
  236. package/helpers/redux/compareObjects.js +7 -2
  237. package/helpers/redux/generateResultHash.js +36 -3
  238. package/helpers/redux/generateSortedHash.js +7 -2
  239. package/helpers/redux/hasExpired.js +10 -2
  240. package/helpers/redux/index.js +7 -1
  241. package/helpers/redux/mutable.js +143 -24
  242. package/helpers/redux/shouldFetchData.js +46 -10
  243. package/helpers/redux/shouldFetchFilters.js +17 -4
  244. package/helpers/router/index.js +49 -5
  245. package/helpers/style/index.js +43 -4
  246. package/helpers/style/spec.js +108 -2
  247. package/helpers/tracking/index.js +52 -9
  248. package/helpers/validation/index.js +39 -12
  249. package/helpers/validation/spec.js +10 -1
  250. package/package.json +3 -3
  251. package/providers/index.js +4 -1
  252. package/providers/loading/context.js +2 -1
  253. package/providers/loading/index.js +137 -22
  254. package/providers/toast/context.js +2 -1
  255. package/providers/toast/index.js +105 -11
  256. package/reducers/client/connectivity.js +22 -2
  257. package/reducers/client/index.js +7 -1
  258. package/reducers/client/info.js +27 -2
  259. package/reducers/index.js +23 -4
  260. package/reducers/menu/index.js +5 -1
  261. package/reducers/menu/menusById.js +41 -2
  262. package/reducers/modal/index.js +14 -2
  263. package/reducers/page/index.js +68 -5
  264. package/reducers/router/index.js +48 -2
  265. package/reducers/url/index.js +42 -3
  266. package/reducers/user/data.js +27 -2
  267. package/reducers/user/index.js +7 -1
  268. package/reducers/user/login.js +65 -2
  269. package/selectors/client.js +138 -21
  270. package/selectors/history.js +49 -11
  271. package/selectors/menu.js +34 -6
  272. package/selectors/modal.js +15 -4
  273. package/selectors/page.js +25 -4
  274. package/selectors/router.js +154 -30
  275. package/selectors/url.js +25 -4
  276. package/selectors/user.js +90 -13
  277. package/store/index.js +60 -6
  278. package/store/middelwares/logger.js +7 -1
  279. package/store/middelwares/streams.js +19 -2
  280. package/streams/app.js +60 -8
  281. package/streams/client.js +8 -2
  282. package/streams/error.js +14 -3
  283. package/streams/index.js +6 -1
  284. package/streams/interval.js +6 -2
  285. package/streams/main.js +27 -2
  286. package/streams/router.js +45 -8
  287. package/streams/user.js +89 -15
  288. package/streams/view.js +97 -25
  289. package/styles/reset/form.js +57 -5
  290. package/styles/reset/index.js +6 -1
  291. package/styles/reset/media.js +22 -1
  292. package/styles/reset/root.js +33 -1
  293. package/styles/reset/table.js +10 -1
  294. package/styles/reset/typography.js +26 -1
  295. package/subscriptions/app.js +148 -17
  296. package/subscriptions/error.js +292 -13
  297. package/subscriptions/helpers/buildRegisterUrl.js +25 -6
  298. package/subscriptions/helpers/clearUpInAppBrowser.js +14 -3
  299. package/subscriptions/helpers/handleLinks.js +267 -25
  300. package/subscriptions/helpers/pipeline.js +12 -1
  301. package/subscriptions/history.js +34 -6
  302. package/subscriptions/index.js +25 -4
  303. package/subscriptions/menu.js +22 -5
  304. package/subscriptions/mock.js +39 -7
  305. package/subscriptions/router.js +336 -23
  306. package/subscriptions/user.js +93 -3
@@ -1,5 +1,14 @@
1
- import{ACTION_REPLACE}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_REPLACE } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeWillReplace(prev,next){return function(dispatch){dispatch(actions.routeWillLeave(prev,ACTION_REPLACE));dispatch(actions.routeWillEnter(next,ACTION_REPLACE));};}
8
+ */
9
+ export function routeWillReplace(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeWillLeave(prev, ACTION_REPLACE));
12
+ dispatch(actions.routeWillEnter(next, ACTION_REPLACE));
13
+ };
14
+ }
@@ -1,5 +1,14 @@
1
- import{ACTION_RESET}from'@virtuous/conductor';import*as actions from"../../action-creators/router";/**
1
+ import { ACTION_RESET } from '@virtuous/conductor';
2
+ import * as actions from "../../action-creators/router";
3
+
4
+ /**
2
5
  * @param {Route} prev The previous route.
3
6
  * @param {Route} next The next route.
4
7
  * @returns {Function}
5
- */export function routeWillReset(prev,next){return function(dispatch){dispatch(actions.routeWillLeave(prev,ACTION_RESET));dispatch(actions.routeWillEnter(next,ACTION_RESET));};}
8
+ */
9
+ export function routeWillReset(prev, next) {
10
+ return dispatch => {
11
+ dispatch(actions.routeWillLeave(prev, ACTION_RESET));
12
+ dispatch(actions.routeWillEnter(next, ACTION_RESET));
13
+ };
14
+ }
@@ -1,7 +1,15 @@
1
- import{WINDOW_OPEN_OVERRIDE}from"../../constants/ActionTypes";/**
1
+ import { WINDOW_OPEN_OVERRIDE } from "../../constants/ActionTypes";
2
+
3
+ /**
2
4
  * Indicates a call to window.open e.g. invoked by an external SDK.
3
5
  *
4
6
  * @param {Object} params Action params
5
7
  * @param {string} params.pathname The pathname window.open was called with
6
8
  * @returns {Object}
7
- */export var windowOpenOverride=function windowOpenOverride(_ref){var pathname=_ref.pathname;return{type:WINDOW_OPEN_OVERRIDE,pathname:pathname};};
9
+ */
10
+ export const windowOpenOverride = ({
11
+ pathname
12
+ }) => ({
13
+ type: WINDOW_OPEN_OVERRIDE,
14
+ pathname
15
+ });
@@ -1,4 +1,38 @@
1
- import{PipelineRequest}from'@shopgate/pwa-core';import{requestUrl,receiveUrl,errorUrl}from"../../action-creators/url";import{SHOPGATE_USER_GET_REGISTRATION_URL}from"../../constants/Pipelines";import{URL_TYPE_REGISTER}from"../../constants/Registration";import{shouldFetchData,mutable}from"../../helpers/redux";import{getEntryByType}from"../../selectors/url";import{getRegisterUrl}from"../../selectors/user";/**
1
+ import { PipelineRequest } from '@shopgate/pwa-core';
2
+ import { requestUrl, receiveUrl, errorUrl } from "../../action-creators/url";
3
+ import { SHOPGATE_USER_GET_REGISTRATION_URL } from "../../constants/Pipelines";
4
+ import { URL_TYPE_REGISTER } from "../../constants/Registration";
5
+ import { shouldFetchData, mutable } from "../../helpers/redux";
6
+ import { getEntryByType } from "../../selectors/url";
7
+ import { getRegisterUrl } from "../../selectors/user";
8
+
9
+ /**
2
10
  * Get the url for the registration.
3
11
  * @return {Function} A redux thunk.
4
- */function fetchRegisterUrl(){return function(dispatch,getState){return new Promise(function(resolve,reject){var state=getState();var entry=getEntryByType(state,{type:URL_TYPE_REGISTER});if(!shouldFetchData(entry,'url')){resolve(getRegisterUrl(state));return;}dispatch(requestUrl(URL_TYPE_REGISTER));new PipelineRequest(SHOPGATE_USER_GET_REGISTRATION_URL).setTrusted().dispatch().then(function(_ref){var url=_ref.url,expires=_ref.expires;dispatch(receiveUrl(URL_TYPE_REGISTER,url,expires));resolve(url);})["catch"](function(){dispatch(errorUrl(URL_TYPE_REGISTER));reject();});});};}/** @mixes {MutableFunction} */export default mutable(fetchRegisterUrl);
12
+ */
13
+ function fetchRegisterUrl() {
14
+ return (dispatch, getState) => new Promise((resolve, reject) => {
15
+ const state = getState();
16
+ const entry = getEntryByType(state, {
17
+ type: URL_TYPE_REGISTER
18
+ });
19
+ if (!shouldFetchData(entry, 'url')) {
20
+ resolve(getRegisterUrl(state));
21
+ return;
22
+ }
23
+ dispatch(requestUrl(URL_TYPE_REGISTER));
24
+ new PipelineRequest(SHOPGATE_USER_GET_REGISTRATION_URL).setTrusted().dispatch().then(({
25
+ url,
26
+ expires
27
+ }) => {
28
+ dispatch(receiveUrl(URL_TYPE_REGISTER, url, expires));
29
+ resolve(url);
30
+ }).catch(() => {
31
+ dispatch(errorUrl(URL_TYPE_REGISTER));
32
+ reject();
33
+ });
34
+ });
35
+ }
36
+
37
+ /** @mixes {MutableFunction} */
38
+ export default mutable(fetchRegisterUrl);
@@ -1,5 +1,31 @@
1
- import{PipelineRequest,EACCESS}from'@shopgate/pwa-core';import{requestUser,receiveUser,errorUser,toggleLoggedIn}from"../../action-creators/user";import{SHOPGATE_USER_GET_USER}from"../../constants/Pipelines";import{mutable}from"../../helpers/redux";import{isUserLoggedIn}from"../../selectors/user";/**
1
+ import { PipelineRequest, EACCESS } from '@shopgate/pwa-core';
2
+ import { requestUser, receiveUser, errorUser, toggleLoggedIn } from "../../action-creators/user";
3
+ import { SHOPGATE_USER_GET_USER } from "../../constants/Pipelines";
4
+ import { mutable } from "../../helpers/redux";
5
+ import { isUserLoggedIn } from "../../selectors/user";
6
+
7
+ /**
2
8
  * Get the current user
3
9
  * @return {Function} A redux thunk.
4
- */function fetchUser(){return function(dispatch,getState){dispatch(requestUser());var request=new PipelineRequest(SHOPGATE_USER_GET_USER).setTrusted().setErrorBlacklist([EACCESS]).dispatch();request.then(function(user){dispatch(receiveUser(user));// If the user's login state was incorrectly set false then set to true.
5
- if(!isUserLoggedIn(getState())){dispatch(toggleLoggedIn(true));}})["catch"](function(error){dispatch(toggleLoggedIn(false));dispatch(errorUser(error));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchUser);
10
+ */
11
+ function fetchUser() {
12
+ return (dispatch, getState) => {
13
+ dispatch(requestUser());
14
+ const request = new PipelineRequest(SHOPGATE_USER_GET_USER).setTrusted().setErrorBlacklist([EACCESS]).dispatch();
15
+ request.then(user => {
16
+ dispatch(receiveUser(user));
17
+
18
+ // If the user's login state was incorrectly set false then set to true.
19
+ if (!isUserLoggedIn(getState())) {
20
+ dispatch(toggleLoggedIn(true));
21
+ }
22
+ }).catch(error => {
23
+ dispatch(toggleLoggedIn(false));
24
+ dispatch(errorUser(error));
25
+ });
26
+ return request;
27
+ };
28
+ }
29
+
30
+ /** @mixes {MutableFunction} */
31
+ export default mutable(fetchUser);
@@ -1,5 +1,9 @@
1
- import fetchUser from"./fetchUser";/**
1
+ import fetchUser from "./fetchUser";
2
+
3
+ /**
2
4
  * Get the current user
3
5
  * @return {Function} A redux thunk.
4
6
  * @deprecated Will be removed in the near future. Use fetchUser instead.
5
- */var getUser=fetchUser;export default getUser;
7
+ */
8
+ const getUser = fetchUser;
9
+ export default getUser;
@@ -1 +1 @@
1
- export{default as fetchUser}from"./fetchUser";
1
+ export { default as fetchUser } from "./fetchUser";
@@ -1,4 +1,11 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{PipelineRequest,EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN}from'@shopgate/pwa-core';import{requestLogin,successLogin,errorLogin,errorLegacyConnectRegister}from"../../action-creators/user";import{SHOPGATE_USER_LOGIN_USER}from"../../constants/Pipelines";import{DEFAULT_LOGIN_STRATEGY}from"../../constants/user";import{mutable}from"../../helpers/redux";import appConfig from"../../helpers/config";/**
1
+ import { PipelineRequest, EINVALIDCALL, ELEGACYSGCONNECT, EINCOMPLETELOGIN } from '@shopgate/pwa-core';
2
+ import { requestLogin, successLogin, errorLogin, errorLegacyConnectRegister } from "../../action-creators/user";
3
+ import { SHOPGATE_USER_LOGIN_USER } from "../../constants/Pipelines";
4
+ import { DEFAULT_LOGIN_STRATEGY } from "../../constants/user";
5
+ import { mutable } from "../../helpers/redux";
6
+ import appConfig from "../../helpers/config";
7
+
8
+ /**
2
9
  * Login the current user.
3
10
  * @param {Object} parameters The login credentials.
4
11
  * @param {string} parameters.login The username to login.
@@ -6,11 +13,71 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
6
13
  * @param {string} redirect The location to redirect to when logged in.
7
14
  * @param {string} strategy basic or facebook, amazon, etc
8
15
  * @return {Function} A redux thunk.
9
- */function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,recaptchaEnabled,googleCloudSiteKey,recaptchaToken,request;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_ref2=(appConfig===null||appConfig===void 0?void 0:appConfig.recaptcha)||{},recaptchaEnabled=_ref2.enabled,googleCloudSiteKey=_ref2.googleCloudSiteKey;dispatch(requestLogin(parameters.login,parameters.password,strategy));if(!(recaptchaEnabled&&googleCloudSiteKey)){_context.next=13;break;}_context.prev=3;_context.next=6;return new Promise(function(resolve){return window.grecaptcha.enterprise.ready(resolve);});case 6:_context.next=8;return window.grecaptcha.enterprise.execute(googleCloudSiteKey,{action:'login'});case 8:recaptchaToken=_context.sent;_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](3);case 13:request=new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN]).setInput({strategy:strategy,parameters:_extends({},parameters,{},recaptchaToken?{recaptchaToken:recaptchaToken}:null)}).dispatch();request.then(function(result){var success=result.success,messages=result.messages,sessionLifetimeInSeconds=result.sessionLifetimeInSeconds;if(success){dispatch(successLogin(redirect,strategy,sessionLifetimeInSeconds));}else{dispatch(errorLogin(messages));}})["catch"](function(error){var code=error.code;if(code===EINVALIDCALL){/**
10
- * This code is thrown when the login request failed, because the user was already logged
11
- * in. In that situation the success action can also dispatch to trigger the necessary
12
- * processes which has to happen after a successful login.
13
- */dispatch(successLogin(redirect,strategy));}else if(code===ELEGACYSGCONNECT){/**
14
- * The app is connected to the shop system via the legacy shopgate connect. Login via
15
- * the shop system credentials failed and further steps are necessary to login the user.
16
- */dispatch(errorLegacyConnectRegister());dispatch(errorLogin([],ELEGACYSGCONNECT));}else{dispatch(errorLogin([],code));}});return _context.abrupt("return",request);case 16:case"end":return _context.stop();}},_callee,null,[[3,11]]);}));return function(_x){return _ref.apply(this,arguments);};}());}/** @mixes {MutableFunction} */export default mutable(login);
16
+ */
17
+ function login(parameters, redirect, strategy = DEFAULT_LOGIN_STRATEGY) {
18
+ return async dispatch => {
19
+ const {
20
+ enabled: recaptchaEnabled,
21
+ googleCloudSiteKey
22
+ } = appConfig?.recaptcha || {};
23
+ dispatch(requestLogin(parameters.login, parameters.password, strategy));
24
+ let recaptchaToken;
25
+ if (recaptchaEnabled && googleCloudSiteKey) {
26
+ try {
27
+ // Add a reCAPTCHA token to the login request when feature is configured
28
+ await new Promise(resolve => window.grecaptcha.enterprise.ready(resolve));
29
+ recaptchaToken = await window.grecaptcha.enterprise.execute(googleCloudSiteKey, {
30
+ action: 'login'
31
+ });
32
+ } catch (e) {
33
+ // noting to do here - just for protection
34
+ }
35
+ }
36
+ const request = new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL, ELEGACYSGCONNECT, EINCOMPLETELOGIN]).setInput({
37
+ strategy,
38
+ parameters: {
39
+ ...parameters,
40
+ ...(recaptchaToken ? {
41
+ recaptchaToken
42
+ } : null)
43
+ }
44
+ }).dispatch();
45
+ request.then(result => {
46
+ const {
47
+ success,
48
+ messages,
49
+ sessionLifetimeInSeconds
50
+ } = result;
51
+ if (success) {
52
+ dispatch(successLogin(redirect, strategy, sessionLifetimeInSeconds));
53
+ } else {
54
+ dispatch(errorLogin(messages));
55
+ }
56
+ }).catch(error => {
57
+ const {
58
+ code
59
+ } = error;
60
+ if (code === EINVALIDCALL) {
61
+ /**
62
+ * This code is thrown when the login request failed, because the user was already logged
63
+ * in. In that situation the success action can also dispatch to trigger the necessary
64
+ * processes which has to happen after a successful login.
65
+ */
66
+ dispatch(successLogin(redirect, strategy));
67
+ } else if (code === ELEGACYSGCONNECT) {
68
+ /**
69
+ * The app is connected to the shop system via the legacy shopgate connect. Login via
70
+ * the shop system credentials failed and further steps are necessary to login the user.
71
+ */
72
+ dispatch(errorLegacyConnectRegister());
73
+ dispatch(errorLogin([], ELEGACYSGCONNECT));
74
+ } else {
75
+ dispatch(errorLogin([], code));
76
+ }
77
+ });
78
+ return request;
79
+ };
80
+ }
81
+
82
+ /** @mixes {MutableFunction} */
83
+ export default mutable(login);
@@ -1,6 +1,34 @@
1
- import{PipelineRequest}from'@shopgate/pwa-core';import{requestLogout,successLogout,errorLogout}from"../../action-creators/user";import{SHOPGATE_USER_LOGOUT_USER}from"../../constants/Pipelines";import{mutable}from"../../helpers/redux";/**
1
+ import { PipelineRequest } from '@shopgate/pwa-core';
2
+ import { requestLogout, successLogout, errorLogout } from "../../action-creators/user";
3
+ import { SHOPGATE_USER_LOGOUT_USER } from "../../constants/Pipelines";
4
+ import { mutable } from "../../helpers/redux";
5
+
6
+ /**
2
7
  * Logout the current user.
3
8
  * @param {boolean} [notify=true] If set to TRUE users are notified when the logout was successful.
4
9
  * @param {boolean} [autoLogout=false] Whether the logout happened because session expired
5
10
  * @return {Function} A redux thunk.
6
- */function logout(){var notify=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var autoLogout=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return function(dispatch){dispatch(requestLogout());var request=new PipelineRequest(SHOPGATE_USER_LOGOUT_USER).setTrusted().dispatch();request.then(function(result){var success=result.success,messages=result.messages;if(success){dispatch(successLogout(notify,autoLogout));}else{dispatch(errorLogout(messages,autoLogout));}})["catch"](function(){dispatch(errorLogout(undefined,autoLogout));});return request;};}/** @mixes {MutableFunction} */export default mutable(logout);
11
+ */
12
+ function logout(notify = true, autoLogout = false) {
13
+ return dispatch => {
14
+ dispatch(requestLogout());
15
+ const request = new PipelineRequest(SHOPGATE_USER_LOGOUT_USER).setTrusted().dispatch();
16
+ request.then(result => {
17
+ const {
18
+ success,
19
+ messages
20
+ } = result;
21
+ if (success) {
22
+ dispatch(successLogout(notify, autoLogout));
23
+ } else {
24
+ dispatch(errorLogout(messages, autoLogout));
25
+ }
26
+ }).catch(() => {
27
+ dispatch(errorLogout(undefined, autoLogout));
28
+ });
29
+ return request;
30
+ };
31
+ }
32
+
33
+ /** @mixes {MutableFunction} */
34
+ export default mutable(logout);
@@ -1,34 +1,93 @@
1
- function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}import pathMatch from'path-match';/**
1
+ import pathMatch from 'path-match';
2
+
3
+ /**
2
4
  * Class to maintain the routes that should be protected by authentication.
3
- */var AuthRoutes=/*#__PURE__*/function(){/**
5
+ */
6
+ class AuthRoutes {
7
+ /**
4
8
  * Constructor
5
- */function AuthRoutes(){_classCallCheck(this,AuthRoutes);this.routes=new Map();this.matcher=pathMatch({sensitive:false,strict:false,end:true});}/**
9
+ */
10
+ constructor() {
11
+ this.routes = new Map();
12
+ this.matcher = pathMatch({
13
+ sensitive: false,
14
+ strict: false,
15
+ end: true
16
+ });
17
+ }
18
+
19
+ /**
6
20
  * Finds a particular protected route.
7
21
  * @param {string} pattern The pattern to find.
8
22
  * @return {string|null}
9
- */return _createClass(AuthRoutes,[{key:"get",value:function get(pattern){return this.routes.get(pattern)||null;}/**
23
+ */
24
+ get(pattern) {
25
+ return this.routes.get(pattern) || null;
26
+ }
27
+
28
+ /**
10
29
  * Returns all protected routes.
11
30
  * @return {Map}
12
- */},{key:"getAll",value:function getAll(){return this.routes;}/**
31
+ */
32
+ getAll() {
33
+ return this.routes;
34
+ }
35
+
36
+ /**
13
37
  * Sets a new route as protected.
14
38
  * @param {string} civilian The route to protect.
15
39
  * @param {string} bouncer The protector route.
16
- */},{key:"set",value:function set(civilian,bouncer){if(!civilian||!bouncer){return;}this.routes.set(civilian,bouncer);}/**
40
+ */
41
+ set(civilian, bouncer) {
42
+ if (!civilian || !bouncer) {
43
+ return;
44
+ }
45
+ this.routes.set(civilian, bouncer);
46
+ }
47
+
48
+ /**
17
49
  * Check if the given pathname is a protector route.
18
50
  * @param {string} location The location to check.
19
51
  * @return {boolean}
20
- */},{key:"isProtector",value:function isProtector(location){return Array.from(this.routes.values()).includes(location);}/**
52
+ */
53
+ isProtector(location) {
54
+ return Array.from(this.routes.values()).includes(location);
55
+ }
56
+
57
+ /**
21
58
  * Returns the protector for a passed location.
22
59
  * @param {string} location The location to check.
23
60
  * @return {string|null}
24
- */},{key:"getProtector",value:function getProtector(location){var _this=this;/**
61
+ */
62
+ getProtector(location) {
63
+ /**
25
64
  * Try to make a direct match with the location.
26
65
  * If we get lucky then we don't have to iterate over the protected patterns.
27
- */var protector=this.get(location);/**
66
+ */
67
+ let protector = this.get(location);
68
+
69
+ /**
28
70
  * If we didn't find a direct match then we need to match
29
71
  * the given location against the protected patters.
30
- */if(!protector){// Get the protected patterns as an array.
31
- var patterns=Array.from(this.routes.keys());var _location$split3=location.split('?'),_location$split4=_slicedToArray(_location$split3,1),locationWithoutParams=_location$split4[0];// Loop over the patterns until a match is found.
32
- patterns.some(function(pattern){// Check for a match.
33
- var match=_this.matcher(pattern)(locationWithoutParams);// Match found, set the protector.
34
- if(match){protector=_this.routes.get(pattern);}return match;});}return protector;}}]);}();export default new AuthRoutes();
72
+ */
73
+ if (!protector) {
74
+ // Get the protected patterns as an array.
75
+ const patterns = Array.from(this.routes.keys());
76
+ const [locationWithoutParams] = location.split('?');
77
+
78
+ // Loop over the patterns until a match is found.
79
+ patterns.some(pattern => {
80
+ // Check for a match.
81
+ const match = this.matcher(pattern)(locationWithoutParams);
82
+
83
+ // Match found, set the protector.
84
+ if (match) {
85
+ protector = this.routes.get(pattern);
86
+ }
87
+ return match;
88
+ });
89
+ }
90
+ return protector;
91
+ }
92
+ }
93
+ export default new AuthRoutes();
@@ -1,21 +1,68 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}import logGroup from'@shopgate/pwa-core/helpers/logGroup';/**
1
+ import logGroup from '@shopgate/pwa-core/helpers/logGroup';
2
+
3
+ /**
2
4
  * Class to maintain different configurations
3
- */var Configuration=/*#__PURE__*/function(){/**
5
+ */
6
+ class Configuration {
7
+ /**
4
8
  * Constructor
5
- */function Configuration(){_classCallCheck(this,Configuration);this.store=new Map();}/**
9
+ */
10
+ constructor() {
11
+ this.store = new Map();
12
+ }
13
+
14
+ /**
6
15
  * Get a config value
7
16
  * @param {*} key config key
8
17
  * @param {*} defaultValue defaultValue
9
18
  * @returns {*|undefined}
10
- */return _createClass(Configuration,[{key:"get",value:function get(key,defaultValue){return this.store.get(key)||defaultValue;}/**
19
+ */
20
+ get(key, defaultValue) {
21
+ return this.store.get(key) || defaultValue;
22
+ }
23
+
24
+ /**
11
25
  * Sets a configuration.
12
26
  * @param {*} key key
13
27
  * @param {*} value value
14
28
  * @returns {Configuration}
15
- */},{key:"set",value:function set(key,value){this.store.set(key,value);return this;}/**
29
+ */
30
+ set(key, value) {
31
+ this.store.set(key, value);
32
+ return this;
33
+ }
34
+
35
+ /**
16
36
  * Update config with given callback function
17
37
  * @param {*} key key
18
38
  * @param {Function} updater function to update value
19
39
  * @returns {Configuration}
20
- */},{key:"update",value:function update(key,updater){if(!this.store.has(key)){logGroup('CONFIGURATION%c not found',{key:key},'#e0061e');return this;}if(typeof updater!=='function'){logGroup('CONFIGURATION%c updater is not function',{key:key},'#e0061e');return this;}var prevValue=this.store.get(key);var newValue=updater(this.store.get(key));// eslint-disable-next-line extra-rules/no-single-line-objects
21
- logGroup('CONFIGURATION%c changed',{key:key,prevValue:prevValue,newValue:newValue},'#069215');return this.set(key,newValue);}}]);}();/** @type {Configuration} */export default new Configuration();
40
+ */
41
+ update(key, updater) {
42
+ if (!this.store.has(key)) {
43
+ logGroup('CONFIGURATION%c not found', {
44
+ key
45
+ }, '#e0061e');
46
+ return this;
47
+ }
48
+ if (typeof updater !== 'function') {
49
+ logGroup('CONFIGURATION%c updater is not function', {
50
+ key
51
+ }, '#e0061e');
52
+ return this;
53
+ }
54
+ const prevValue = this.store.get(key);
55
+ const newValue = updater(this.store.get(key));
56
+
57
+ // eslint-disable-next-line extra-rules/no-single-line-objects
58
+ logGroup('CONFIGURATION%c changed', {
59
+ key,
60
+ prevValue,
61
+ newValue
62
+ }, '#069215');
63
+ return this.set(key, newValue);
64
+ }
65
+ }
66
+
67
+ /** @type {Configuration} */
68
+ export default new Configuration();
@@ -1,21 +1,53 @@
1
- function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}/* eslint-disable extra-rules/potential-point-free */ /**
1
+ /* eslint-disable extra-rules/potential-point-free */
2
+ /**
2
3
  * Class to maintain embedded media within DOM containers.
3
- */var EmbeddedMedia=/*#__PURE__*/function(){/**
4
+ */
5
+ class EmbeddedMedia {
6
+ /**
4
7
  * Constructor
5
- */function EmbeddedMedia(){_classCallCheck(this,EmbeddedMedia);this.providers=new Set();}/**
8
+ */
9
+ constructor() {
10
+ this.providers = new Set();
11
+ }
12
+
13
+ /**
6
14
  * Add a provider for embedded media.
7
15
  * @param {Object} provider A provider instance.
8
- */return _createClass(EmbeddedMedia,[{key:"addProvider",value:function addProvider(provider){this.providers.add(provider);}/**
16
+ */
17
+ addProvider(provider) {
18
+ this.providers.add(provider);
19
+ }
20
+
21
+ /**
9
22
  * Remove a provider for embedded media.
10
23
  * @param {Object} provider A provider instance.
11
- */},{key:"removeProvider",value:function removeProvider(provider){this.providers["delete"](provider);}/**
24
+ */
25
+ removeProvider(provider) {
26
+ this.providers.delete(provider);
27
+ }
28
+
29
+ /**
12
30
  * Add a DOM container with embedded media.
13
31
  * @param {ParentNode} container A DOM container.
14
- */},{key:"add",value:function add(container){this.providers.forEach(function(provider){provider.add(container);});}/**
32
+ */
33
+ add(container) {
34
+ this.providers.forEach(provider => {
35
+ provider.add(container);
36
+ });
37
+ }
38
+
39
+ /**
15
40
  * Remove a DOM container. Should be called whenever a component which hosts a DOM container with
16
41
  * embedded media is unmounted.
17
42
  * @param {ParentNode} container A DOM container.
18
- */},{key:"remove",value:function remove(container){this.providers.forEach(function(provider){provider.remove(container);});}/**
43
+ */
44
+ remove(container) {
45
+ this.providers.forEach(provider => {
46
+ provider.remove(container);
47
+ });
48
+ }
49
+
50
+ /**
19
51
  * Searches for embedded media and replaces it with a placeholder element when required cookie
20
52
  * consent is not accepted.
21
53
  * Should be invoked before container content is added to the DOM to fulfill all regulations.
@@ -25,15 +57,56 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
25
57
  * are accepted.
26
58
  * @param {boolean} [cookieConsentSettings.statisticsCookiesAccepted] Whether statistics cookies
27
59
  * are accepted.
28
- */},{key:"handleCookieConsent",value:function handleCookieConsent(container){var cookieConsentSettings=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var cookieConsent=_extends({comfortCookiesAccepted:false,statisticsCookiesAccepted:false},cookieConsentSettings);this.providers.forEach(function(provider){if(provider.handleCookieConsent){provider.handleCookieConsent(container,cookieConsent);}});}/**
60
+ */
61
+ handleCookieConsent(container, cookieConsentSettings = {}) {
62
+ const cookieConsent = {
63
+ comfortCookiesAccepted: false,
64
+ statisticsCookiesAccepted: false,
65
+ ...cookieConsentSettings
66
+ };
67
+ this.providers.forEach(provider => {
68
+ if (provider.handleCookieConsent) {
69
+ provider.handleCookieConsent(container, cookieConsent);
70
+ }
71
+ });
72
+ }
73
+
74
+ /**
29
75
  * Applies optimizations to embedded media iframes within the given container.
30
76
  * Common enhancements include adding responsive wrappers and appropriate
31
77
  * sandbox attributes to improve security and layout behavior.
32
78
  *
33
79
  * @param {Document} document - The DOM document containing iframes to optimize.
34
- */},{key:"applyIframeOptimizations",value:function applyIframeOptimizations(document){this.providers.forEach(function(provider){provider.applyIframeOptimizations(document);});}/**
80
+ */
81
+ applyIframeOptimizations(document) {
82
+ this.providers.forEach(provider => {
83
+ provider.applyIframeOptimizations(document);
84
+ });
85
+ }
86
+
87
+ /**
35
88
  * Stops all playing media within the DOM containers.
36
- */},{key:"stop",value:function stop(){this.providers.forEach(function(provider){provider.stop();});}/**
89
+ */
90
+ stop() {
91
+ this.providers.forEach(provider => {
92
+ provider.stop();
93
+ });
94
+ }
95
+
96
+ /**
37
97
  * Check if we have media providers with not-ready SDK
38
98
  * @returns {boolean}
39
- */},{key:"getHasPendingProviders",value:function getHasPendingProviders(){var hasPendingProviders=false;this.providers.forEach(function(provider){if(provider.isPending){hasPendingProviders=true;}});return hasPendingProviders;}}]);}();export default new EmbeddedMedia();/* eslint-enable extra-rules/potential-point-free */
99
+ */
100
+ getHasPendingProviders() {
101
+ let hasPendingProviders = false;
102
+ this.providers.forEach(provider => {
103
+ if (provider.isPending) {
104
+ hasPendingProviders = true;
105
+ }
106
+ });
107
+ return hasPendingProviders;
108
+ }
109
+ }
110
+ export default new EmbeddedMedia();
111
+
112
+ /* eslint-enable extra-rules/potential-point-free */
@@ -1,16 +1,51 @@
1
- function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}/**
1
+ /**
2
2
  * Class to maintain the persisted redux reducers.
3
- */var PersistedReducers=/*#__PURE__*/function(){/**
3
+ */
4
+ class PersistedReducers {
5
+ /**
4
6
  * Constructor.
5
- */function PersistedReducers(){_classCallCheck(this,PersistedReducers);this.reducers=[];}/**
7
+ */
8
+ constructor() {
9
+ this.reducers = [];
10
+ }
11
+
12
+ /**
6
13
  * Returns all reducers.
7
14
  * @return {Array}
8
- */return _createClass(PersistedReducers,[{key:"getAll",value:function getAll(){return this.reducers;}/**
15
+ */
16
+ getAll() {
17
+ return this.reducers;
18
+ }
19
+
20
+ /**
9
21
  * Sets a new reducers to be persisted.
10
22
  * @param {string|Array} reducer The name of the reducer to persist.
11
23
  * @return {PersistedReducers}
12
- */},{key:"set",value:function set(reducer){var _this=this;if(Array.isArray(reducer)){reducer.forEach(function(red){if(!_this.reducers.includes(red)){_this.reducers.push(red);}});return this;}if(this.reducers.includes(reducer)){return this;}this.reducers.push(reducer);return this;}/**
24
+ */
25
+ set(reducer) {
26
+ if (Array.isArray(reducer)) {
27
+ reducer.forEach(red => {
28
+ if (!this.reducers.includes(red)) {
29
+ this.reducers.push(red);
30
+ }
31
+ });
32
+ return this;
33
+ }
34
+ if (this.reducers.includes(reducer)) {
35
+ return this;
36
+ }
37
+ this.reducers.push(reducer);
38
+ return this;
39
+ }
40
+
41
+ /**
13
42
  * Removes a reducer from the list of persisted reducers.
14
43
  * @param {string} reducer The name of the reducer to remove.
15
44
  * @return {PersistedReducers}
16
- */},{key:"remove",value:function remove(reducer){this.reducers=this.reducers.filter(function(red){return red!==reducer;});return this;}}]);}();export default new PersistedReducers();
45
+ */
46
+ remove(reducer) {
47
+ this.reducers = this.reducers.filter(red => red !== reducer);
48
+ return this;
49
+ }
50
+ }
51
+ export default new PersistedReducers();