From 2f6561b9ca83fc454f955020961058da57d6a81f Mon Sep 17 00:00:00 2001 From: Fabio Sikansi Date: Mon, 13 Dec 2021 18:22:43 +0000 Subject: [PATCH 01/32] add o-labels import --- components/x-gift-article/bower.json | 1 + components/x-gift-article/src/GiftArticle.scss | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/components/x-gift-article/bower.json b/components/x-gift-article/bower.json index 18dc603c2..74de008b3 100644 --- a/components/x-gift-article/bower.json +++ b/components/x-gift-article/bower.json @@ -6,6 +6,7 @@ "dependencies": { "o-buttons": "^6.0.0", "o-forms": "^8.0.0", + "o-labels": "5.0.0", "o-loading": "^4.0.0", "o-message": "^4.0.0", "o-typography": "6.0.0", diff --git a/components/x-gift-article/src/GiftArticle.scss b/components/x-gift-article/src/GiftArticle.scss index e3a0f2d36..5cd2f4454 100644 --- a/components/x-gift-article/src/GiftArticle.scss +++ b/components/x-gift-article/src/GiftArticle.scss @@ -16,6 +16,10 @@ $o-message-is-silent: true; $o-typography-is-silent: true; @import 'o-typography/main'; +$o-labels-is-silent: true; +@import 'o-labels/main'; + + .container { @include oTypographySans; strong { @@ -36,6 +40,11 @@ $o-typography-is-silent: true; .radio-button-section { margin-bottom: 12px; + @include oLabels($opts: ( + 'states': ( + 'content-premium' + ), + )); } .share-option-title { From 1adeda890781db4f989adf14027b3e4d8653886e Mon Sep 17 00:00:00 2001 From: Fabio Sikansi Date: Mon, 13 Dec 2021 18:24:23 +0000 Subject: [PATCH 02/32] add enterprise sharing to gift modal --- components/x-gift-article/src/Buttons.jsx | 11 ++++-- components/x-gift-article/src/Form.jsx | 2 + components/x-gift-article/src/Message.jsx | 8 ++++ .../src/RadioButtonsSection.jsx | 39 ++++++++++++++++++- components/x-gift-article/src/Url.jsx | 2 +- .../x-gift-article/src/lib/constants.js | 1 + components/x-gift-article/src/lib/updaters.js | 8 ++++ 7 files changed, 64 insertions(+), 7 deletions(-) diff --git a/components/x-gift-article/src/Buttons.jsx b/components/x-gift-article/src/Buttons.jsx index 77d028e39..c489e8727 100644 --- a/components/x-gift-article/src/Buttons.jsx +++ b/components/x-gift-article/src/Buttons.jsx @@ -35,7 +35,8 @@ export default ({ className={ButtonWithGapClassNames} type="button" onClick={shareType === ShareType.gift ? actions.copyGiftUrl : actions.copyNonGiftUrl} - aria-label="Copy the gift article link to your clipboard"> + aria-label="Copy the gift article link to your clipboard" + > Copy link )} @@ -44,7 +45,8 @@ export default ({ href={mailtoUrl} target="_blank" rel="noopener noreferrer" - onClick={shareType === ShareType.gift ? actions.emailGiftUrl : actions.emailNonGiftUrl}> + onClick={shareType === ShareType.gift ? actions.emailGiftUrl : actions.emailNonGiftUrl} + > Email link to Share this article @@ -57,8 +59,9 @@ export default ({ className={ButtonClassNames} disabled={!giftCredits} type="button" - onClick={actions.createGiftUrl}> - Create gift link + onClick={shareType === ShareType.enterprise ? actions.createEnterpriseUrl : actions.createGiftUrl} + > + Create {shareType === ShareType.enterprise ? 'enterprise' : 'gift'} link ) diff --git a/components/x-gift-article/src/Form.jsx b/components/x-gift-article/src/Form.jsx index a2a8b515f..af278a01b 100644 --- a/components/x-gift-article/src/Form.jsx +++ b/components/x-gift-article/src/Form.jsx @@ -17,7 +17,9 @@ export default (props) => ( shareType={props.shareType} isArticleSharingUxUpdates={props.isArticleSharingUxUpdates} showGiftUrlSection={props.actions.showGiftUrlSection} + showEnterpriseUrlSection={props.actions.showEnterpriseUrlSection} showNonGiftUrlSection={props.actions.showNonGiftUrlSection} + enterpriseLimit={props.enterpriseLimit} /> )} diff --git a/components/x-gift-article/src/Message.jsx b/components/x-gift-article/src/Message.jsx index 156c75c1e..1cdd9a034 100644 --- a/components/x-gift-article/src/Message.jsx +++ b/components/x-gift-article/src/Message.jsx @@ -20,6 +20,10 @@ export default ({ return null } + if (shareType === ShareType.enterprise) { + return null + } + if (shareType === ShareType.gift) { if (giftCredits === 0) { return ( @@ -89,6 +93,10 @@ export default ({ ) } + if (shareType === ShareType.enterprise) { + return null + } + if (shareType === ShareType.nonGift) { return
This link can only be read by existing subscribers
} diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index c94181e4b..01bc6a350 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -10,7 +10,14 @@ const radioSectionClassNames = [ styles['radio-button-section'] ].join(' ') -export default ({ shareType, showGiftUrlSection, isArticleSharingUxUpdates, showNonGiftUrlSection }) => ( +export default ({ + shareType, + showGiftUrlSection, + showEnterpriseUrlSection, + isArticleSharingUxUpdates, + showNonGiftUrlSection, + enterpriseLimit = null +}) => (
Article share options @@ -30,11 +37,39 @@ export default ({ shareType, showGiftUrlSection, isArticleSharingUxUpdates, show ) : ( - with anyone (uses 1 gift credit) + with up to 3 people (uses 1 gift credit) )} + {enterpriseLimit !== null && ( + + )} +