@shopgate/pwa-common 7.30.0-alpha.9 → 7.30.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/App.js +28 -13
- package/actions/app/handleUniversalLink.js +0 -2
- package/collections/AuthRoutes.js +15 -13
- package/collections/Configuration.js +11 -10
- package/collections/EmbeddedMedia.js +21 -19
- package/collections/PersistedReducers.js +11 -9
- package/collections/Redirects.js +15 -13
- package/collections/media-providers/MediaProvider.js +23 -21
- package/collections/media-providers/Vimeo.js +28 -22
- package/collections/media-providers/YouTube.js +17 -10
- package/components/Backdrop/index.js +15 -13
- package/components/Backdrop/spec.js +3 -2
- package/components/Button/index.js +41 -29
- package/components/Button/spec.js +16 -10
- package/components/Checkbox/index.js +36 -28
- package/components/Checkbox/spec.js +40 -27
- package/components/Consume/index.js +4 -1
- package/components/CountdownTimer/index.js +27 -20
- package/components/CountdownTimer/spec.js +2 -1
- package/components/Drawer/index.js +31 -23
- package/components/Drawer/spec.js +7 -6
- package/components/Dropdown/index.js +27 -18
- package/components/Ellipsis/index.js +5 -3
- package/components/Ellipsis/spec.js +5 -3
- package/components/EmbeddedMedia/index.js +9 -6
- package/components/EmbeddedMedia/spec.js +11 -2
- package/components/ErrorBoundary/index.js +26 -16
- package/components/Grid/components/Item/index.js +13 -6
- package/components/Grid/components/Item/spec.js +4 -3
- package/components/Grid/index.js +13 -6
- package/components/Grid/spec.js +4 -3
- package/components/HtmlSanitizer/index.js +42 -45
- package/components/HtmlSanitizer/spec.js +16 -12
- package/components/I18n/components/FormatDate/index.js +11 -4
- package/components/I18n/components/FormatDate/spec.js +22 -14
- package/components/I18n/components/FormatNumber/index.js +8 -6
- package/components/I18n/components/FormatNumber/spec.js +10 -5
- package/components/I18n/components/FormatPrice/index.js +5 -3
- package/components/I18n/components/FormatPrice/spec.js +22 -14
- package/components/I18n/components/FormatTime/index.js +11 -4
- package/components/I18n/components/FormatTime/spec.js +22 -14
- package/components/I18n/components/I18nProvider/index.js +18 -11
- package/components/I18n/components/I18nProvider/spec.js +2 -1
- package/components/I18n/components/Placeholder/index.js +10 -3
- package/components/I18n/components/Placeholder/spec.js +12 -5
- package/components/I18n/components/Translate/index.js +12 -8
- package/components/I18n/components/Translate/spec.js +9 -6
- package/components/Icon/index.js +2 -1
- package/components/Image/Image.js +23 -21
- package/components/Image/ImageInner.js +2 -1
- package/components/InfiniteContainer/index.js +59 -53
- package/components/InfiniteContainer/spec.js +10 -5
- package/components/Input/components/MultiLineInput.js +33 -26
- package/components/Input/components/SimpleInput.js +70 -54
- package/components/Input/index.js +7 -17
- package/components/Input/spec.js +12 -11
- package/components/KeyboardConsumer/index.js +19 -13
- package/components/Link/index.js +28 -20
- package/components/Link/spec.js +13 -9
- package/components/List/components/Item/index.js +5 -3
- package/components/List/index.js +5 -3
- package/components/List/spec.js +6 -9
- package/components/Loading/index.js +1 -3
- package/components/Modal/index.js +13 -10
- package/components/ModalContainer/spec.js +24 -20
- package/components/Picker/components/Button/index.js +18 -12
- package/components/Picker/components/List/index.js +19 -16
- package/components/Picker/components/Modal/index.js +34 -25
- package/components/Picker/index.js +44 -33
- package/components/Picker/spec.js +4 -1
- package/components/Portal/index.js +26 -17
- package/components/ProductCharacteristics/index.js +65 -57
- package/components/RangeSlider/components/Handle/index.js +7 -5
- package/components/RangeSlider/index.js +98 -84
- package/components/Route/RouteNotFound.js +30 -19
- package/components/Route/index.js +31 -21
- package/components/Router/index.js +51 -34
- package/components/ScannerContainer/index.js +17 -10
- package/components/Select/components/Item/index.js +5 -3
- package/components/Select/index.js +59 -47
- package/components/Select/spec.js +7 -6
- package/components/SelectBox/components/Item/index.js +23 -13
- package/components/SelectBox/index.js +83 -80
- package/components/SelectBox/spec.js +8 -5
- package/components/SurroundPortals/index.js +15 -11
- package/components/Swiper/components/SwiperItem/index.js +6 -5
- package/components/Swiper/components/SwiperItem/spec.js +8 -4
- package/components/Swiper/index.js +23 -20
- package/components/Toaster/index.js +4 -1
- package/components/Transition/index.js +19 -12
- package/components/Widgets/components/Widget/index.js +27 -16
- package/components/Widgets/components/Widget/spec.js +5 -4
- package/components/Widgets/components/WidgetGrid/index.js +27 -19
- package/components/Widgets/components/WidgetGrid/spec.js +4 -3
- package/components/Widgets/index.js +33 -26
- package/components/Widgets/spec.js +12 -13
- package/helpers/data/index.js +1 -1
- package/helpers/portals/portalCollection.js +13 -10
- package/helpers/redux/mutable.js +2 -2
- package/package.json +5 -5
- package/providers/loading/index.js +71 -57
- package/providers/toast/index.js +39 -28
- package/reducers/modal/index.js +1 -1
- package/store/index.js +1 -1
- package/subscriptions/helpers/buildRegisterUrl.js +1 -0
- package/components/Input/components/DateInput.js +0 -273
package/App.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
2
|
import React, { Component } from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import { Provider } from 'react-redux';
|
|
@@ -15,11 +16,17 @@ import logout from "./actions/user/logout";
|
|
|
15
16
|
* the theme's Main.jsx file which uses this component as the root element.
|
|
16
17
|
* @returns {JSX}
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
let App = /*#__PURE__*/function (_Component) {
|
|
21
|
+
function App() {
|
|
22
|
+
return _Component.apply(this, arguments) || this;
|
|
23
|
+
}
|
|
24
|
+
_inheritsLoose(App, _Component);
|
|
25
|
+
var _proto = App.prototype;
|
|
19
26
|
/**
|
|
20
27
|
* Registers the component for the native events and fires the onload AppCommand.
|
|
21
28
|
*/
|
|
22
|
-
componentDidMount() {
|
|
29
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
23
30
|
/**
|
|
24
31
|
* Async helper function that performs optional steps before appDidStart action is dispatched
|
|
25
32
|
*/
|
|
@@ -42,15 +49,23 @@ class App extends Component {
|
|
|
42
49
|
/**
|
|
43
50
|
* Renders the component.
|
|
44
51
|
* @returns {JSX}
|
|
45
|
-
|
|
46
|
-
render() {
|
|
47
|
-
return /*#__PURE__*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
*/;
|
|
53
|
+
_proto.render = function render() {
|
|
54
|
+
return /*#__PURE__*/_jsx(CookiesProvider, {
|
|
55
|
+
children: /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
56
|
+
store: this.props.store,
|
|
57
|
+
isRoot: true,
|
|
58
|
+
children: /*#__PURE__*/_jsx(Provider, {
|
|
59
|
+
store: this.props.store,
|
|
60
|
+
children: /*#__PURE__*/_jsx(I18n.Provider, {
|
|
61
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
62
|
+
children: this.props.children
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
}, "error.root")
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
return App;
|
|
70
|
+
}(Component);
|
|
56
71
|
export default App;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { openUniversalLink } from "../../action-creators/app";
|
|
2
|
-
import handleLink from "./handleLink";
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Opens an universal link.
|
|
@@ -9,6 +8,5 @@ import handleLink from "./handleLink";
|
|
|
9
8
|
export default function handleUniversalLink(payload) {
|
|
10
9
|
return dispatch => {
|
|
11
10
|
dispatch(openUniversalLink(payload));
|
|
12
|
-
dispatch(handleLink(payload));
|
|
13
11
|
};
|
|
14
12
|
}
|
|
@@ -3,11 +3,11 @@ import pathMatch from 'path-match';
|
|
|
3
3
|
/**
|
|
4
4
|
* Class to maintain the routes that should be protected by authentication.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let AuthRoutes = /*#__PURE__*/function () {
|
|
7
7
|
/**
|
|
8
8
|
* Constructor
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
function AuthRoutes() {
|
|
11
11
|
this.routes = new Map();
|
|
12
12
|
this.matcher = pathMatch({
|
|
13
13
|
sensitive: false,
|
|
@@ -21,15 +21,16 @@ class AuthRoutes {
|
|
|
21
21
|
* @param {string} pattern The pattern to find.
|
|
22
22
|
* @return {string|null}
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
var _proto = AuthRoutes.prototype;
|
|
25
|
+
_proto.get = function get(pattern) {
|
|
25
26
|
return this.routes.get(pattern) || null;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Returns all protected routes.
|
|
30
31
|
* @return {Map}
|
|
31
|
-
|
|
32
|
-
getAll() {
|
|
32
|
+
*/;
|
|
33
|
+
_proto.getAll = function getAll() {
|
|
33
34
|
return this.routes;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -37,8 +38,8 @@ class AuthRoutes {
|
|
|
37
38
|
* Sets a new route as protected.
|
|
38
39
|
* @param {string} civilian The route to protect.
|
|
39
40
|
* @param {string} bouncer The protector route.
|
|
40
|
-
|
|
41
|
-
set(civilian, bouncer) {
|
|
41
|
+
*/;
|
|
42
|
+
_proto.set = function set(civilian, bouncer) {
|
|
42
43
|
if (!civilian || !bouncer) {
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
@@ -49,8 +50,8 @@ class AuthRoutes {
|
|
|
49
50
|
* Check if the given pathname is a protector route.
|
|
50
51
|
* @param {string} location The location to check.
|
|
51
52
|
* @return {boolean}
|
|
52
|
-
|
|
53
|
-
isProtector(location) {
|
|
53
|
+
*/;
|
|
54
|
+
_proto.isProtector = function isProtector(location) {
|
|
54
55
|
return Array.from(this.routes.values()).includes(location);
|
|
55
56
|
}
|
|
56
57
|
|
|
@@ -58,8 +59,8 @@ class AuthRoutes {
|
|
|
58
59
|
* Returns the protector for a passed location.
|
|
59
60
|
* @param {string} location The location to check.
|
|
60
61
|
* @return {string|null}
|
|
61
|
-
|
|
62
|
-
getProtector(location) {
|
|
62
|
+
*/;
|
|
63
|
+
_proto.getProtector = function getProtector(location) {
|
|
63
64
|
/**
|
|
64
65
|
* Try to make a direct match with the location.
|
|
65
66
|
* If we get lucky then we don't have to iterate over the protected patterns.
|
|
@@ -88,6 +89,7 @@ class AuthRoutes {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
return protector;
|
|
91
|
-
}
|
|
92
|
-
|
|
92
|
+
};
|
|
93
|
+
return AuthRoutes;
|
|
94
|
+
}();
|
|
93
95
|
export default new AuthRoutes();
|
|
@@ -3,11 +3,11 @@ import logGroup from '@shopgate/pwa-core/helpers/logGroup';
|
|
|
3
3
|
/**
|
|
4
4
|
* Class to maintain different configurations
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
let Configuration = /*#__PURE__*/function () {
|
|
7
7
|
/**
|
|
8
8
|
* Constructor
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
function Configuration() {
|
|
11
11
|
this.store = new Map();
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -17,7 +17,8 @@ class Configuration {
|
|
|
17
17
|
* @param {*} defaultValue defaultValue
|
|
18
18
|
* @returns {*|undefined}
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
var _proto = Configuration.prototype;
|
|
21
|
+
_proto.get = function get(key, defaultValue) {
|
|
21
22
|
return this.store.get(key) || defaultValue;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -26,8 +27,8 @@ class Configuration {
|
|
|
26
27
|
* @param {*} key key
|
|
27
28
|
* @param {*} value value
|
|
28
29
|
* @returns {Configuration}
|
|
29
|
-
|
|
30
|
-
set(key, value) {
|
|
30
|
+
*/;
|
|
31
|
+
_proto.set = function set(key, value) {
|
|
31
32
|
this.store.set(key, value);
|
|
32
33
|
return this;
|
|
33
34
|
}
|
|
@@ -37,8 +38,8 @@ class Configuration {
|
|
|
37
38
|
* @param {*} key key
|
|
38
39
|
* @param {Function} updater function to update value
|
|
39
40
|
* @returns {Configuration}
|
|
40
|
-
|
|
41
|
-
update(key, updater) {
|
|
41
|
+
*/;
|
|
42
|
+
_proto.update = function update(key, updater) {
|
|
42
43
|
if (!this.store.has(key)) {
|
|
43
44
|
logGroup('CONFIGURATION%c not found', {
|
|
44
45
|
key
|
|
@@ -61,8 +62,8 @@ class Configuration {
|
|
|
61
62
|
newValue
|
|
62
63
|
}, '#069215');
|
|
63
64
|
return this.set(key, newValue);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
};
|
|
66
|
+
return Configuration;
|
|
67
|
+
}();
|
|
67
68
|
/** @type {Configuration} */
|
|
68
69
|
export default new Configuration();
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Class to maintain embedded media within DOM containers.
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
let EmbeddedMedia = /*#__PURE__*/function () {
|
|
6
6
|
/**
|
|
7
7
|
* Constructor
|
|
8
8
|
*/
|
|
9
|
-
|
|
9
|
+
function EmbeddedMedia() {
|
|
10
10
|
this.providers = new Set();
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -14,23 +14,24 @@ class EmbeddedMedia {
|
|
|
14
14
|
* Add a provider for embedded media.
|
|
15
15
|
* @param {Object} provider A provider instance.
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
var _proto = EmbeddedMedia.prototype;
|
|
18
|
+
_proto.addProvider = function addProvider(provider) {
|
|
18
19
|
this.providers.add(provider);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Remove a provider for embedded media.
|
|
23
24
|
* @param {Object} provider A provider instance.
|
|
24
|
-
|
|
25
|
-
removeProvider(provider) {
|
|
25
|
+
*/;
|
|
26
|
+
_proto.removeProvider = function removeProvider(provider) {
|
|
26
27
|
this.providers.delete(provider);
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* Add a DOM container with embedded media.
|
|
31
32
|
* @param {ParentNode} container A DOM container.
|
|
32
|
-
|
|
33
|
-
add(container) {
|
|
33
|
+
*/;
|
|
34
|
+
_proto.add = function add(container) {
|
|
34
35
|
this.providers.forEach(provider => {
|
|
35
36
|
provider.add(container);
|
|
36
37
|
});
|
|
@@ -40,8 +41,8 @@ class EmbeddedMedia {
|
|
|
40
41
|
* Remove a DOM container. Should be called whenever a component which hosts a DOM container with
|
|
41
42
|
* embedded media is unmounted.
|
|
42
43
|
* @param {ParentNode} container A DOM container.
|
|
43
|
-
|
|
44
|
-
remove(container) {
|
|
44
|
+
*/;
|
|
45
|
+
_proto.remove = function remove(container) {
|
|
45
46
|
this.providers.forEach(provider => {
|
|
46
47
|
provider.remove(container);
|
|
47
48
|
});
|
|
@@ -57,8 +58,8 @@ class EmbeddedMedia {
|
|
|
57
58
|
* are accepted.
|
|
58
59
|
* @param {boolean} [cookieConsentSettings.statisticsCookiesAccepted] Whether statistics cookies
|
|
59
60
|
* are accepted.
|
|
60
|
-
|
|
61
|
-
handleCookieConsent(container, cookieConsentSettings = {}) {
|
|
61
|
+
*/;
|
|
62
|
+
_proto.handleCookieConsent = function handleCookieConsent(container, cookieConsentSettings = {}) {
|
|
62
63
|
const cookieConsent = {
|
|
63
64
|
comfortCookiesAccepted: false,
|
|
64
65
|
statisticsCookiesAccepted: false,
|
|
@@ -77,8 +78,8 @@ class EmbeddedMedia {
|
|
|
77
78
|
* sandbox attributes to improve security and layout behavior.
|
|
78
79
|
*
|
|
79
80
|
* @param {Document} document - The DOM document containing iframes to optimize.
|
|
80
|
-
|
|
81
|
-
applyIframeOptimizations(document) {
|
|
81
|
+
*/;
|
|
82
|
+
_proto.applyIframeOptimizations = function applyIframeOptimizations(document) {
|
|
82
83
|
this.providers.forEach(provider => {
|
|
83
84
|
provider.applyIframeOptimizations(document);
|
|
84
85
|
});
|
|
@@ -86,8 +87,8 @@ class EmbeddedMedia {
|
|
|
86
87
|
|
|
87
88
|
/**
|
|
88
89
|
* Stops all playing media within the DOM containers.
|
|
89
|
-
|
|
90
|
-
stop() {
|
|
90
|
+
*/;
|
|
91
|
+
_proto.stop = function stop() {
|
|
91
92
|
this.providers.forEach(provider => {
|
|
92
93
|
provider.stop();
|
|
93
94
|
});
|
|
@@ -96,8 +97,8 @@ class EmbeddedMedia {
|
|
|
96
97
|
/**
|
|
97
98
|
* Check if we have media providers with not-ready SDK
|
|
98
99
|
* @returns {boolean}
|
|
99
|
-
|
|
100
|
-
getHasPendingProviders() {
|
|
100
|
+
*/;
|
|
101
|
+
_proto.getHasPendingProviders = function getHasPendingProviders() {
|
|
101
102
|
let hasPendingProviders = false;
|
|
102
103
|
this.providers.forEach(provider => {
|
|
103
104
|
if (provider.isPending) {
|
|
@@ -105,8 +106,9 @@ class EmbeddedMedia {
|
|
|
105
106
|
}
|
|
106
107
|
});
|
|
107
108
|
return hasPendingProviders;
|
|
108
|
-
}
|
|
109
|
-
|
|
109
|
+
};
|
|
110
|
+
return EmbeddedMedia;
|
|
111
|
+
}();
|
|
110
112
|
export default new EmbeddedMedia();
|
|
111
113
|
|
|
112
114
|
/* eslint-enable extra-rules/potential-point-free */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class to maintain the persisted redux reducers.
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
let PersistedReducers = /*#__PURE__*/function () {
|
|
5
5
|
/**
|
|
6
6
|
* Constructor.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
function PersistedReducers() {
|
|
9
9
|
this.reducers = [];
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -13,7 +13,8 @@ class PersistedReducers {
|
|
|
13
13
|
* Returns all reducers.
|
|
14
14
|
* @return {Array}
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
var _proto = PersistedReducers.prototype;
|
|
17
|
+
_proto.getAll = function getAll() {
|
|
17
18
|
return this.reducers;
|
|
18
19
|
}
|
|
19
20
|
|
|
@@ -21,8 +22,8 @@ class PersistedReducers {
|
|
|
21
22
|
* Sets a new reducers to be persisted.
|
|
22
23
|
* @param {string|Array} reducer The name of the reducer to persist.
|
|
23
24
|
* @return {PersistedReducers}
|
|
24
|
-
|
|
25
|
-
set(reducer) {
|
|
25
|
+
*/;
|
|
26
|
+
_proto.set = function set(reducer) {
|
|
26
27
|
if (Array.isArray(reducer)) {
|
|
27
28
|
reducer.forEach(red => {
|
|
28
29
|
if (!this.reducers.includes(red)) {
|
|
@@ -42,10 +43,11 @@ class PersistedReducers {
|
|
|
42
43
|
* Removes a reducer from the list of persisted reducers.
|
|
43
44
|
* @param {string} reducer The name of the reducer to remove.
|
|
44
45
|
* @return {PersistedReducers}
|
|
45
|
-
|
|
46
|
-
remove(reducer) {
|
|
46
|
+
*/;
|
|
47
|
+
_proto.remove = function remove(reducer) {
|
|
47
48
|
this.reducers = this.reducers.filter(red => red !== reducer);
|
|
48
49
|
return this;
|
|
49
|
-
}
|
|
50
|
-
|
|
50
|
+
};
|
|
51
|
+
return PersistedReducers;
|
|
52
|
+
}();
|
|
51
53
|
export default new PersistedReducers();
|
package/collections/Redirects.js
CHANGED
|
@@ -4,11 +4,11 @@ import queryString from 'query-string';
|
|
|
4
4
|
/**
|
|
5
5
|
* The Redirects class.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
let Redirects = /*#__PURE__*/function () {
|
|
8
8
|
/**
|
|
9
9
|
* The constructor.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
function Redirects() {
|
|
12
12
|
this.redirects = new Map();
|
|
13
13
|
this.matcher = pathMatch({
|
|
14
14
|
sensitive: false,
|
|
@@ -23,7 +23,8 @@ class Redirects {
|
|
|
23
23
|
* @private
|
|
24
24
|
* @returns {string|Function|Promise|null}
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
var _proto = Redirects.prototype;
|
|
27
|
+
_proto.get = function get(pathname) {
|
|
27
28
|
return this.redirects.get(pathname) || null;
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -31,8 +32,8 @@ class Redirects {
|
|
|
31
32
|
* Returns the redirect for a passed pathname.
|
|
32
33
|
* @param {string} pathname The pathname to check.
|
|
33
34
|
* @return {string|Function|Promise|null}
|
|
34
|
-
|
|
35
|
-
getRedirect(pathname) {
|
|
35
|
+
*/;
|
|
36
|
+
_proto.getRedirect = function getRedirect(pathname) {
|
|
36
37
|
/**
|
|
37
38
|
* Try to make a direct match with the pathname.
|
|
38
39
|
* If we get lucky then we don't have to iterate over the protected patterns.
|
|
@@ -73,8 +74,8 @@ class Redirects {
|
|
|
73
74
|
*
|
|
74
75
|
* @param {string} pathname The pathname to check.
|
|
75
76
|
* @returns {RedirectExtendedData}
|
|
76
|
-
|
|
77
|
-
getRedirectExtended(pathname) {
|
|
77
|
+
*/;
|
|
78
|
+
_proto.getRedirectExtended = function getRedirectExtended(pathname) {
|
|
78
79
|
const {
|
|
79
80
|
url,
|
|
80
81
|
query
|
|
@@ -106,8 +107,8 @@ class Redirects {
|
|
|
106
107
|
* @param {string} from The link to redirect from. Route patterns are also supported.
|
|
107
108
|
* @param {string|Function|Promise} to redirect / handle to create a dynamic link.
|
|
108
109
|
* @param {boolean} force Whether or not to forcefully set the redirect.
|
|
109
|
-
|
|
110
|
-
set(from = null, to = null, force = false) {
|
|
110
|
+
*/;
|
|
111
|
+
_proto.set = function set(from = null, to = null, force = false) {
|
|
111
112
|
if (!from || !to) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
@@ -122,11 +123,12 @@ class Redirects {
|
|
|
122
123
|
/**
|
|
123
124
|
* Removes a specified element from the internal "redirects" Map object.
|
|
124
125
|
* @param {string} pathname The pathname to remove.
|
|
125
|
-
|
|
126
|
-
unset(pathname) {
|
|
126
|
+
*/;
|
|
127
|
+
_proto.unset = function unset(pathname) {
|
|
127
128
|
this.redirects.delete(pathname);
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
/* eslint-enable extra-rules/potential-point-free
|
|
131
|
-
|
|
131
|
+
/* eslint-enable extra-rules/potential-point-free */;
|
|
132
|
+
return Redirects;
|
|
133
|
+
}();
|
|
132
134
|
export default new Redirects();
|
|
@@ -24,13 +24,13 @@ const consentMessageIcon = `
|
|
|
24
24
|
/**
|
|
25
25
|
* The MediaProvider base class.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
let MediaProvider = /*#__PURE__*/function () {
|
|
28
28
|
/**
|
|
29
29
|
* Constructor.
|
|
30
30
|
* @param {Object} options The provider options.
|
|
31
31
|
* @param {boolean} [options.responsify=true] Whether to responsify the video containers.
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
function MediaProvider(options) {
|
|
34
34
|
this.containers = new Map();
|
|
35
35
|
this.isPending = false;
|
|
36
36
|
this.remoteScriptUrl = null;
|
|
@@ -44,7 +44,8 @@ class MediaProvider {
|
|
|
44
44
|
* @callback
|
|
45
45
|
* @abstract
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
var _proto = MediaProvider.prototype;
|
|
48
|
+
_proto.onScriptLoaded = function onScriptLoaded() {
|
|
48
49
|
logger.error('MediaProvider.onScriptLoaded() needs to be implemented within an inheriting class');
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -52,8 +53,8 @@ class MediaProvider {
|
|
|
52
53
|
* Callback to retrieve a list of media containers
|
|
53
54
|
* @callback
|
|
54
55
|
* @abstract
|
|
55
|
-
|
|
56
|
-
getMediaContainers() {
|
|
56
|
+
*/;
|
|
57
|
+
_proto.getMediaContainers = function getMediaContainers() {
|
|
57
58
|
logger.error('MediaProvider.getMediaContainers() needs to be implemented within an inheriting class');
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -64,8 +65,8 @@ class MediaProvider {
|
|
|
64
65
|
*
|
|
65
66
|
* @param {Document} document - The DOM document containing iframes to optimize.
|
|
66
67
|
* @returns {MediaProvider}
|
|
67
|
-
|
|
68
|
-
applyIframeOptimizations() {
|
|
68
|
+
*/;
|
|
69
|
+
_proto.applyIframeOptimizations = function applyIframeOptimizations() {
|
|
69
70
|
return this;
|
|
70
71
|
}
|
|
71
72
|
|
|
@@ -73,8 +74,8 @@ class MediaProvider {
|
|
|
73
74
|
* Optimizes video container to make it responsive.
|
|
74
75
|
* @param {Element} container A DOM container.
|
|
75
76
|
* @returns {MediaProvider}
|
|
76
|
-
|
|
77
|
-
responsify(container) {
|
|
77
|
+
*/;
|
|
78
|
+
_proto.responsify = function responsify(container) {
|
|
78
79
|
// Do not proceed when video responsify is disabled.
|
|
79
80
|
if (!this.options.responsify) return this;
|
|
80
81
|
|
|
@@ -109,8 +110,8 @@ class MediaProvider {
|
|
|
109
110
|
* @param {boolean} [cookieConsentSettings.statisticsCookiesAccepted] Whether statistics cookies
|
|
110
111
|
* are accepted.
|
|
111
112
|
* @returns {MediaProvider}
|
|
112
|
-
|
|
113
|
-
handleCookieConsent(container, cookieConsentSettings = {}) {
|
|
113
|
+
*/;
|
|
114
|
+
_proto.handleCookieConsent = function handleCookieConsent(container, cookieConsentSettings = {}) {
|
|
114
115
|
const iframes = this.getMediaContainers(container);
|
|
115
116
|
if (!iframes.length || cookieConsentSettings.comfortCookiesAccepted !== false) {
|
|
116
117
|
return this;
|
|
@@ -131,8 +132,8 @@ class MediaProvider {
|
|
|
131
132
|
* Injects a cookie consent message element into a container
|
|
132
133
|
* @param {Element} container A DOM container.
|
|
133
134
|
* @returns {MediaProvider}
|
|
134
|
-
|
|
135
|
-
injectCookieConsentMessage(container) {
|
|
135
|
+
*/;
|
|
136
|
+
_proto.injectCookieConsentMessage = function injectCookieConsentMessage(container) {
|
|
136
137
|
// Create the wrapper for the message element
|
|
137
138
|
const messageWrapper = document.createElement('div');
|
|
138
139
|
messageWrapper.classList.add(styles.consentContainer, 'common__media-provider_cookie-consent-message-container');
|
|
@@ -162,8 +163,8 @@ class MediaProvider {
|
|
|
162
163
|
* Add a DOM container with embedded videos.
|
|
163
164
|
* @param {NodeList} container A DOM container.
|
|
164
165
|
* @returns {MediaProvider}
|
|
165
|
-
|
|
166
|
-
add() {
|
|
166
|
+
*/;
|
|
167
|
+
_proto.add = function add() {
|
|
167
168
|
logger.error('MediaProvider.add() needs to be implemented within an inheriting class');
|
|
168
169
|
return this;
|
|
169
170
|
}
|
|
@@ -172,8 +173,8 @@ class MediaProvider {
|
|
|
172
173
|
* Remove a DOM container.
|
|
173
174
|
* @param {NodeList} container A DOM container.
|
|
174
175
|
* @returns {MediaProvider}
|
|
175
|
-
|
|
176
|
-
remove(container) {
|
|
176
|
+
*/;
|
|
177
|
+
_proto.remove = function remove(container) {
|
|
177
178
|
this.containers.delete(container);
|
|
178
179
|
return this;
|
|
179
180
|
}
|
|
@@ -181,12 +182,13 @@ class MediaProvider {
|
|
|
181
182
|
/**
|
|
182
183
|
* Stops all playing videos within the DOM containers.
|
|
183
184
|
* @returns {MediaProvider}
|
|
184
|
-
|
|
185
|
-
stop() {
|
|
185
|
+
*/;
|
|
186
|
+
_proto.stop = function stop() {
|
|
186
187
|
logger.error('MediaProvider.stop() needs to be implemented within an inheriting class');
|
|
187
188
|
return this;
|
|
188
|
-
}
|
|
189
|
-
|
|
189
|
+
};
|
|
190
|
+
return MediaProvider;
|
|
191
|
+
}();
|
|
190
192
|
export default MediaProvider;
|
|
191
193
|
|
|
192
194
|
/* eslint-enable class-methods-use-this */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
1
2
|
import MediaProvider from "./MediaProvider";
|
|
2
3
|
|
|
3
4
|
/* eslint-disable class-methods-use-this */
|
|
@@ -6,18 +7,20 @@ const scriptUrl = 'https://player.vimeo.com/api/player.js';
|
|
|
6
7
|
/**
|
|
7
8
|
* The Vimeo media provider class.
|
|
8
9
|
*/
|
|
9
|
-
|
|
10
|
+
let VimeoMediaProvider = /*#__PURE__*/function (_MediaProvider) {
|
|
10
11
|
/**
|
|
11
12
|
* Constructor.
|
|
12
13
|
* @param {Object} options The provider options.
|
|
13
14
|
* @param {boolean} [options.responsify=true] Whether to responsify the video containers.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
function VimeoMediaProvider(options) {
|
|
17
|
+
var _this;
|
|
18
|
+
_this = _MediaProvider.call(this, options) || this;
|
|
17
19
|
// Need to check Vimeo.Player presence later
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
_this.isPending = true;
|
|
21
|
+
_this.remoteScriptUrl = scriptUrl;
|
|
22
|
+
_this.deferred = [];
|
|
23
|
+
return _this;
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/**
|
|
@@ -25,14 +28,16 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
25
28
|
* @param {ParentNode} container A DOM container that may contain Vimeo iframes.
|
|
26
29
|
* @returns {NodeListOf<Element>}
|
|
27
30
|
*/
|
|
28
|
-
|
|
31
|
+
_inheritsLoose(VimeoMediaProvider, _MediaProvider);
|
|
32
|
+
var _proto = VimeoMediaProvider.prototype;
|
|
33
|
+
_proto.getMediaContainers = function getMediaContainers(container) {
|
|
29
34
|
return container.querySelectorAll('iframe[src*="vimeo.com"]');
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
/**
|
|
33
38
|
* @inheritDoc
|
|
34
|
-
|
|
35
|
-
onScriptLoaded() {
|
|
39
|
+
*/;
|
|
40
|
+
_proto.onScriptLoaded = function onScriptLoaded() {
|
|
36
41
|
this.isPending = false;
|
|
37
42
|
if (this.deferred.length) {
|
|
38
43
|
this.deferred.forEach(container => {
|
|
@@ -45,8 +50,8 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
45
50
|
/**
|
|
46
51
|
* Check if the Provider script to be loaded externally is finished loading
|
|
47
52
|
* @returns {boolean}
|
|
48
|
-
|
|
49
|
-
checkScriptLoadingStatus() {
|
|
53
|
+
*/;
|
|
54
|
+
_proto.checkScriptLoadingStatus = function checkScriptLoadingStatus() {
|
|
50
55
|
if (this.isPending && typeof window.Vimeo !== 'undefined') {
|
|
51
56
|
this.isPending = false;
|
|
52
57
|
}
|
|
@@ -58,8 +63,8 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
58
63
|
* @override
|
|
59
64
|
* @param {ParentNode} container A DOM container.
|
|
60
65
|
* @returns {VimeoMediaProvider}
|
|
61
|
-
|
|
62
|
-
add(container) {
|
|
66
|
+
*/;
|
|
67
|
+
_proto.add = function add(container) {
|
|
63
68
|
if (!this.checkScriptLoadingStatus()) {
|
|
64
69
|
this.deferred.push(container);
|
|
65
70
|
return this;
|
|
@@ -83,8 +88,8 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
83
88
|
*
|
|
84
89
|
* @param {Document} document - The DOM document containing iframes to optimize.
|
|
85
90
|
* @returns {YouTubeMediaProvider}
|
|
86
|
-
|
|
87
|
-
applyIframeOptimizations(document) {
|
|
91
|
+
*/;
|
|
92
|
+
_proto.applyIframeOptimizations = function applyIframeOptimizations(document) {
|
|
88
93
|
const iframes = this.getMediaContainers(document);
|
|
89
94
|
if (!iframes.length) {
|
|
90
95
|
return this;
|
|
@@ -101,8 +106,8 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
101
106
|
* Stops all playing videos within the DOM containers.
|
|
102
107
|
* @override
|
|
103
108
|
* @returns {VimeoMediaProvider}
|
|
104
|
-
|
|
105
|
-
stop() {
|
|
109
|
+
*/;
|
|
110
|
+
_proto.stop = function stop() {
|
|
106
111
|
// Select all iframes in the document. Actually this should be done via the iframes
|
|
107
112
|
// registered in this.containers, but that doesn't seem to work reliably anymore.
|
|
108
113
|
// Since we had to find a quick fix for CURB-5033 we now select all iframes in the document
|
|
@@ -134,15 +139,16 @@ class VimeoMediaProvider extends MediaProvider {
|
|
|
134
139
|
* are accepted.
|
|
135
140
|
* @override
|
|
136
141
|
* @returns {VimeoMediaProvider}
|
|
137
|
-
|
|
138
|
-
handleCookieConsent(container, cookieConsentSettings) {
|
|
142
|
+
*/;
|
|
143
|
+
_proto.handleCookieConsent = function handleCookieConsent(container, cookieConsentSettings) {
|
|
139
144
|
// Remove Vimeo player scripts since the VimeoMediaProvider has custom logic for it
|
|
140
145
|
container.querySelectorAll('script[src*="vimeo.com"]').forEach(entry => {
|
|
141
146
|
entry.remove();
|
|
142
147
|
});
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
|
|
148
|
+
return _MediaProvider.prototype.handleCookieConsent.call(this, container, cookieConsentSettings);
|
|
149
|
+
};
|
|
150
|
+
return VimeoMediaProvider;
|
|
151
|
+
}(MediaProvider);
|
|
146
152
|
export default VimeoMediaProvider;
|
|
147
153
|
|
|
148
154
|
/* eslint-enable class-methods-use-this */
|