@quintype/components 3.8.8-only-react-v19.4 → 3.8.9-razorpay-log.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2124 -1156
- package/dist/es/components/access-type.js +823 -574
- package/dist/es/components/adbutler-ad.js +14 -10
- package/dist/es/components/api-client.js +6 -4
- package/dist/es/components/breaking-news-item.js +3 -2
- package/dist/es/components/breaking-news.js +23 -7
- package/dist/es/components/client-side-only.js +19 -6
- package/dist/es/components/collection.js +5 -5
- package/dist/es/components/dfp-ad.js +30 -23
- package/dist/es/components/eager-load-images.js +29 -21
- package/dist/es/components/hamburger-button.js +5 -2
- package/dist/es/components/image-gallery.js +13 -10
- package/dist/es/components/impl/collection-impl.js +10 -3
- package/dist/es/components/impl/gumlet-image.js +19 -10
- package/dist/es/components/impl/image-utils.js +4 -3
- package/dist/es/components/impl/load-more-stories-manager.js +19 -6
- package/dist/es/components/impl/thumbor-image.js +97 -52
- package/dist/es/components/infinite-scroll.js +85 -29
- package/dist/es/components/infinite-story-base.js +24 -7
- package/dist/es/components/lazy-collection.js +8 -8
- package/dist/es/components/lazy-load-images.js +58 -24
- package/dist/es/components/link-base.js +19 -11
- package/dist/es/components/link.js +4 -1
- package/dist/es/components/load-more-collection-stories.js +18 -7
- package/dist/es/components/load-more-stories-base.js +20 -6
- package/dist/es/components/loading-indicator.js +5 -1
- package/dist/es/components/menu-item.js +10 -6
- package/dist/es/components/menu.js +9 -6
- package/dist/es/components/responsive-hero-image.js +3 -1
- package/dist/es/components/responsive-image.js +5 -0
- package/dist/es/components/responsive-source.js +1 -1
- package/dist/es/components/review-rating/review-rating.js +27 -21
- package/dist/es/components/review-rating/star-icon.js +5 -3
- package/dist/es/components/search-box.js +23 -7
- package/dist/es/components/search-page-base.js +18 -7
- package/dist/es/components/social-logins/with-facebook-login.js +20 -10
- package/dist/es/components/social-logins/with-google-login.js +18 -8
- package/dist/es/components/social-logins/with-linkedin-login.js +12 -7
- package/dist/es/components/social-logins/with-social-login.js +21 -7
- package/dist/es/components/social-logins/with-twitter-login.js +7 -7
- package/dist/es/components/social-share.js +24 -8
- package/dist/es/components/story-element.js +88 -43
- package/dist/es/components/story-elements/brightcove.js +94 -54
- package/dist/es/components/story-elements/dailymotion-embed-script.js +39 -13
- package/dist/es/components/story-elements/dailymotion.js +61 -19
- package/dist/es/components/story-elements/jsembed.js +30 -10
- package/dist/es/components/story-elements/jwPlayer.js +24 -9
- package/dist/es/components/story-elements/polltype.js +20 -6
- package/dist/es/components/story-elements/table.js +34 -16
- package/dist/es/components/story-elements/youtube.js +73 -24
- package/dist/es/components/update-on-interval.js +52 -31
- package/dist/es/components/with-client-side-only.js +4 -3
- package/dist/es/components/with-error.js +20 -7
- package/dist/es/components/with-host-url.js +9 -4
- package/dist/es/components/with-lazy.js +21 -7
- package/dist/es/components/with-member.js +33 -14
- package/dist/es/components/with-preview.js +20 -7
- package/dist/es/components/wrap-collection-layout.js +16 -4
- package/dist/es/store/reducers.js +45 -1
- package/dist/es/utils.js +12 -7
- package/package.json +7 -16
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { bool, element, number, string } from "prop-types";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { StarIcon } from "./star-icon";
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* This component takes in the value for rating and renders star for the value passed in. This comopent is generally used for story review type.
|
|
7
6
|
*
|
|
@@ -15,29 +14,31 @@ import { StarIcon } from "./star-icon";
|
|
|
15
14
|
* @component
|
|
16
15
|
* @category Story Page
|
|
17
16
|
*/
|
|
17
|
+
|
|
18
18
|
export function ReviewRating(_ref) {
|
|
19
19
|
var value = _ref.value,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
20
|
+
_ref$canShowEmptyRati = _ref.canShowEmptyRating,
|
|
21
|
+
canShowEmptyRating = _ref$canShowEmptyRati === void 0 ? false : _ref$canShowEmptyRati,
|
|
22
|
+
_ref$size = _ref.size,
|
|
23
|
+
size = _ref$size === void 0 ? 20 : _ref$size,
|
|
24
|
+
_ref$activeColor = _ref.activeColor,
|
|
25
|
+
activeColor = _ref$activeColor === void 0 ? "gold" : _ref$activeColor,
|
|
26
|
+
_ref$inActiveColor = _ref.inActiveColor,
|
|
27
|
+
inActiveColor = _ref$inActiveColor === void 0 ? "gray" : _ref$inActiveColor,
|
|
28
|
+
_ref$count = _ref.count,
|
|
29
|
+
count = _ref$count === void 0 ? 5 : _ref$count,
|
|
30
|
+
_ref$showHalfStar = _ref.showHalfStar,
|
|
31
|
+
showHalfStar = _ref$showHalfStar === void 0 ? true : _ref$showHalfStar,
|
|
32
|
+
_ref$className = _ref.className,
|
|
33
|
+
className = _ref$className === void 0 ? "review-rating" : _ref$className,
|
|
34
|
+
_ref$activeSymbol = _ref.activeSymbol,
|
|
35
|
+
activeSymbol = _ref$activeSymbol === void 0 ? null : _ref$activeSymbol,
|
|
36
|
+
_ref$inActiveSymbol = _ref.inActiveSymbol,
|
|
37
|
+
inActiveSymbol = _ref$inActiveSymbol === void 0 ? null : _ref$inActiveSymbol,
|
|
38
|
+
_ref$halfActiveSymbol = _ref.halfActiveSymbol,
|
|
39
|
+
halfActiveSymbol = _ref$halfActiveSymbol === void 0 ? null : _ref$halfActiveSymbol;
|
|
40
40
|
if (!canShowEmptyRating && value < 0.1) return null;
|
|
41
|
+
|
|
41
42
|
var activeComponent = function activeComponent(index) {
|
|
42
43
|
return activeSymbol ? /*#__PURE__*/React.cloneElement(activeSymbol, {
|
|
43
44
|
size: size,
|
|
@@ -54,6 +55,7 @@ export function ReviewRating(_ref) {
|
|
|
54
55
|
"data-test-id": "star-icon"
|
|
55
56
|
});
|
|
56
57
|
};
|
|
58
|
+
|
|
57
59
|
var inActiveComponent = function inActiveComponent(index) {
|
|
58
60
|
return inActiveSymbol ? /*#__PURE__*/React.cloneElement(inActiveSymbol, {
|
|
59
61
|
size: size,
|
|
@@ -69,6 +71,7 @@ export function ReviewRating(_ref) {
|
|
|
69
71
|
key: "review-".concat(index)
|
|
70
72
|
});
|
|
71
73
|
};
|
|
74
|
+
|
|
72
75
|
var halfActiveComponent = function halfActiveComponent(index) {
|
|
73
76
|
return halfActiveSymbol ? /*#__PURE__*/React.cloneElement(halfActiveSymbol, {
|
|
74
77
|
size: size,
|
|
@@ -84,7 +87,9 @@ export function ReviewRating(_ref) {
|
|
|
84
87
|
key: "review-".concat(index)
|
|
85
88
|
});
|
|
86
89
|
};
|
|
90
|
+
|
|
87
91
|
var children = [];
|
|
92
|
+
|
|
88
93
|
for (var i = 1; i <= count; i++) {
|
|
89
94
|
if (i <= Math.floor(value)) {
|
|
90
95
|
children.push(activeComponent(i));
|
|
@@ -94,6 +99,7 @@ export function ReviewRating(_ref) {
|
|
|
94
99
|
children.push(inActiveComponent(i));
|
|
95
100
|
}
|
|
96
101
|
}
|
|
102
|
+
|
|
97
103
|
return /*#__PURE__*/React.createElement("div", {
|
|
98
104
|
className: className
|
|
99
105
|
}, children);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
|
|
2
3
|
var StarIcon = function StarIcon(_ref) {
|
|
3
4
|
var size = _ref.size,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
foregroundColor = _ref.foregroundColor,
|
|
6
|
+
backgroundColor = _ref.backgroundColor,
|
|
7
|
+
className = _ref.className;
|
|
7
8
|
return /*#__PURE__*/React.createElement("svg", {
|
|
8
9
|
className: className,
|
|
9
10
|
width: size,
|
|
@@ -21,4 +22,5 @@ var StarIcon = function StarIcon(_ref) {
|
|
|
21
22
|
fill: foregroundColor
|
|
22
23
|
})));
|
|
23
24
|
};
|
|
25
|
+
|
|
24
26
|
export { StarIcon };
|
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
8
11
|
import { any, element, func, string } from 'prop-types';
|
|
9
12
|
import React from 'react';
|
|
10
13
|
import { connect } from "react-redux";
|
|
14
|
+
|
|
11
15
|
var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
16
|
+
_inherits(SearchBoxBase, _React$Component);
|
|
17
|
+
|
|
18
|
+
var _super = /*#__PURE__*/_createSuper(SearchBoxBase);
|
|
19
|
+
|
|
12
20
|
function SearchBoxBase(props) {
|
|
13
21
|
var _this;
|
|
22
|
+
|
|
14
23
|
_classCallCheck(this, SearchBoxBase);
|
|
15
|
-
|
|
24
|
+
|
|
25
|
+
_this = _super.call(this, props);
|
|
16
26
|
_this.state = {
|
|
17
27
|
query: _this.props.initValue || ""
|
|
18
28
|
};
|
|
19
29
|
return _this;
|
|
20
30
|
}
|
|
21
|
-
|
|
22
|
-
|
|
31
|
+
|
|
32
|
+
_createClass(SearchBoxBase, [{
|
|
23
33
|
key: "componentDidMount",
|
|
24
34
|
value: function componentDidMount() {
|
|
25
35
|
this.focus();
|
|
@@ -45,6 +55,7 @@ var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
|
45
55
|
key: "render",
|
|
46
56
|
value: function render() {
|
|
47
57
|
var _this2 = this;
|
|
58
|
+
|
|
48
59
|
var Render = this.props.template || this.defaultTemplate;
|
|
49
60
|
return /*#__PURE__*/React.createElement("form", {
|
|
50
61
|
role: "search",
|
|
@@ -81,10 +92,14 @@ var SearchBoxBase = /*#__PURE__*/function (_React$Component) {
|
|
|
81
92
|
return children;
|
|
82
93
|
}
|
|
83
94
|
}]);
|
|
95
|
+
|
|
96
|
+
return SearchBoxBase;
|
|
84
97
|
}(React.Component);
|
|
98
|
+
|
|
85
99
|
var mapStateToProps = function mapStateToProps(state) {
|
|
86
100
|
return {};
|
|
87
101
|
};
|
|
102
|
+
|
|
88
103
|
var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
89
104
|
return {
|
|
90
105
|
navigateTo: function navigateTo(url) {
|
|
@@ -92,7 +107,6 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
92
107
|
}
|
|
93
108
|
};
|
|
94
109
|
};
|
|
95
|
-
|
|
96
110
|
/**
|
|
97
111
|
* This component provides a form with a search text box. On submit, the user is redirected to the search page via AJAX.
|
|
98
112
|
*
|
|
@@ -107,4 +121,6 @@ var mapDispatchToProps = function mapDispatchToProps(dispatch) {
|
|
|
107
121
|
* @component
|
|
108
122
|
* @category Header
|
|
109
123
|
*/
|
|
124
|
+
|
|
125
|
+
|
|
110
126
|
export var SearchBox = /*#__PURE__*/connect(mapStateToProps, mapDispatchToProps)(SearchBoxBase);
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
8
11
|
import React from 'react';
|
|
9
12
|
import get from "lodash/get";
|
|
10
13
|
import { getRequest } from './api-client';
|
|
11
14
|
import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
12
|
-
|
|
13
15
|
/**
|
|
14
16
|
* This component is to handle search functionality and also handles load more.
|
|
15
17
|
*
|
|
@@ -29,13 +31,19 @@ import { LoadMoreStoriesManager } from './impl/load-more-stories-manager';
|
|
|
29
31
|
* @deprecated
|
|
30
32
|
* @category Other
|
|
31
33
|
*/
|
|
34
|
+
|
|
32
35
|
export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
36
|
+
_inherits(SearchPageBase, _React$Component);
|
|
37
|
+
|
|
38
|
+
var _super = /*#__PURE__*/_createSuper(SearchPageBase);
|
|
39
|
+
|
|
33
40
|
function SearchPageBase() {
|
|
34
41
|
_classCallCheck(this, SearchPageBase);
|
|
35
|
-
|
|
42
|
+
|
|
43
|
+
return _super.apply(this, arguments);
|
|
36
44
|
}
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
|
|
46
|
+
_createClass(SearchPageBase, [{
|
|
39
47
|
key: "search",
|
|
40
48
|
value: function search(pageNumber) {
|
|
41
49
|
return getRequest("/api/v1/search", Object.assign(this.props.params, {
|
|
@@ -49,6 +57,7 @@ export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
|
49
57
|
key: "render",
|
|
50
58
|
value: function render() {
|
|
51
59
|
var _this = this;
|
|
60
|
+
|
|
52
61
|
return /*#__PURE__*/React.createElement(LoadMoreStoriesManager, Object.assign({}, this.props.data, {
|
|
53
62
|
template: this.props.template,
|
|
54
63
|
loadStories: function loadStories(pageNumber) {
|
|
@@ -57,4 +66,6 @@ export var SearchPageBase = /*#__PURE__*/function (_React$Component) {
|
|
|
57
66
|
}));
|
|
58
67
|
}
|
|
59
68
|
}]);
|
|
69
|
+
|
|
70
|
+
return SearchPageBase;
|
|
60
71
|
}(React.Component);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithSocialLogin } from './with-social-login';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @see {@link WithSocialLogin}
|
|
6
5
|
* @component
|
|
7
6
|
* @category Login
|
|
8
7
|
*/
|
|
8
|
+
|
|
9
9
|
export function WithFacebookLogin(_ref) {
|
|
10
10
|
var appId = _ref.appId,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
scope = _ref.scope,
|
|
13
|
+
emailMandatory = _ref.emailMandatory,
|
|
14
|
+
redirectUrl = _ref.redirectUrl,
|
|
15
|
+
sso = _ref.sso,
|
|
16
|
+
isBridgekeeperLogin = _ref.isBridgekeeperLogin;
|
|
17
17
|
return /*#__PURE__*/React.createElement(WithSocialLogin, {
|
|
18
18
|
provider: 'facebook',
|
|
19
19
|
initialize: function initialize() {
|
|
@@ -31,10 +31,12 @@ export function WithFacebookLogin(_ref) {
|
|
|
31
31
|
isBridgekeeperLogin: isBridgekeeperLogin
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
|
|
34
35
|
function loadFacebookSDK(appId) {
|
|
35
36
|
if (global.FB) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
39
|
+
|
|
38
40
|
global.fbAsyncInit = global.fbAsyncInit || function () {
|
|
39
41
|
global.FB.init({
|
|
40
42
|
appId: appId,
|
|
@@ -42,18 +44,22 @@ function loadFacebookSDK(appId) {
|
|
|
42
44
|
version: 'v3.1'
|
|
43
45
|
});
|
|
44
46
|
};
|
|
47
|
+
|
|
45
48
|
(function (d, s, id) {
|
|
46
49
|
var js,
|
|
47
|
-
|
|
50
|
+
fjs = d.getElementsByTagName(s)[0];
|
|
51
|
+
|
|
48
52
|
if (d.getElementById(id)) {
|
|
49
53
|
return;
|
|
50
54
|
}
|
|
55
|
+
|
|
51
56
|
js = d.createElement(s);
|
|
52
57
|
js.id = id;
|
|
53
58
|
js.src = "https://connect.facebook.net/en_US/sdk.js";
|
|
54
59
|
fjs.parentNode.insertBefore(js, fjs);
|
|
55
60
|
})(document, 'script', 'facebook-jssdk');
|
|
56
61
|
}
|
|
62
|
+
|
|
57
63
|
function fbLogin(params) {
|
|
58
64
|
return new Promise(function (resolve, reject) {
|
|
59
65
|
return global.FB.login(function (response) {
|
|
@@ -63,6 +69,7 @@ function fbLogin(params) {
|
|
|
63
69
|
}, params);
|
|
64
70
|
});
|
|
65
71
|
}
|
|
72
|
+
|
|
66
73
|
function fbVerifyEmailExists(token) {
|
|
67
74
|
return new Promise(function (resolve, reject) {
|
|
68
75
|
return global.FB.api('/me', {
|
|
@@ -72,13 +79,16 @@ function fbVerifyEmailExists(token) {
|
|
|
72
79
|
});
|
|
73
80
|
});
|
|
74
81
|
}
|
|
82
|
+
|
|
75
83
|
function loginWithFacebook() {
|
|
76
84
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
77
|
-
|
|
78
|
-
|
|
85
|
+
scope = _ref2.scope,
|
|
86
|
+
emailMandatory = _ref2.emailMandatory;
|
|
87
|
+
|
|
79
88
|
if (!global.FB) {
|
|
80
89
|
return Promise.reject('NOT_LOADED');
|
|
81
90
|
}
|
|
91
|
+
|
|
82
92
|
return fbLogin({
|
|
83
93
|
scope: scope
|
|
84
94
|
}).then(function (token) {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithSocialLogin } from './with-social-login';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @see {@link WithSocialLogin}
|
|
6
5
|
* @component
|
|
7
6
|
* @category Login
|
|
8
7
|
*/
|
|
8
|
+
|
|
9
9
|
export function WithGoogleLogin(_ref) {
|
|
10
10
|
var clientId = _ref.clientId,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
scope = _ref.scope,
|
|
13
|
+
emailMandatory = _ref.emailMandatory,
|
|
14
|
+
redirectUrl = _ref.redirectUrl,
|
|
15
|
+
sso = _ref.sso,
|
|
16
|
+
isBridgekeeperLogin = _ref.isBridgekeeperLogin;
|
|
17
17
|
return /*#__PURE__*/React.createElement(WithSocialLogin, {
|
|
18
18
|
provider: 'google',
|
|
19
19
|
initialize: function initialize() {
|
|
@@ -30,6 +30,7 @@ export function WithGoogleLogin(_ref) {
|
|
|
30
30
|
isBridgekeeperLogin: isBridgekeeperLogin
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
|
|
33
34
|
var onScriptLoaded = function onScriptLoaded(clientId, scope) {
|
|
34
35
|
global.gapi.load('client:auth2', function () {
|
|
35
36
|
return global.gapi.client.init({
|
|
@@ -38,16 +39,21 @@ var onScriptLoaded = function onScriptLoaded(clientId, scope) {
|
|
|
38
39
|
});
|
|
39
40
|
});
|
|
40
41
|
};
|
|
42
|
+
|
|
41
43
|
var loginWithGoogle = function loginWithGoogle() {
|
|
42
44
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
43
|
-
|
|
45
|
+
emailMandatory = _ref2.emailMandatory;
|
|
46
|
+
|
|
44
47
|
if (!global.gapi || !global.gapi.client) {
|
|
45
48
|
return Promise.reject("NOT_LOADED");
|
|
46
49
|
}
|
|
50
|
+
|
|
47
51
|
var GoogleAuth = global.gapi.auth2.getAuthInstance();
|
|
52
|
+
|
|
48
53
|
if (!GoogleAuth) {
|
|
49
54
|
return Promise.reject("NOT_LOADED");
|
|
50
55
|
}
|
|
56
|
+
|
|
51
57
|
return GoogleAuth.signIn().then(function (response) {
|
|
52
58
|
return emailMandatory && !response.getBasicProfile().getEmail() ? Promise.reject('NO_EMAIL') : {
|
|
53
59
|
'access-token': response.getAuthResponse().access_token
|
|
@@ -56,16 +62,20 @@ var loginWithGoogle = function loginWithGoogle() {
|
|
|
56
62
|
return Promise.reject('NOT_GRANTED');
|
|
57
63
|
});
|
|
58
64
|
};
|
|
65
|
+
|
|
59
66
|
var loadGoogleSDK = function loadGoogleSDK(clientId, scope) {
|
|
60
67
|
if (global.gapi) {
|
|
61
68
|
return;
|
|
62
69
|
}
|
|
70
|
+
|
|
63
71
|
var script = document.createElement('script');
|
|
64
72
|
script.src = 'https://apis.google.com/js/api.js';
|
|
65
73
|
script.async = true;
|
|
66
74
|
script.defer = true;
|
|
75
|
+
|
|
67
76
|
script.onload = function () {
|
|
68
77
|
return onScriptLoaded(clientId, scope);
|
|
69
78
|
};
|
|
79
|
+
|
|
70
80
|
document.getElementsByTagName('body')[0].appendChild(script);
|
|
71
81
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithSocialLogin } from './with-social-login';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @see {@link WithSocialLogin}
|
|
6
5
|
* @component
|
|
7
6
|
* @category Login
|
|
8
7
|
*/
|
|
8
|
+
|
|
9
9
|
export function WithLinkedInLogin(_ref) {
|
|
10
10
|
var clientKey = _ref.clientKey,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
scope = _ref.scope,
|
|
13
|
+
emailMandatory = _ref.emailMandatory,
|
|
14
|
+
redirectUrl = _ref.redirectUrl,
|
|
15
|
+
sso = _ref.sso,
|
|
16
|
+
isBridgekeeperLogin = _ref.isBridgekeeperLogin;
|
|
17
17
|
return /*#__PURE__*/React.createElement(WithSocialLogin, {
|
|
18
18
|
provider: 'linkedin',
|
|
19
19
|
initialize: function initialize() {
|
|
@@ -30,10 +30,12 @@ export function WithLinkedInLogin(_ref) {
|
|
|
30
30
|
isBridgekeeperLogin: isBridgekeeperLogin
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
|
+
|
|
33
34
|
var loadLinkedInSdk = function loadLinkedInSdk(clientKey, scope) {
|
|
34
35
|
if (global.IN) {
|
|
35
36
|
return;
|
|
36
37
|
}
|
|
38
|
+
|
|
37
39
|
var script = document.createElement('script');
|
|
38
40
|
script.src = '//platform.linkedin.com/in.js';
|
|
39
41
|
script.type = 'text/javascript';
|
|
@@ -42,11 +44,14 @@ var loadLinkedInSdk = function loadLinkedInSdk(clientKey, scope) {
|
|
|
42
44
|
script.innerHTML = "\n api_key: ".concat(clientKey, "\n");
|
|
43
45
|
document.getElementsByTagName('body')[0].appendChild(script);
|
|
44
46
|
};
|
|
47
|
+
|
|
45
48
|
var loginWithLinkedIn = function loginWithLinkedIn(_ref2) {
|
|
46
49
|
var emailMandatory = _ref2.emailMandatory;
|
|
50
|
+
|
|
47
51
|
if (!global.IN || !global.IN.User) {
|
|
48
52
|
return Promise.reject("NOT_LOADED");
|
|
49
53
|
}
|
|
54
|
+
|
|
50
55
|
return new Promise(function (resolve, reject) {
|
|
51
56
|
global.IN.User.authorize(function (e) {
|
|
52
57
|
if (global.IN.User.isAuthorized()) {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
8
11
|
import { bool, func, string } from 'prop-types';
|
|
9
12
|
import React from 'react';
|
|
10
13
|
import { postRequest } from '../api-client';
|
|
11
|
-
|
|
12
14
|
/**
|
|
13
15
|
* This is an abstract render props component for logging in with social accounts. The component adds two items to scope: `serverSideLoginPath` for redirecting to server side, and `login` for doing a client side login. Calling `login()` returns a promise which can be used to handle success and failure cases.
|
|
14
16
|
*
|
|
@@ -56,19 +58,26 @@ import { postRequest } from '../api-client';
|
|
|
56
58
|
* @hideconstructor
|
|
57
59
|
* @category Login
|
|
58
60
|
*/
|
|
61
|
+
|
|
59
62
|
export var WithSocialLogin = /*#__PURE__*/function (_React$Component) {
|
|
63
|
+
_inherits(WithSocialLogin, _React$Component);
|
|
64
|
+
|
|
65
|
+
var _super = /*#__PURE__*/_createSuper(WithSocialLogin);
|
|
66
|
+
|
|
60
67
|
function WithSocialLogin(props) {
|
|
61
68
|
var _this;
|
|
69
|
+
|
|
62
70
|
_classCallCheck(this, WithSocialLogin);
|
|
63
|
-
|
|
71
|
+
|
|
72
|
+
_this = _super.call(this, props);
|
|
64
73
|
_this.bridgekeeperServerLoginPath = "/api/auth/v1/login?auth-provider=".concat(_this.props.provider, "&redirect-url=").concat(_this.props.redirectUrl ? _this.props.redirectUrl : global.location && global.location.origin);
|
|
65
74
|
_this.defaultServerLoginPath = "/login?auth-provider=".concat(_this.props.provider, "&remote-host=").concat(global.location && global.location.origin);
|
|
66
75
|
_this.serverLoginPath = _this.props.isBridgekeeperLogin ? _this.bridgekeeperServerLoginPath : _this.defaultServerLoginPath;
|
|
67
76
|
_this.serverSideSSOLoginPath = "/login?auth-provider=".concat(_this.props.provider, "&redirect-url=").concat(_this.props.sso && _this.props.redirectUrl ? _this.props.redirectUrl : global.location && global.location.origin);
|
|
68
77
|
return _this;
|
|
69
78
|
}
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
|
|
80
|
+
_createClass(WithSocialLogin, [{
|
|
72
81
|
key: "componentDidMount",
|
|
73
82
|
value: function componentDidMount() {
|
|
74
83
|
this.props.initialize();
|
|
@@ -77,6 +86,7 @@ export var WithSocialLogin = /*#__PURE__*/function (_React$Component) {
|
|
|
77
86
|
key: "render",
|
|
78
87
|
value: function render() {
|
|
79
88
|
var _this2 = this;
|
|
89
|
+
|
|
80
90
|
return this.props.children({
|
|
81
91
|
login: function login(props) {
|
|
82
92
|
return _this2.props.socialLogin.call(_this2, props).then(function (token) {
|
|
@@ -87,7 +97,10 @@ export var WithSocialLogin = /*#__PURE__*/function (_React$Component) {
|
|
|
87
97
|
});
|
|
88
98
|
}
|
|
89
99
|
}]);
|
|
100
|
+
|
|
101
|
+
return WithSocialLogin;
|
|
90
102
|
}(React.Component);
|
|
103
|
+
|
|
91
104
|
function createSession(provider, token) {
|
|
92
105
|
return postRequest("/api/login/".concat(provider), {
|
|
93
106
|
token: token,
|
|
@@ -96,6 +109,7 @@ function createSession(provider, token) {
|
|
|
96
109
|
return r;
|
|
97
110
|
});
|
|
98
111
|
}
|
|
112
|
+
|
|
99
113
|
WithSocialLogin.defaultProps = {
|
|
100
114
|
initialize: function initialize() {},
|
|
101
115
|
// function is rebound in WithSocialLogin
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithSocialLogin } from './with-social-login';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* @see {@link WithSocialLogin}
|
|
6
5
|
* @component
|
|
7
6
|
* @category Login
|
|
8
7
|
*/
|
|
8
|
+
|
|
9
9
|
export function WithTwitterLogin(_ref) {
|
|
10
10
|
var clientId = _ref.clientId,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
children = _ref.children,
|
|
12
|
+
scope = _ref.scope,
|
|
13
|
+
emailMandatory = _ref.emailMandatory,
|
|
14
|
+
redirectUrl = _ref.redirectUrl,
|
|
15
|
+
sso = _ref.sso,
|
|
16
|
+
isBridgekeeperLogin = _ref.isBridgekeeperLogin;
|
|
17
17
|
return /*#__PURE__*/React.createElement(WithSocialLogin, {
|
|
18
18
|
provider: 'twitter',
|
|
19
19
|
children: children,
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
3
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
4
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
5
|
-
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
|
|
9
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
+
|
|
8
11
|
import React from 'react';
|
|
9
12
|
import { connect } from 'react-redux';
|
|
10
13
|
import { withError } from './with-error';
|
|
14
|
+
|
|
11
15
|
function getNativeShareHandler(canNativeShare, title, fullUrl) {
|
|
12
16
|
if (!canNativeShare) {
|
|
13
17
|
return null;
|
|
14
18
|
}
|
|
19
|
+
|
|
15
20
|
return function handleShare() {
|
|
16
21
|
window.navigator.share({
|
|
17
22
|
title: title,
|
|
@@ -19,18 +24,25 @@ function getNativeShareHandler(canNativeShare, title, fullUrl) {
|
|
|
19
24
|
})["catch"](console.error);
|
|
20
25
|
};
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
var SocialShareBase = /*#__PURE__*/function (_React$Component) {
|
|
29
|
+
_inherits(SocialShareBase, _React$Component);
|
|
30
|
+
|
|
31
|
+
var _super = /*#__PURE__*/_createSuper(SocialShareBase);
|
|
32
|
+
|
|
23
33
|
function SocialShareBase(props) {
|
|
24
34
|
var _this;
|
|
35
|
+
|
|
25
36
|
_classCallCheck(this, SocialShareBase);
|
|
26
|
-
|
|
37
|
+
|
|
38
|
+
_this = _super.call(this, props);
|
|
27
39
|
_this.state = {
|
|
28
40
|
canNativeShare: false
|
|
29
41
|
};
|
|
30
42
|
return _this;
|
|
31
43
|
}
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
|
|
45
|
+
_createClass(SocialShareBase, [{
|
|
34
46
|
key: "componentDidMount",
|
|
35
47
|
value: function componentDidMount() {
|
|
36
48
|
this.setState({
|
|
@@ -54,13 +66,15 @@ var SocialShareBase = /*#__PURE__*/function (_React$Component) {
|
|
|
54
66
|
}, this.props));
|
|
55
67
|
}
|
|
56
68
|
}]);
|
|
69
|
+
|
|
70
|
+
return SocialShareBase;
|
|
57
71
|
}(React.Component);
|
|
72
|
+
|
|
58
73
|
function mapStateToProps(state) {
|
|
59
74
|
return {
|
|
60
75
|
publisherUrl: state.qt.config['sketches-host']
|
|
61
76
|
};
|
|
62
77
|
}
|
|
63
|
-
|
|
64
78
|
/**
|
|
65
79
|
* This component renders social share component to front end app.
|
|
66
80
|
*
|
|
@@ -98,4 +112,6 @@ function mapStateToProps(state) {
|
|
|
98
112
|
* @component
|
|
99
113
|
* @category Story Page
|
|
100
114
|
*/
|
|
101
|
-
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
export var SocialShare = /*#__PURE__*/connect(mapStateToProps, {})( /*#__PURE__*/withError(SocialShareBase));
|