From 89e22830e0437ab46f5131dcff7ab2ba12c0ac16 Mon Sep 17 00:00:00 2001 From: Will Howard Date: Tue, 13 Dec 2022 21:24:52 +0000 Subject: [PATCH 1/9] Add Enterprise Sharing dashboard link to gift modal. --- components/x-gift-article/src/Message.jsx | 10 ++++++++++ components/x-gift-article/src/Message.scss | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/components/x-gift-article/src/Message.jsx b/components/x-gift-article/src/Message.jsx index 77d16100c..44d1536b9 100644 --- a/components/x-gift-article/src/Message.jsx +++ b/components/x-gift-article/src/Message.jsx @@ -123,6 +123,16 @@ export default ({ return (
Your organisation has Enterprise Sharing credits available for you to use +
+
+ + View all Enterprise Links +
) } else { diff --git a/components/x-gift-article/src/Message.scss b/components/x-gift-article/src/Message.scss index 25876c2aa..1b16133a4 100644 --- a/components/x-gift-article/src/Message.scss +++ b/components/x-gift-article/src/Message.scss @@ -4,6 +4,10 @@ grid-area: message; font-size: 16px; margin-top: oSpacingByName('s3'); + + a { + color: oColorsByName('teal'); + } } .x-gift-article-message--enterprise { From 247c1aa64a7c003b78d251aed889a108851bec28 Mon Sep 17 00:00:00 2001 From: Will Howard Date: Tue, 13 Dec 2022 21:36:39 +0000 Subject: [PATCH 2/9] Remove Enterprise label next to sharing option. --- components/x-gift-article/src/GiftArticle.scss | 6 ------ components/x-gift-article/src/RadioButtonsSection.jsx | 1 - 2 files changed, 7 deletions(-) diff --git a/components/x-gift-article/src/GiftArticle.scss b/components/x-gift-article/src/GiftArticle.scss index 36e96e165..249776728 100644 --- a/components/x-gift-article/src/GiftArticle.scss +++ b/components/x-gift-article/src/GiftArticle.scss @@ -50,12 +50,6 @@ ); } -.x-gift-article__enterprise-label { - background-color: oColorsByName('black-10'); - color: oColorsByName('black'); - margin: 0px 6px; -} - .x-gift-article__enterprise-no-credits-icon { @include oIconsContent($icon-name: 'warning', $color: oColorsByName('crimson'), $size: 16); border-radius: 50%; diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index 857221416..06efe55dc 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -34,7 +34,6 @@ export default ({ {enterpriseLimit && !enterpriseRequestAccess ? `Up to ${enterpriseLimit} recipients` : `Multiple recipients`} - Enterprise {enterpriseAlert && } From 2553ea6d3b9bbcc73d312d3b998697cd157072e3 Mon Sep 17 00:00:00 2001 From: Will Howard Date: Tue, 13 Dec 2022 21:55:45 +0000 Subject: [PATCH 3/9] Correct sharing box label for Enterprise Shares. --- components/x-gift-article/src/Url.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/x-gift-article/src/Url.jsx b/components/x-gift-article/src/Url.jsx index 6d897bdf5..b45437f25 100644 --- a/components/x-gift-article/src/Url.jsx +++ b/components/x-gift-article/src/Url.jsx @@ -5,7 +5,7 @@ export default ({ shareType, isGiftUrlCreated, url, urlType }) => { return ( Date: Wed, 14 Dec 2022 09:15:00 +0000 Subject: [PATCH 4/9] Add Free with Enterprise Sharing gift article story. --- components/x-gift-article/src/Form.jsx | 27 +++-- components/x-gift-article/src/GiftArticle.jsx | 39 ++++--- components/x-gift-article/src/Message.jsx | 16 +-- .../src/RadioButtonsSection.jsx | 106 +++++++++++++----- .../free-article-with-enterprise-sharing.js | 43 +++++++ components/x-gift-article/storybook/index.jsx | 17 ++- 6 files changed, 178 insertions(+), 70 deletions(-) create mode 100644 components/x-gift-article/storybook/free-article-with-enterprise-sharing.js diff --git a/components/x-gift-article/src/Form.jsx b/components/x-gift-article/src/Form.jsx index 2d511a952..2859261ca 100644 --- a/components/x-gift-article/src/Form.jsx +++ b/components/x-gift-article/src/Form.jsx @@ -12,20 +12,19 @@ export default (props) => (
- {!props.isFreeArticle && ( - <RadioButtonsSection - shareType={props.shareType} - isArticleSharingUxUpdates={props.isArticleSharingUxUpdates} - showGiftUrlSection={props.actions.showGiftUrlSection} - showEnterpriseUrlSection={props.actions.showEnterpriseUrlSection} - showNonGiftUrlSection={props.actions.showNonGiftUrlSection} - enterpriseLimit={props.enterpriseLimit} - enterpriseHasCredits={props.enterpriseHasCredits} - enterpriseRequestAccess={props.enterpriseRequestAccess} - enterpriseAlert={!props.enterpriseHasCredits && !props.enterpriseRequestAccess} - enterpriseEnabled={props.enterpriseEnabled} - /> - )} + <RadioButtonsSection + shareType={props.shareType} + isArticleSharingUxUpdates={props.isArticleSharingUxUpdates} + showGiftUrlSection={props.actions.showGiftUrlSection} + showEnterpriseUrlSection={props.actions.showEnterpriseUrlSection} + showNonGiftUrlSection={props.actions.showNonGiftUrlSection} + enterpriseLimit={props.enterpriseLimit} + enterpriseHasCredits={props.enterpriseHasCredits} + enterpriseRequestAccess={props.enterpriseRequestAccess} + enterpriseAlert={!props.enterpriseHasCredits && !props.enterpriseRequestAccess} + enterpriseEnabled={props.enterpriseEnabled} + isFreeArticle={props.isFreeArticle} + /> <UrlSection {...props} /> </div> diff --git a/components/x-gift-article/src/GiftArticle.jsx b/components/x-gift-article/src/GiftArticle.jsx index f99e10f1e..dbe0f5d83 100644 --- a/components/x-gift-article/src/GiftArticle.jsx +++ b/components/x-gift-article/src/GiftArticle.jsx @@ -150,27 +150,38 @@ const withGiftFormActions = withActions( activate() { return async (state) => { + const { enabled, limit, hasCredits, firstTimeUser, requestAccess } = + await enterpriseApi.getEnterpriseArticleAllowance() + + if (enabled) { + tracking.initEnterpriseSharing( + requestAccess + ? 'enterprise-request-access' + : !hasCredits + ? 'enterprise-no-credits' + : 'enterprise-enabled' + ) + } else { + tracking.initEnterpriseSharing('enterprise-disabled') + } + if (initialProps.isFreeArticle) { const { url, isShortened } = await api.getShorterUrl(state.urls.nonGift) if (isShortened) { - return updaters.setShortenedNonGiftUrl(url)(state) + updaters.setShortenedNonGiftUrl(url)(state) + } + return { + invalidResponseFromApi: true, + enterpriseEnabled: enabled, + enterpriseLimit: limit, + enterpriseHasCredits: hasCredits, + enterpriseFirstTimeUser: firstTimeUser, + enterpriseRequestAccess: requestAccess } } else { const { giftCredits, monthlyAllowance, nextRenewalDate } = await api.getGiftArticleAllowance() - const { enabled, limit, hasCredits, firstTimeUser, requestAccess } = - await enterpriseApi.getEnterpriseArticleAllowance() - if (enabled) { - tracking.initEnterpriseSharing( - requestAccess - ? 'enterprise-request-access' - : !hasCredits - ? 'enterprise-no-credits' - : 'enterprise-enabled' - ) - } else { - tracking.initEnterpriseSharing('enterprise-disabled') - } + // avoid to use giftCredits >= 0 because it returns true when null and "" if (giftCredits > 0 || giftCredits === 0) { return { diff --git a/components/x-gift-article/src/Message.jsx b/components/x-gift-article/src/Message.jsx index 44d1536b9..713e55612 100644 --- a/components/x-gift-article/src/Message.jsx +++ b/components/x-gift-article/src/Message.jsx @@ -50,14 +50,6 @@ export default ({ } } - if (isFreeArticle) { - return ( - <div className="x-gift-article-message"> - This article is currently <strong>free</strong> for anyone to read - </div> - ) - } - if (shareType === ShareType.gift) { if (giftCredits === 0) { return ( @@ -179,6 +171,14 @@ export default ({ } } + if (isFreeArticle) { + return ( + <div className="x-gift-article-message"> + This article is currently <strong>free</strong> for anyone to read + </div> + ) + } + if (shareType === ShareType.nonGift) { return <div className="x-gift-article-message">This link can only be read by existing subscribers</div> } diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index 06efe55dc..259decfb8 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -9,36 +9,29 @@ export default ({ enterpriseEnabled = false, enterpriseLimit = 100, enterpriseRequestAccess = false, - enterpriseAlert = false -}) => ( - <div - className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" - role="group" - aria-labelledby="article-share-options" - > - <span className="x-gift-article--visually-hidden" id="article-share-options"> - Article share options - </span> - - {enterpriseEnabled === true && ( - <label htmlFor="enterpriseLink"> - <input - type="radio" - name="gift-form__radio" - value="enterpriseLink" - id="enterpriseLink" - checked={shareType === ShareType.enterprise} - onChange={showEnterpriseUrlSection} - /> - <span className="o-forms-input__label"> - {enterpriseLimit && !enterpriseRequestAccess - ? `Up to ${enterpriseLimit} recipients` - : `Multiple recipients`} - {enterpriseAlert && <span className="x-gift-article__enterprise-no-credits-icon"></span>} - </span> - </label> - )} + enterpriseAlert = false, + isFreeArticle = false +}) => { + const enterpriseField = () => ( + <label htmlFor="enterpriseLink"> + <input + type="radio" + name="gift-form__radio" + value="enterpriseLink" + id="enterpriseLink" + checked={shareType === ShareType.enterprise} + onChange={showEnterpriseUrlSection} + /> + <span className="o-forms-input__label"> + {enterpriseLimit && !enterpriseRequestAccess + ? `Up to ${enterpriseLimit} recipients` + : `Multiple recipients`} + {enterpriseAlert && <span className="x-gift-article__enterprise-no-credits-icon"></span>} + </span> + </label> + ) + const giftField = () => ( <label htmlFor="giftLink"> <input type="radio" @@ -50,7 +43,9 @@ export default ({ /> <span className="o-forms-input__label">{enterpriseEnabled ? `Single recipient` : `with anyone`}</span> </label> + ) + const nonGiftField = () => ( <label htmlFor="nonGiftLink"> <input type="radio" @@ -62,5 +57,54 @@ export default ({ /> <span className="o-forms-input__label">FT subscribers only</span> </label> - </div> -) + ) + + const freeToReadField = () => ( + <label htmlFor="nonGiftLink"> + <input + type="radio" + name="gift-form__radio" + value="nonGiftLink" + id="nonGiftLink" + checked={shareType === ShareType.nonGift} + onChange={showNonGiftUrlSection} + /> + <span className="o-forms-input__label">with anyone</span> + </label> + ) + + if (isFreeArticle) { + if (enterpriseEnabled) { + return ( + <div + className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" + role="group" + aria-labelledby="article-share-options" + > + <span className="x-gift-article--visually-hidden" id="article-share-options"> + Article share options + </span> + {freeToReadField()} + {enterpriseField()} + </div> + ) + } + + return null + } + + return ( + <div + className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" + role="group" + aria-labelledby="article-share-options" + > + <span className="x-gift-article--visually-hidden" id="article-share-options"> + Article share options + </span> + {enterpriseField()} + {giftField()} + {nonGiftField()} + </div> + ) +} diff --git a/components/x-gift-article/storybook/free-article-with-enterprise-sharing.js b/components/x-gift-article/storybook/free-article-with-enterprise-sharing.js new file mode 100644 index 000000000..7fe5c48c2 --- /dev/null +++ b/components/x-gift-article/storybook/free-article-with-enterprise-sharing.js @@ -0,0 +1,43 @@ +const articleUrl = 'https://www.ft.com/content/blahblahblah' +const nonGiftArticleUrl = `${articleUrl}?shareType=nongift` +const articleUrlRedeemed = 'https://enterprise-sharing.ft.com/gift-url-redeemed' + +exports.args = { + title: 'Share this article (free)', + isRafActive: false, + isFreeArticle: true, + raf: { title: 'Custom title' }, + article: { + title: 'Title Title Title Title', + id: 'base-gift-article-static-id', + url: articleUrl + }, + enterpriseApiBaseUrl: `https://enterprise-sharing-api.ft.com` +} + +// This reference is only required for hot module loading in development +// <https://webpack.js.org/concepts/hot-module-replacement/> +exports.m = module + +exports.fetchMock = (fetchMock) => { + fetchMock + .restore() + .get('/article/gift-credits', { + allowance: 20, + consumedCredits: 5, + remainingCredits: 15, + renewalDate: '2018-08-01T00:00:00Z' + }) + .get(`/article/shorten-url/${encodeURIComponent(nonGiftArticleUrl)}`, { + shortenedUrl: 'https://shortened-non-gift-url' + }) + .get(`https://enterprise-sharing-api.ft.com/v1/users/me/allowance`, { + limit: 120, + hasCredits: true, + firstTimeUser: false + }) + .post(`https://enterprise-sharing-api.ft.com/v1/shares`, { + url: articleUrlRedeemed, + redeemLimit: 120 + }) +} diff --git a/components/x-gift-article/storybook/index.jsx b/components/x-gift-article/storybook/index.jsx index 583b3bd3f..d317f3931 100644 --- a/components/x-gift-article/storybook/index.jsx +++ b/components/x-gift-article/storybook/index.jsx @@ -60,6 +60,20 @@ export const FreeArticle = (args) => { </div> ) } +FreeArticle.storyName = 'Free article' +FreeArticle.args = require('./free-article').args + +export const FreeArticleWithEnterpriseSharing = (args) => { + require('./free-article-with-enterprise-sharing').fetchMock(fetchMock) + return ( + <div className="story-container"> + {dependencies && <BuildService dependencies={dependencies} />} + <GiftArticle {...args} actionsRef={(actions) => actions?.activate()} /> + </div> + ) +} +FreeArticleWithEnterpriseSharing.storyName = 'Free article with enterprise sharing' +FreeArticleWithEnterpriseSharing.args = require('./free-article-with-enterprise-sharing').args export const WithEnterpriseSharing = (args) => { require('./with-enterprise').fetchMock(fetchMock) @@ -121,9 +135,6 @@ export const WithEnterpriseSharingLink = (args) => { WithEnterpriseSharingLink.storyName = 'With enterprise sharing (link generated)' WithEnterpriseSharingLink.args = require('./with-enterprise-sharing-link').args -FreeArticle.storyName = 'Free article' -FreeArticle.args = require('./free-article').args - export const NativeShare = (args) => { require('./native-share').fetchMock(fetchMock) return ( From 27cb6052c64a85a933076ceac2dd2c941220ded6 Mon Sep 17 00:00:00 2001 From: Will Howard <hi@willhoward.co.uk> Date: Wed, 14 Dec 2022 09:26:15 +0000 Subject: [PATCH 5/9] Added button state for free articles with Enterprise Sharing. --- components/x-gift-article/src/Buttons.jsx | 13 ++++++++++++- components/x-gift-article/src/UrlSection.jsx | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/components/x-gift-article/src/Buttons.jsx b/components/x-gift-article/src/Buttons.jsx index aa19ee0a9..52a636f12 100644 --- a/components/x-gift-article/src/Buttons.jsx +++ b/components/x-gift-article/src/Buttons.jsx @@ -8,7 +8,8 @@ export default ({ showCopyButton, nativeShare, actions, - giftCredits + giftCredits, + isFreeArticle }) => { if (isGiftUrlCreated || shareType === ShareType.nonGift) { if (nativeShare) { @@ -62,6 +63,16 @@ export default ({ ) } + if (isFreeArticle && ShareType.enterprise) { + return ( + <div className="x-gift-article__buttons"> + <button className="x-gift-article__button" type="button" onClick={actions.createEnterpriseUrl}> + Create enterprise link + </button> + </div> + ) + } + return ( <div className="x-gift-article__buttons"> <button diff --git a/components/x-gift-article/src/UrlSection.jsx b/components/x-gift-article/src/UrlSection.jsx index 57505005c..4c54d752c 100644 --- a/components/x-gift-article/src/UrlSection.jsx +++ b/components/x-gift-article/src/UrlSection.jsx @@ -74,7 +74,8 @@ export default ({ showCopyButton, nativeShare, actions, - giftCredits + giftCredits, + isFreeArticle }} /> )} From 70f4dad02ec3ba9362fdebb80c1888bffd77ce27 Mon Sep 17 00:00:00 2001 From: Will Howard <hi@willhoward.co.uk> Date: Thu, 15 Dec 2022 11:58:29 +0000 Subject: [PATCH 6/9] Switch contact button to mailto link for out of credit Enterprise Shares. --- components/x-gift-article/src/Message.jsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/x-gift-article/src/Message.jsx b/components/x-gift-article/src/Message.jsx index 713e55612..dcbe7586a 100644 --- a/components/x-gift-article/src/Message.jsx +++ b/components/x-gift-article/src/Message.jsx @@ -153,18 +153,17 @@ export default ({ <div className="x-gift-article-message x-gift-article-message--enterprise"> <h4>Your organisation has run out of share credits.</h4> <p> - Request more credits and our Enterprise team will get in touch with the admin of your FT - subscription to arrange a top-up of sharing credits. + Request more credits and our team will get in touch with the admin of your FT subscription to + arrange a top-up of sharing credits. </p> <a - href="https://enterprise.ft.com/ft-enterprise-sharing-request-access/?segmentId=c87259e0-7073-3ea8-7f83-b988f05c3f94" - target="_blank" + href="mailto:customer.success@ft.com" rel="noreferrer" data-trackable="enterprise-out-of-credits" className="x-gift-article__button" type="button" > - Request more credits + Contact support </a> </div> ) From 0625ea591a8db5da28abaedbe22f25b8b4c66884 Mon Sep 17 00:00:00 2001 From: Will Howard <hi@willhoward.co.uk> Date: Wed, 4 Jan 2023 06:56:51 +0000 Subject: [PATCH 7/9] Corrected button text, reduced code duplication. --- components/x-gift-article/src/Buttons.jsx | 2 +- .../src/RadioButtonsSection.jsx | 57 ++++++++----------- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/components/x-gift-article/src/Buttons.jsx b/components/x-gift-article/src/Buttons.jsx index 52a636f12..f273590ad 100644 --- a/components/x-gift-article/src/Buttons.jsx +++ b/components/x-gift-article/src/Buttons.jsx @@ -67,7 +67,7 @@ export default ({ return ( <div className="x-gift-article__buttons"> <button className="x-gift-article__button" type="button" onClick={actions.createEnterpriseUrl}> - Create enterprise link + Create Enterprise Link </button> </div> ) diff --git a/components/x-gift-article/src/RadioButtonsSection.jsx b/components/x-gift-article/src/RadioButtonsSection.jsx index 259decfb8..256978c92 100644 --- a/components/x-gift-article/src/RadioButtonsSection.jsx +++ b/components/x-gift-article/src/RadioButtonsSection.jsx @@ -73,38 +73,31 @@ export default ({ </label> ) - if (isFreeArticle) { - if (enterpriseEnabled) { - return ( - <div - className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" - role="group" - aria-labelledby="article-share-options" - > - <span className="x-gift-article--visually-hidden" id="article-share-options"> - Article share options - </span> - {freeToReadField()} - {enterpriseField()} - </div> - ) - } - - return null + if (!isFreeArticle || enterpriseEnabled) { + return ( + <div + className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" + role="group" + aria-labelledby="article-share-options" + > + <span className="x-gift-article--visually-hidden" id="article-share-options"> + Article share options + </span> + {isFreeArticle ? ( + <> + {freeToReadField()} + {enterpriseField()} + </> + ) : ( + <> + {enterpriseField()} + {giftField()} + {nonGiftField()} + </> + )} + </div> + ) } - return ( - <div - className="o-forms-input o-forms-input--radio-round o-forms-field x-gift-article__radio_buttons" - role="group" - aria-labelledby="article-share-options" - > - <span className="x-gift-article--visually-hidden" id="article-share-options"> - Article share options - </span> - {enterpriseField()} - {giftField()} - {nonGiftField()} - </div> - ) + return null } From 873dd6f241f05319f1573bf6b36e1959ace4c4f3 Mon Sep 17 00:00:00 2001 From: Will Howard <hi@willhoward.co.uk> Date: Wed, 4 Jan 2023 07:27:02 +0000 Subject: [PATCH 8/9] Corrected minor styling bugs in Enterprise Sharing gift article elements. --- components/x-gift-article/src/GiftArticle.scss | 2 +- components/x-gift-article/src/Message.jsx | 1 + components/x-gift-article/src/Message.scss | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/x-gift-article/src/GiftArticle.scss b/components/x-gift-article/src/GiftArticle.scss index 249776728..63206aac1 100644 --- a/components/x-gift-article/src/GiftArticle.scss +++ b/components/x-gift-article/src/GiftArticle.scss @@ -54,7 +54,7 @@ @include oIconsContent($icon-name: 'warning', $color: oColorsByName('crimson'), $size: 16); border-radius: 50%; border: 2px solid oColorsByName('crimson'); - margin-bottom: -5px; + margin: 0 0 -5px 5px; } @media only screen and (min-width: 600px) { diff --git a/components/x-gift-article/src/Message.jsx b/components/x-gift-article/src/Message.jsx index dcbe7586a..dcfb1cc1c 100644 --- a/components/x-gift-article/src/Message.jsx +++ b/components/x-gift-article/src/Message.jsx @@ -118,6 +118,7 @@ export default ({ <br /> <br /> <a + className="x-gift-article-message--link" href="https://enterprise-sharing-dashboard.ft.com" target="_blank" rel="noreferrer" diff --git a/components/x-gift-article/src/Message.scss b/components/x-gift-article/src/Message.scss index 1b16133a4..d74354dd3 100644 --- a/components/x-gift-article/src/Message.scss +++ b/components/x-gift-article/src/Message.scss @@ -4,10 +4,10 @@ grid-area: message; font-size: 16px; margin-top: oSpacingByName('s3'); +} - a { - color: oColorsByName('teal'); - } +.x-gift-article-message--link { + color: oColorsByName('teal'); } .x-gift-article-message--enterprise { From b84aa20c042cd94d24f047a001122508acf0f258 Mon Sep 17 00:00:00 2001 From: Will Howard <hi@willhoward.co.uk> Date: Fri, 6 Jan 2023 09:12:14 +0000 Subject: [PATCH 9/9] Combined enterprise gift article state to reduce duplication. --- components/x-gift-article/src/GiftArticle.jsx | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/components/x-gift-article/src/GiftArticle.jsx b/components/x-gift-article/src/GiftArticle.jsx index dbe0f5d83..2f4626d1f 100644 --- a/components/x-gift-article/src/GiftArticle.jsx +++ b/components/x-gift-article/src/GiftArticle.jsx @@ -153,6 +153,13 @@ const withGiftFormActions = withActions( const { enabled, limit, hasCredits, firstTimeUser, requestAccess } = await enterpriseApi.getEnterpriseArticleAllowance() + const enterpriseState = { + enterpriseLimit: limit, + enterpriseHasCredits: hasCredits, + enterpriseFirstTimeUser: firstTimeUser, + enterpriseRequestAccess: requestAccess + } + if (enabled) { tracking.initEnterpriseSharing( requestAccess @@ -174,10 +181,7 @@ const withGiftFormActions = withActions( return { invalidResponseFromApi: true, enterpriseEnabled: enabled, - enterpriseLimit: limit, - enterpriseHasCredits: hasCredits, - enterpriseFirstTimeUser: firstTimeUser, - enterpriseRequestAccess: requestAccess + ...enterpriseState } } else { const { giftCredits, monthlyAllowance, nextRenewalDate } = await api.getGiftArticleAllowance() @@ -188,19 +192,13 @@ const withGiftFormActions = withActions( ...updaters.setAllowance(giftCredits, monthlyAllowance, nextRenewalDate), shareType: enabled && hasCredits ? ShareType.enterprise : ShareType.gift, enterpriseEnabled: enabled, - enterpriseLimit: limit, - enterpriseHasCredits: hasCredits, - enterpriseFirstTimeUser: firstTimeUser, - enterpriseRequestAccess: requestAccess + ...enterpriseState } } else { return { invalidResponseFromApi: true, enterpriseEnabled: enabled, - enterpriseLimit: limit, - enterpriseHasCredits: hasCredits, - enterpriseFirstTimeUser: firstTimeUser, - enterpriseRequestAccess: requestAccess + ...enterpriseState } } }