Skip to content

Commit fca6935

Browse files
authored
feat: add conditional and logic to show new upgrade copy (#2779)
* feat: add conditional and logic to show new upgrade copy * fix: update format * fix: fix optional type
1 parent 708cdb9 commit fca6935

5 files changed

Lines changed: 81 additions & 16 deletions

File tree

i18n/en-US.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,8 @@ boxui.timeInput.invalidTimeError = Invalid time format. Enter a time in the form
14721472
boxui.unifiedShare.collaboration.groupCollabText = Group
14731473
# Text to display for individual users who have accepted an invitation to collaborate
14741474
boxui.unifiedShare.collaboration.userCollabText = User
1475+
# Label for link to learn more about collaborator access
1476+
boxui.unifiedShare.collaboratorAccessLink = collaborator access
14751477
# Title for collaborator list modal
14761478
boxui.unifiedShare.collaboratorListTitle = People in ‘{itemName}’
14771479
# This string is displayed as tooltip on hovering over expire icon for collab
@@ -1632,10 +1634,14 @@ boxui.unifiedShare.sharedLinkSettings = Link Settings
16321634
boxui.unifiedShare.sharedLinkSettingsCalloutText = Create a custom URL, enable password protection, enable link expiration, and much more
16331635
# Title for suggested collaborators that can be added to the form
16341636
boxui.unifiedShare.suggestedCollabsTitle = Suggested
1637+
# Description for cta to upgrade to get collaborator access controls
1638+
boxui.unifiedShare.upgradeCollaboratorAccessDescription = Set the level of {collaboratorAccessLink} and increase security through one of our paid plans. {upgradeGetMoreAccessControlsLink}.
16351639
# Description for cta to upgrade to get more access controls for inviting collaborators to an item
16361640
boxui.unifiedShare.upgradeGetMoreAccessControlsDescription = 62% of customers on your plan {upgradeGetMoreAccessControlsLink} to manage collaborators’ access and permission settings
16371641
# Label for link to upgrade to get more access controls for inviting collaborators to an item
16381642
boxui.unifiedShare.upgradeGetMoreAccessControlsLink = upgrade
1643+
# Label for link to upgrade account
1644+
boxui.unifiedShare.upgradeLink = Upgrade now
16391645
# Text used in button label to describe permission level - uploader
16401646
boxui.unifiedShare.uploaderLevelButtonLabel = Invite as Uploader
16411647
# Description for Uploader permission level in invitee permission dropdown

src/features/unified-share-modal/UnifiedShareForm.js

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -540,28 +540,55 @@ class UnifiedShareForm extends React.Component<USFProps, State> {
540540
}
541541

542542
renderUpgradeLinkDescription() {
543-
const { openUpgradePlanModal = () => {}, trackingProps = {} } = this.props;
543+
const { openUpgradePlanModal = () => {}, showNewUpgradeText = false, trackingProps = {} } = this.props;
544544
const { inviteCollabsEmailTracking = {} } = trackingProps;
545545
const { upgradeLinkProps = {} } = inviteCollabsEmailTracking;
546546

547547
return (
548548
<div className="upgrade-description">
549549
<UpgradeBadge />
550-
<FormattedMessage
551-
values={{
552-
upgradeGetMoreAccessControlsLink: (
553-
<PlainButton
554-
className="upgrade-link"
555-
onClick={openUpgradePlanModal}
556-
type="button"
557-
{...upgradeLinkProps}
558-
>
559-
<FormattedMessage {...messages.upgradeGetMoreAccessControlsLink} />
560-
</PlainButton>
561-
),
562-
}}
563-
{...messages.upgradeGetMoreAccessControlsDescription}
564-
/>
550+
{showNewUpgradeText ? (
551+
<FormattedMessage
552+
values={{
553+
upgradeGetMoreAccessControlsLink: (
554+
<PlainButton
555+
className="upgrade-link"
556+
data-resin-target="external_collab_newcopy_upgrade_cta"
557+
onClick={openUpgradePlanModal}
558+
type="button"
559+
>
560+
<FormattedMessage {...messages.upgradeLink} />
561+
</PlainButton>
562+
),
563+
collaboratorAccessLink: (
564+
<Link
565+
className="upgrade-link"
566+
href="https://support.box.com/hc/en-us/articles/360044196413-Understanding-Collaborator-Permission-Levels"
567+
target="_blank"
568+
>
569+
<FormattedMessage {...messages.collaboratorAccessLink} />
570+
</Link>
571+
),
572+
}}
573+
{...messages.upgradeCollaboratorAccessDescription}
574+
/>
575+
) : (
576+
<FormattedMessage
577+
values={{
578+
upgradeGetMoreAccessControlsLink: (
579+
<PlainButton
580+
className="upgrade-link"
581+
onClick={openUpgradePlanModal}
582+
type="button"
583+
{...upgradeLinkProps}
584+
>
585+
<FormattedMessage {...messages.upgradeGetMoreAccessControlsLink} />
586+
</PlainButton>
587+
),
588+
}}
589+
{...messages.upgradeGetMoreAccessControlsDescription}
590+
/>
591+
)}
565592
</div>
566593
);
567594
}

src/features/unified-share-modal/__tests__/UnifiedShareForm.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import * as React from 'react';
22

33
import { ITEM_TYPE_WEBLINK, ITEM_TYPE_FOLDER } from '../../../common/constants';
4+
import messages from '../messages';
5+
46
import { JUSTIFICATION_CHECKPOINT_EXTERNAL_COLLAB } from '../constants';
57

68
import { UnifiedShareFormBase as UnifiedShareForm } from '../UnifiedShareForm';
@@ -214,6 +216,18 @@ describe('features/unified-share-modal/UnifiedShareForm', () => {
214216
expect(wrapper.exists('UpgradeBadge')).toBe(true);
215217
});
216218

219+
test('should render correct copy of upgrade CTA when showUpgradeOptions and showNewUpgradeText is enabled', () => {
220+
const wrapper = getWrapper({
221+
canInvite: true,
222+
isFetching: false,
223+
showNewUpgradeText: true,
224+
showUpgradeOptions: true,
225+
});
226+
expect(wrapper.exists('UpgradeBadge')).toBe(true);
227+
const msg = wrapper.find('FormattedMessage');
228+
expect(msg.prop('id')).toEqual(messages.upgradeCollaboratorAccessDescription.id);
229+
});
230+
217231
test('should render a default component with correct Focus element and props when focusSharedLinkOnLoad is enabled', () => {
218232
const wrapper = getWrapper({
219233
focusSharedLinkOnLoad: true,

src/features/unified-share-modal/flowTypes.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@ export type USFProps = BaseUnifiedShareProps & {
393393
sharedLinkLoaded: boolean,
394394
/** Whether the FTUX tooltip should be rendered */
395395
shouldRenderFTUXTooltip: boolean,
396+
/** Whether the new upgrade text should be rendered */
397+
showNewUpgradeText?: boolean,
396398
};
397399

398400
export type InviteCollaboratorsRequest = {

src/features/unified-share-modal/messages.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,22 @@ const messages = defineMessages({
274274
description: 'Label for link to upgrade to get more access controls for inviting collaborators to an item',
275275
id: 'boxui.unifiedShare.upgradeGetMoreAccessControlsLink',
276276
},
277+
upgradeCollaboratorAccessDescription: {
278+
defaultMessage:
279+
'Set the level of {collaboratorAccessLink} and increase security through one of our paid plans. {upgradeGetMoreAccessControlsLink}.',
280+
description: 'Description for cta to upgrade to get collaborator access controls',
281+
id: 'boxui.unifiedShare.upgradeCollaboratorAccessDescription',
282+
},
283+
upgradeLink: {
284+
defaultMessage: 'Upgrade now',
285+
description: 'Label for link to upgrade account',
286+
id: 'boxui.unifiedShare.upgradeLink',
287+
},
288+
collaboratorAccessLink: {
289+
defaultMessage: 'collaborator access',
290+
description: 'Label for link to learn more about collaborator access',
291+
id: 'boxui.unifiedShare.collaboratorAccessLink',
292+
},
277293
sharedLinkSettings: {
278294
defaultMessage: 'Link Settings',
279295
description: 'Description of the shared link settings modal entry point. This shows link-specific options.',

0 commit comments

Comments
 (0)