@times-components/save-and-share-bar 0.18.3 → 0.19.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/CHANGELOG.md +27 -0
- package/dist/styles/index.js +1 -1
- package/package.json +14 -14
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.19.0](https://github.com/newsuk/times-components/compare/@times-components/save-and-share-bar@0.18.5...@times-components/save-and-share-bar@0.19.0) (2023-04-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **TMRX-753:** article page typography updates ([#3318](https://github.com/newsuk/times-components/issues/3318)) ([43a193a](https://github.com/newsuk/times-components/commit/43a193a88a8d1cfbb8389628af37f244849eb110))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.18.5](https://github.com/newsuk/times-components/compare/@times-components/save-and-share-bar@0.18.4...@times-components/save-and-share-bar@0.18.5) (2023-04-06)
|
|
18
|
+
|
|
19
|
+
**Note:** Version bump only for package @times-components/save-and-share-bar
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [0.18.4](https://github.com/newsuk/times-components/compare/@times-components/save-and-share-bar@0.18.3...@times-components/save-and-share-bar@0.18.4) (2023-04-04)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @times-components/save-and-share-bar
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [0.18.3](https://github.com/newsuk/times-components/compare/@times-components/save-and-share-bar@0.18.2...@times-components/save-and-share-bar@0.18.3) (2023-04-03)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @times-components/save-and-share-bar
|
package/dist/styles/index.js
CHANGED
|
@@ -32,7 +32,7 @@ const styles = {
|
|
|
32
32
|
},
|
|
33
33
|
label: _objectSpread(_objectSpread({}, (0, _tsStyleguide.fontFactory)({
|
|
34
34
|
font: "supporting",
|
|
35
|
-
fontSize: "
|
|
35
|
+
fontSize: "saveAndShare"
|
|
36
36
|
})), {}, {
|
|
37
37
|
color: _tsStyleguide.colours.functional.secondary,
|
|
38
38
|
marginRight: (0, _tsStyleguide.spacing)(2),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/save-and-share-bar",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Save and Share bar",
|
|
3
|
+
"version": "0.19.0",
|
|
4
|
+
"description": "Save and Share bar ",
|
|
5
5
|
"main": "dist/save-and-share-bar",
|
|
6
6
|
"dev": "src/save-and-share-bar",
|
|
7
7
|
"scripts": {
|
|
@@ -33,25 +33,25 @@
|
|
|
33
33
|
"homepage": "https://github.com/newsuk/times-components#readme",
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@storybook/addon-knobs": "6.4.0",
|
|
36
|
-
"@times-components/context": "1.10.
|
|
37
|
-
"@times-components/icons": "2.20.
|
|
38
|
-
"@times-components/link": "3.12.
|
|
39
|
-
"@times-components/message-bar": "0.7.
|
|
36
|
+
"@times-components/context": "1.10.25",
|
|
37
|
+
"@times-components/icons": "2.20.6",
|
|
38
|
+
"@times-components/link": "3.12.5",
|
|
39
|
+
"@times-components/message-bar": "0.7.29",
|
|
40
40
|
"@times-components/provider-queries": "2.18.2",
|
|
41
|
-
"@times-components/tracking": "2.19.
|
|
42
|
-
"@times-components/ts-components": "1.
|
|
43
|
-
"@times-components/ts-styleguide": "1.
|
|
44
|
-
"@times-components/user-state": "0.4.
|
|
45
|
-
"@times-components/utils": "6.16.
|
|
41
|
+
"@times-components/tracking": "2.19.4",
|
|
42
|
+
"@times-components/ts-components": "1.68.0",
|
|
43
|
+
"@times-components/ts-styleguide": "1.43.0",
|
|
44
|
+
"@times-components/user-state": "0.4.28",
|
|
45
|
+
"@times-components/utils": "6.16.6",
|
|
46
46
|
"prop-types": "15.7.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "7.4.4",
|
|
50
50
|
"@times-components/eslint-config-thetimes": "0.8.18",
|
|
51
51
|
"@times-components/jest-configurator-web": "0.8.1",
|
|
52
|
-
"@times-components/jest-serializer": "3.8.
|
|
52
|
+
"@times-components/jest-serializer": "3.8.3",
|
|
53
53
|
"@times-components/provider-test-tools": "1.27.3",
|
|
54
|
-
"@times-components/storybook": "4.9.
|
|
54
|
+
"@times-components/storybook": "4.9.3",
|
|
55
55
|
"@times-components/webpack-configurator": "2.1.0",
|
|
56
56
|
"babel-jest": "24.8.0",
|
|
57
57
|
"eslint": "5.9.0",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "44bf2bd8f5f03338105febd22619c1afc6b9eb15"
|
|
77
77
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/icons/rnw")},function(e,t){e.exports=require("@times-components/user-state/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@times-components/context/rnw")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/provider-queries/rnw")},function(e,t){e.exports=require("@times-components/tracking/rnw")},function(e,t){e.exports=require("@times-components/link/rnw")},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=(r(5),r(2)),i=r(3),c=r(4),l=r.n(c),s=r(6),u=r(7),d=r(8);const p=Object(a.makeClient)();var h=e=>p.query({query:d.getTokenisedArticleUrl,variables:{id:e}}),f=r(9),m="https://www.facebook.com/sharer/sharer.php",g="https://twitter.com/intent/tweet",b=r(1);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O={container:{flex:1,flexDirection:"row",justifyContent:"space-between",paddingTop:Object(b.spacing)(2),paddingBottom:Object(b.spacing)(2),height:"100%",alignItems:"center"},activityLoader:{borderRadius:9999,height:40,overflow:"hidden",width:40},label:v(v({},Object(b.fontFactory)({font:"supporting",fontSize:"
|
|
1
|
+
module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/icons/rnw")},function(e,t){e.exports=require("@times-components/user-state/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("@times-components/context/rnw")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/provider-queries/rnw")},function(e,t){e.exports=require("@times-components/tracking/rnw")},function(e,t){e.exports=require("@times-components/link/rnw")},function(e,t,r){"use strict";r.r(t);var n=r(0),o=r.n(n),a=(r(5),r(2)),i=r(3),c=r(4),l=r.n(c),s=r(6),u=r(7),d=r(8);const p=Object(a.makeClient)();var h=e=>p.query({query:d.getTokenisedArticleUrl,variables:{id:e}}),f=r(9),m="https://www.facebook.com/sharer/sharer.php",g="https://twitter.com/intent/tweet",b=r(1);function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O={container:{flex:1,flexDirection:"row",justifyContent:"space-between",paddingTop:Object(b.spacing)(2),paddingBottom:Object(b.spacing)(2),height:"100%",alignItems:"center"},activityLoader:{borderRadius:9999,height:40,overflow:"hidden",width:40},label:v(v({},Object(b.fontFactory)({font:"supporting",fontSize:"saveAndShare"})),{},{color:b.colours.functional.secondary,marginRight:Object(b.spacing)(2),transform:"translateY(9%)"}),link:{base:"\n margin-left: ".concat(Object(b.spacing)(1),";\n cursor: pointer;\n border-radius: ").concat(40,"px;\n\n &, > * {\n display: flex;\n align-items: center;\n justify-content: center;\n height: ").concat(40,"px;\n width: ").concat(40,"px;\n }\n\n &:hover {\n background-color: ").concat(b.colours.functional.whiteGrey,";\n }\n &:active {\n background-color: ").concat(b.colours.functional.keyline,";\n }\n ")},rowItem:{alignItems:"center",flexDirection:"row",height:40},rowItemRight:{alignItems:"center",flexDirection:"row",height:40,marginLeft:"auto"},svgIcon:{fb:{height:18},star:{height:18},fillColour:b.colours.functional.secondary,height:16,hoverFillColour:b.colours.functional.brandColour,save:{fillColour:b.colours.functional.white,strokeColour:b.colours.functional.secondary}}},S=r(10),I=r.n(S);function k(){return(k=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function T(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var C=e=>{let t=e.children,r=e.colour,n=void 0===r?O.svgIcon.fillColour:r,i=e.dataTestId,c=e.hoverColour,l=void 0===c?O.svgIcon.hoverFillColour:c,s=e.onPress,u=void 0===s?()=>{}:s,d=T(e,["children","colour","dataTestId","hoverColour","onPress"]);return o.a.createElement(a.TcView,{"data-testid":i},o.a.createElement(I.a,k({onPress:u,responsiveLinkStyles:O.link},d),o.a.createElement(a.HoverIcon,{colour:n,hoverColour:l},t)))};class j extends n.Component{constructor(e){super(e),this.state={isLoading:!1},this.onShare=this.onShare.bind(this)}onShare(e){const t=this.props,r=t.articleId,n=t.getTokenisedShareUrl,o=t.shouldTokenise,a=t.articleUrl,i=t.onShareEmail,c=t.articleHeadline;if(e.preventDefault(),i({articleId:r,articleUrl:a,articleHeadline:c}),o)this.setState({isLoading:!0}),n(r).then(e=>{const t=e.data;t&&t.article&&(this.setState({isLoading:!1}),this.openMailClient(t.article.tokenisedUrl))}).catch(e=>{this.setState({isLoading:!1}),console.error("Error in connecting to api",e)});else{const e=window.location.search.match(/[?&]shareToken=([^&]+)/);this.openMailClient(e?"".concat(a,"?shareToken=").concat(e[1]):a)}}openMailClient(e){const t=this.props,r=t.articleHeadline,n="TIMES"!==t.publicationName?"The Sunday Times":"The Times",o="mailto:?subject=".concat(r," from ").concat(n,"&body=I thought you would be interested in this story from ").concat(n,"%0A%0A").concat(r,"%0A%0A").concat(e);window.location.assign(o)}render(){const e=this.state.isLoading;return o.a.createElement(C,{onPress:this.onShare,dataTestId:"email-share",url:""},e?o.a.createElement(i.IconActivityIndicator,{size:"small",style:O.activityLoader}):o.a.createElement(i.IconEmail,{fillColour:"currentColor",height:O.svgIcon.height,title:"Share by email"}))}}j.defaultProps={publicationName:"TIMES"};var E=j;function x(){return(x=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}class P extends n.Component{constructor(e){super(e),this.copyToClipboard=this.copyToClipboard.bind(this)}copyToClipboard(e){const t=this.props,r=t.onCopyLink,n=t.articleUrl;e.preventDefault(),navigator.clipboard.writeText(n),r()}render(){const e=this.props,t=e.articleId,r=e.articleUrl,n=e.savingEnabled,c=e.sharingEnabled,d=e.onShareOnFB,p=e.onShareOnTwitter;return o.a.createElement(a.TcView,{style:O.container,"data-testid":"save-and-share-bar"},c&&o.a.createElement(a.TcView,{style:O.rowItem},o.a.createElement(a.TcText,{style:Object(a.checkStylesForUnits)(O.label)},"Share"),o.a.createElement(s.SectionContext.Consumer,null,e=>{let t=e.publicationName;return o.a.createElement(l.a,{state:l.a.showTokenisedEmailShare,fallback:o.a.createElement(E,x({},this.props,{shouldTokenise:!1,publicationName:t}))},o.a.createElement(E,x({},this.props,{shouldTokenise:!0,publicationName:t})))}),o.a.createElement(C,{onPress:p,target:"_blank",dataTestId:"share-twitter",url:"".concat(g,"?text=").concat(r)},o.a.createElement(i.IconTwitter,{fillColour:"currentColor",height:O.svgIcon.height,title:"Share on Twitter"})),o.a.createElement(C,{onPress:d,target:"_blank",dataTestId:"share-facebook",url:"".concat(m,"?u=").concat(r)},o.a.createElement(i.IconFacebook,{fillColour:"currentColor",height:O.svgIcon.fb.height,title:"Share on Facebook"})),o.a.createElement(C,{color:O.svgIcon.save.strokeColour,hoverColor:O.svgIcon.hoverFillColour,onPress:this.copyToClipboard,dataTestId:"copy-to-clickboard",url:""},o.a.createElement(i.IconCopyLink,{fillColour:"currentColor",height:O.svgIcon.height,title:"Copy link to clipboard"}))),n?o.a.createElement(l.a,{state:l.a.showArticleSaveButton,serverRender:!1},o.a.createElement(a.TcView,{style:O.rowItemRight,"data-testid":"save-star"},o.a.createElement(u.SaveStar,{articleId:t}))):null)}}P.defaultProps={onShareOnFB:()=>{},onShareOnTwitter:()=>{},onShareEmail:()=>{},getTokenisedShareUrl:h};var A;t.default=(A=P,Object(f.withTrackEvents)(A,{analyticsEvents:[{actionName:"Pressed",eventName:"onSaveToMyArticles",getAttrs:e=>({articleId:e.articleId,articleHeadline:e.articleHeadline}),trackingName:"ArticleSaveToMyArticles"},{actionName:"Pressed",eventName:"onShareEmail",getAttrs:e=>({articleId:e.articleId,articleHeadline:e.articleHeadline}),trackingName:"ArticleShareUrlByEmail"},{actionName:"Pressed",eventName:"onCopyLink",getAttrs:e=>({articleId:e.articleId,articleHeadline:e.articleHeadline}),trackingName:"ArticleCopyLink"},{actionName:"Pressed",eventName:"onShareOnFB",getAttrs:e=>({articleId:e.articleId,articleHeadline:e.articleHeadline}),trackingName:"ArticleShareOnFacebook"},{actionName:"Pressed",eventName:"onShareOnTwitter",getAttrs:e=>({articleId:e.articleId,articleHeadline:e.articleHeadline}),trackingName:"ArticleShareOnTwitter"}]}))}]);
|