@box/unified-share-modal 3.2.2 → 3.2.4
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/chunks/otp-section.js +1 -0
- package/dist/chunks/types.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/components/shared-link-settings-modal/messages.js +1 -1
- package/dist/esm/lib/components/shared-link-settings-modal/otp-section.js +1 -0
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +1 -1
- package/dist/esm/lib/contexts/shared-link-settings-context.js +1 -1
- package/dist/esm/lib/utils/form.js +1 -1
- package/dist/styles/otp-section.css +1 -0
- package/dist/types/lib/components/shared-link-settings-modal/messages.d.ts +40 -0
- package/dist/types/lib/components/shared-link-settings-modal/otp-section.d.ts +13 -0
- package/dist/types/lib/types.d.ts +49 -0
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as OtpMode}from"./types.js";import messages from"../esm/lib/components/shared-link-settings-modal/messages.js";import{useIntl}from"react-intl";import{Button,Radio,Switch,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import '../styles/otp-section.css';var otp_section_module_default={otpToggleRow:`_otpToggleRow_1eiby_1`,recommendedBadge:`_recommendedBadge_1eiby_7`,countBadge:`_countBadge_1eiby_8`,modeSelector:`_modeSelector_1eiby_26`,allowlistRow:`_allowlistRow_1eiby_33`};function OtpSection({allowlistItemCount,canChange,isAvailable,isChecked,isDisabled,onConfigureAllowlist,onModeChange,onToggle,otpMode}){let{formatMessage}=useIntl();if(!isAvailable)return null;let controlsDisabled=isDisabled||!canChange;return jsxs(Fragment,{children:[jsxs(`div`,{className:otp_section_module_default.otpToggleRow,children:[jsx(Switch.Item,{checked:isChecked,disabled:controlsDisabled,label:formatMessage(messages.otpToggleText),onCheckedChange:onToggle,value:`otp-settings`}),!controlsDisabled&&jsx(Text,{as:`span`,className:otp_section_module_default.recommendedBadge,color:`textOnLightDefault`,variant:`captionBold`,children:formatMessage(messages.otpRecommendedBadge)})]}),isChecked&&jsxs(`div`,{className:otp_section_module_default.modeSelector,children:[jsx(Radio.Legend,{header:formatMessage(messages.otpModeSelectorLegend),children:jsxs(Radio.Group,{disabled:controlsDisabled,onValueChange:value=>onModeChange(value),value:otpMode,children:[jsx(Radio.Item,{label:formatMessage(messages.otpModeOpenLabel),value:OtpMode.OPEN}),jsx(Radio.Item,{label:formatMessage(messages.otpModeAllowlistLabel),value:OtpMode.ALLOWLIST})]})}),otpMode===OtpMode.ALLOWLIST&&jsxs(`div`,{className:otp_section_module_default.allowlistRow,children:[jsx(Button,{disabled:controlsDisabled||!onConfigureAllowlist,onClick:onConfigureAllowlist,size:`small`,variant:`secondary`,children:formatMessage(messages.otpConfigureButton)}),allowlistItemCount>0&&jsxs(Fragment,{children:[jsx(Text,{as:`span`,color:`textOnLightSecondary`,variant:`bodyDefault`,children:formatMessage(messages.otpAllowlistedLabel)}),jsx(Text,{as:`span`,className:otp_section_module_default.countBadge,color:`textOnLightDefault`,variant:`captionBold`,children:formatMessage(messages.otpAllowlistCountBadge,{count:allowlistItemCount})})]})]})]})]})}export{OtpSection as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var OtpMode={ALLOWLIST:`allowlist`,NONE:`none`,OPEN:`open`};export{OtpMode as t};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnifiedShareModal}from"./lib/unified-share-modal.js";export{UnifiedShareModal};
|
|
1
|
+
import{t as OtpMode}from"../chunks/types.js";import{UnifiedShareModal}from"./lib/unified-share-modal.js";export{OtpMode,UnifiedShareModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineMessages}from"react-intl";var messages=defineMessages({title:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.title`,defaultMessage:`Shared Link Settings`},subtitleCompanyDownload:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCompanyDownload`,defaultMessage:`This content is available to anyone within your company with the link, and can be viewed or downloaded. {learnSharedLinkSettingsLink}`},subtitleCompanyView:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCompanyView`,defaultMessage:`This content is available to anyone within your company with the link, and can be viewed. {learnSharedLinkSettingsLink}`},subtitleOpenDownload:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleOpenDownload`,defaultMessage:`This content is publicly available to anyone with the link, and can be viewed or downloaded. {learnSharedLinkSettingsLink}`},subtitleOpenView:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleOpenView`,defaultMessage:`This content is publicly available to anyone with the link, and can be viewed. {learnSharedLinkSettingsLink}`},subtitleCollaborators:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCollaborators`,defaultMessage:`This content is available to invited collaborators with the link. {learnSharedLinkSettingsLink}`},cancelButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.cancelButton`,defaultMessage:`Cancel`},closeButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.closeButton`,defaultMessage:`Close`},loadingLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.loadingLabel`,defaultMessage:`Loading`},saveButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.saveButton`,defaultMessage:`Save`},learnSharedLinkSettingsLink:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink`,defaultMessage:`Learn more about shared link settings.`},linkExpirationCalendarAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationCalendarAriaLabel`,defaultMessage:`Select an expiration date`},linkExpirationClearDatePickerAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationClearDatePickerAriaLabel`,defaultMessage:`Clear date picker`},linkExpirationNextMonthAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationNextMonthAriaLabel`,defaultMessage:`Switch to next month`},linkExpirationOpenCalendarDropdownAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationOpenCalendarDropdownAriaLabel`,defaultMessage:`Open calendar`},linkExpirationPreviousMonthAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationPreviousMonthAriaLabel`,defaultMessage:`Switch to previous month`},linkExpirationDatePickerLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationDatePickerLabel`,defaultMessage:`Expiration date`},linkExpirationToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationToggleText`,defaultMessage:`Link expiration`},vanityNameToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameToggleText`,defaultMessage:`Publish content broadly with a custom, non-private URL`},warningNoticeIconAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.warningNoticeIconAriaLabel`,defaultMessage:`Warning`},vanityDomainSettingsWarningText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityDomainSettingsWarningText`,defaultMessage:`Custom URLs should not be used when sharing sensitive content.`},vanityNameInputLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameInputLabel`,defaultMessage:`Custom path`},vanityNameInputPlaceholder:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameInputPlaceholder`,defaultMessage:`Enter a custom path (12 or more characters)`},downloadSettingsToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText`,defaultMessage:`Allow users with the shared link to download this item`},directLinkLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel`,defaultMessage:`Direct link`},directLinkBlockedByMaliciousContent:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByMaliciousContent`,defaultMessage:`Download for this content has been disabled due to a security policy.`},directLinkBlockedByAccessPolicyWithClassification:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByAccessPolicyWithClassification`,defaultMessage:`Download has been disabled for content due to the classification.`},directLinkBlockedByAccessPolicyWithoutClassification:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByAccessPolicyWithoutClassification`,defaultMessage:`Download has been disabled for content without classification.`},passwordToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordToggleText`,defaultMessage:`Password protection`},passwordInputPlaceholder:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordInputPlaceholder`,defaultMessage:`Enter a password`},passwordWarningText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordWarningText`,defaultMessage:`Passwords must include at least 8 characters, and must contain at least one upper case letter, number, or special character.`},showPasswordAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.showPasswordAriaLabel`,defaultMessage:`Show password`},hidePasswordAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel`,defaultMessage:`Hide password`},inaccessibleSettingsNotice:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice`,defaultMessage:`Certain settings may not be available for this item due to permissions.`}});export{messages as default};
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({title:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.title`,defaultMessage:`Shared Link Settings`},subtitleCompanyDownload:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCompanyDownload`,defaultMessage:`This content is available to anyone within your company with the link, and can be viewed or downloaded. {learnSharedLinkSettingsLink}`},subtitleCompanyView:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCompanyView`,defaultMessage:`This content is available to anyone within your company with the link, and can be viewed. {learnSharedLinkSettingsLink}`},subtitleOpenDownload:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleOpenDownload`,defaultMessage:`This content is publicly available to anyone with the link, and can be viewed or downloaded. {learnSharedLinkSettingsLink}`},subtitleOpenView:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleOpenView`,defaultMessage:`This content is publicly available to anyone with the link, and can be viewed. {learnSharedLinkSettingsLink}`},subtitleCollaborators:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.subtitleCollaborators`,defaultMessage:`This content is available to invited collaborators with the link. {learnSharedLinkSettingsLink}`},cancelButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.cancelButton`,defaultMessage:`Cancel`},closeButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.closeButton`,defaultMessage:`Close`},loadingLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.loadingLabel`,defaultMessage:`Loading`},saveButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.saveButton`,defaultMessage:`Save`},learnSharedLinkSettingsLink:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.learnSharedLinkSettingsLink`,defaultMessage:`Learn more about shared link settings.`},linkExpirationCalendarAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationCalendarAriaLabel`,defaultMessage:`Select an expiration date`},linkExpirationClearDatePickerAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationClearDatePickerAriaLabel`,defaultMessage:`Clear date picker`},linkExpirationNextMonthAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationNextMonthAriaLabel`,defaultMessage:`Switch to next month`},linkExpirationOpenCalendarDropdownAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationOpenCalendarDropdownAriaLabel`,defaultMessage:`Open calendar`},linkExpirationPreviousMonthAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationPreviousMonthAriaLabel`,defaultMessage:`Switch to previous month`},linkExpirationDatePickerLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationDatePickerLabel`,defaultMessage:`Expiration date`},linkExpirationToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.linkExpirationToggleText`,defaultMessage:`Link expiration`},vanityNameToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameToggleText`,defaultMessage:`Publish content broadly with a custom, non-private URL`},warningNoticeIconAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.warningNoticeIconAriaLabel`,defaultMessage:`Warning`},vanityDomainSettingsWarningText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityDomainSettingsWarningText`,defaultMessage:`Custom URLs should not be used when sharing sensitive content.`},vanityNameInputLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameInputLabel`,defaultMessage:`Custom path`},vanityNameInputPlaceholder:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.vanityNameInputPlaceholder`,defaultMessage:`Enter a custom path (12 or more characters)`},downloadSettingsToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.downloadSettingsToggleText`,defaultMessage:`Allow users with the shared link to download this item`},directLinkLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkLabel`,defaultMessage:`Direct link`},directLinkBlockedByMaliciousContent:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByMaliciousContent`,defaultMessage:`Download for this content has been disabled due to a security policy.`},directLinkBlockedByAccessPolicyWithClassification:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByAccessPolicyWithClassification`,defaultMessage:`Download has been disabled for content due to the classification.`},directLinkBlockedByAccessPolicyWithoutClassification:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.directLinkBlockedByAccessPolicyWithoutClassification`,defaultMessage:`Download has been disabled for content without classification.`},passwordToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordToggleText`,defaultMessage:`Password protection`},passwordInputPlaceholder:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordInputPlaceholder`,defaultMessage:`Enter a password`},passwordWarningText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.passwordWarningText`,defaultMessage:`Passwords must include at least 8 characters, and must contain at least one upper case letter, number, or special character.`},showPasswordAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.showPasswordAriaLabel`,defaultMessage:`Show password`},hidePasswordAriaLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.hidePasswordAriaLabel`,defaultMessage:`Hide password`},inaccessibleSettingsNotice:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.inaccessibleSettingsNotice`,defaultMessage:`Certain settings may not be available for this item due to permissions.`},otpToggleText:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpToggleText`,defaultMessage:`One-Time Passcode protection`},otpRecommendedBadge:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpRecommendedBadge`,defaultMessage:`Recommended`},otpModeSelectorLegend:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpModeSelectorLegend`,defaultMessage:`After verification, allow access to:`},otpModeOpenLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpModeOpenLabel`,defaultMessage:`Anyone with an email`},otpModeAllowlistLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpModeAllowlistLabel`,defaultMessage:`Only people added to the link's allowlist`},otpConfigureButton:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpConfigureButton`,defaultMessage:`Configure`},otpAllowlistedLabel:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpAllowlistedLabel`,defaultMessage:`Allowlisted`},otpAllowlistCountBadge:{id:`groupSharedFeatures.usm.sharedLinkSettingsModal.otpAllowlistCountBadge`,defaultMessage:`+{count, plural, one {# ITEM} other {# ITEMS}}`}});export{messages as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as OtpSection}from"../../../../chunks/otp-section.js";export{OtpSection};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useUnifiedShareModalContext}from"../../contexts/unified-share-modal-context.js";import{useAccessLevels}from"../../hooks/use-access-levels.js";import{useSharedLinkSettingsContext}from"../../contexts/shared-link-settings-context.js";import messages from"./messages.js";import{DownloadSection}from"./download-section.js";import{ExpirationSection}from"./expiration-section.js";import{PasswordSection}from"./password-section.js";import{VanitySection}from"./vanity-section.js";import{useMemo}from"react";import{useIntl}from"react-intl";import{InlineNotice,Link,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function SharedLinkSettings(){let{formatMessage}=useIntl(),{isSubmitting,sharedLink}=useUnifiedShareModalContext(),{settings={},vanityDomain=``}=sharedLink,{canChangeDownload,canChangeExpiration,canChangePassword,canChangeVanityName,isDownloadAvailable,isPasswordAvailable,isVanityNameAvailable}=settings,{selectedAccess}=useAccessLevels(),{errors,formData,initialFormData,setFieldError,setFieldValue,validatePassword}=useSharedLinkSettingsContext(),accessNoticeMessage=useMemo(()=>{if(!selectedAccess)return null;switch(selectedAccess.id){case`collaborators`:return messages.subtitleCollaborators;case`open`:return formData.isDownloadEnabled?messages.subtitleOpenDownload:messages.subtitleOpenView;case`company`:return formData.isDownloadEnabled?messages.subtitleCompanyDownload:messages.subtitleCompanyView;default:return null}},[formData.isDownloadEnabled,selectedAccess])
|
|
1
|
+
import{t as OtpMode}from"../../../../chunks/types.js";import{useUnifiedShareModalContext}from"../../contexts/unified-share-modal-context.js";import{useAccessLevels}from"../../hooks/use-access-levels.js";import{useSharedLinkSettingsContext}from"../../contexts/shared-link-settings-context.js";import messages from"./messages.js";import{DownloadSection}from"./download-section.js";import{ExpirationSection}from"./expiration-section.js";import{t as OtpSection}from"../../../../chunks/otp-section.js";import{PasswordSection}from"./password-section.js";import{VanitySection}from"./vanity-section.js";import{useMemo}from"react";import{useIntl}from"react-intl";import{InlineNotice,Link,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function SharedLinkSettings(){let{formatMessage}=useIntl(),{eventService,isSubmitting,sharedLink}=useUnifiedShareModalContext(),{settings={},vanityDomain=``}=sharedLink,{canChangeDownload,canChangeExpiration,canChangeOtp,canChangePassword,canChangeVanityName,isDownloadAvailable,isOtpAvailable,isPasswordAvailable,isVanityNameAvailable,otpAllowlistItemCount=0}=settings,{selectedAccess}=useAccessLevels(),{errors,formData,initialFormData,setFieldError,setFieldValue,validatePassword}=useSharedLinkSettingsContext(),accessNoticeMessage=useMemo(()=>{if(!selectedAccess)return null;switch(selectedAccess.id){case`collaborators`:return messages.subtitleCollaborators;case`open`:return formData.isDownloadEnabled?messages.subtitleOpenDownload:messages.subtitleOpenView;case`company`:return formData.isDownloadEnabled?messages.subtitleCompanyDownload:messages.subtitleCompanyView;default:return null}},[formData.isDownloadEnabled,selectedAccess]),handleExpirationToggle=nextChecked=>{setFieldError(`expiration`,void 0),setFieldValue(`isExpirationEnabled`,nextChecked)},handleExpirationChange=value=>{setFieldError(`expiration`,void 0),setFieldValue(`expiration`,value)},handleVanityToggle=nextChecked=>{setFieldError(`vanityName`,void 0),setFieldValue(`isVanityNameEnabled`,nextChecked)},handleVanityNameChange=event=>{setFieldError(`vanityName`,void 0),setFieldValue(`vanityName`,event.target.value)},isOtpSectionVisible=!!isOtpAvailable&&selectedAccess?.id===`open`,isPasswordSectionVisible=!!isPasswordAvailable&&selectedAccess?.id===`open`,canTogglePassword=!!canChangePassword&&!(formData.isOtpEnabled&&!canChangeOtp),canToggleOtp=!!canChangeOtp&&!(formData.isPasswordEnabled&&!canChangePassword),handlePasswordToggle=nextChecked=>{setFieldError(`password`,void 0),setFieldValue(`isPasswordEnabled`,nextChecked),nextChecked&&isOtpSectionVisible&&canChangeOtp&&setFieldValue(`isOtpEnabled`,!1)},handleOtpToggle=nextChecked=>{setFieldValue(`isOtpEnabled`,nextChecked),nextChecked&&formData.otpMode===OtpMode.NONE&&setFieldValue(`otpMode`,OtpMode.OPEN),nextChecked&&isPasswordSectionVisible&&canChangePassword&&(setFieldValue(`isPasswordEnabled`,!1),setFieldValue(`password`,``),setFieldError(`password`,void 0))},handleOtpModeChange=mode=>{setFieldValue(`otpMode`,mode)},handlePasswordChange=event=>{setFieldError(`password`,void 0),setFieldValue(`password`,event.target.value)},handleDownloadToggle=nextChecked=>{setFieldValue(`isDownloadEnabled`,nextChecked)},handlePasswordBlur=event=>{let isSubmitFocused=document.getElementById(`usm-SharedLinkSettingsModal-primaryButton`)?.contains(event.relatedTarget);initialFormData.isPasswordEnabled&&!formData.password||isSubmitFocused||validatePassword(formData.password)},canChangeAllSettings=canChangeDownload&&canChangeExpiration&&(!isOtpSectionVisible||canChangeOtp)&&(!isPasswordSectionVisible||canChangePassword)&&canChangeVanityName,passwordSection=jsx(PasswordSection,{canChange:canTogglePassword,error:errors.password,isAvailable:isPasswordSectionVisible,isChecked:formData.isPasswordEnabled,isDefaultChecked:initialFormData.isPasswordEnabled,isDisabled:isSubmitting,onBlur:handlePasswordBlur,onChange:handlePasswordChange,onFocus:()=>setFieldError(`password`,void 0),onToggle:handlePasswordToggle,password:formData.password});return jsxs(Fragment,{children:[!canChangeAllSettings&&jsx(InlineNotice,{variant:`warning`,variantIconAriaLabel:formatMessage(messages.warningNoticeIconAriaLabel),children:formatMessage(messages.inaccessibleSettingsNotice)}),accessNoticeMessage&&jsx(Text,{as:`p`,color:`textOnLightSecondary`,children:formatMessage(accessNoticeMessage,{learnSharedLinkSettingsLink:jsx(Link,{href:`https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings`,rel:`noreferrer`,target:`_blank`,children:formatMessage(messages.learnSharedLinkSettingsLink)})})}),jsx(ExpirationSection,{canChange:!!canChangeExpiration,error:errors.expiration,expiration:formData.expiration,isChecked:formData.isExpirationEnabled,isDisabled:isSubmitting,onChange:handleExpirationChange,onToggle:handleExpirationToggle}),jsx(OtpSection,{allowlistItemCount:otpAllowlistItemCount,canChange:canToggleOtp,isAvailable:isOtpSectionVisible,isChecked:formData.isOtpEnabled,isDisabled:isSubmitting,onConfigureAllowlist:eventService.onOtpAllowlistConfigure,onModeChange:handleOtpModeChange,onToggle:handleOtpToggle,otpMode:formData.otpMode}),!isOtpAvailable&&passwordSection,jsx(VanitySection,{canChange:!!canChangeVanityName,error:errors.vanityName,isAvailable:!!isVanityNameAvailable,isChecked:formData.isVanityNameEnabled,isDisabled:isSubmitting,onChange:handleVanityNameChange,onToggle:handleVanityToggle,vanityDomain,vanityName:formData.vanityName}),jsx(DownloadSection,{canChange:!!canChangeDownload,isAvailable:!!isDownloadAvailable,isChecked:formData.isDownloadEnabled,isDisabled:isSubmitting,onToggle:handleDownloadToggle}),isOtpAvailable&&passwordSection]})}export{SharedLinkSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useUnifiedShareModalContext}from"./unified-share-modal-context.js";import{formatDateFromTimestampToCalendarDate}from"../utils/date.js";import{useLinkSettingsForm}from"../hooks/use-link-settings-form.js";import{createContext,useContext,useMemo,useState}from"react";import{jsx}from"react/jsx-runtime";var SharedLinkSettingsContext=createContext(null),useSharedLinkSettingsContext=()=>{let context=useContext(SharedLinkSettingsContext);if(!context)throw Error(`useSharedLinkSettingsContext must be used with SharedLinkSettingsProvider`);return context},SharedLinkSettingsProvider=({children})=>{let{sharedLink}=useUnifiedShareModalContext(),{expiresAt=0,settings={},vanityName=``}=sharedLink,{isDownloadEnabled,isPasswordEnabled}=settings,[containerRef,setContainerRef]=useState(null),initialFormData=useMemo(()=>
|
|
1
|
+
import{t as OtpMode}from"../../../chunks/types.js";import{useUnifiedShareModalContext}from"./unified-share-modal-context.js";import{formatDateFromTimestampToCalendarDate}from"../utils/date.js";import{useLinkSettingsForm}from"../hooks/use-link-settings-form.js";import{createContext,useContext,useMemo,useState}from"react";import{jsx}from"react/jsx-runtime";var SharedLinkSettingsContext=createContext(null),useSharedLinkSettingsContext=()=>{let context=useContext(SharedLinkSettingsContext);if(!context)throw Error(`useSharedLinkSettingsContext must be used with SharedLinkSettingsProvider`);return context},SharedLinkSettingsProvider=({children})=>{let{sharedLink}=useUnifiedShareModalContext(),{expiresAt=0,settings={},vanityName=``}=sharedLink,{isDownloadEnabled,isPasswordEnabled,otpMode}=settings,[containerRef,setContainerRef]=useState(null),initialFormData=useMemo(()=>{let isOtpEnabled=!!otpMode&&otpMode!==OtpMode.NONE;return{expiration:expiresAt?formatDateFromTimestampToCalendarDate(expiresAt):null,isDownloadEnabled:!!isDownloadEnabled,isExpirationEnabled:!!expiresAt,isOtpEnabled,isPasswordEnabled:!!isPasswordEnabled,isVanityNameEnabled:!!vanityName,otpMode:otpMode??OtpMode.NONE,password:``,vanityName}},[expiresAt,isDownloadEnabled,isPasswordEnabled,otpMode,vanityName]),{errors,formData,handleFormReset,handleFormSubmit,setFieldError,setFieldValue,validatePassword}=useLinkSettingsForm(initialFormData),contextValue=useMemo(()=>({containerRef,errors,formData,initialFormData,resetForm:handleFormReset,setContainerRef,setFieldError,setFieldValue,submitForm:handleFormSubmit,validatePassword}),[containerRef,errors,formData,handleFormReset,handleFormSubmit,initialFormData,setFieldError,setFieldValue,validatePassword]);return jsx(SharedLinkSettingsContext.Provider,{value:contextValue,children})};export{SharedLinkSettingsContext,SharedLinkSettingsProvider,useSharedLinkSettingsContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var getUpdatedLinkSettingsFormData=(nextData,prevData)=>{let{expiration,isDownloadEnabled,isExpirationEnabled,isPasswordEnabled,isVanityNameEnabled,password,vanityName}=nextData,updatedData={};return isDownloadEnabled!==prevData.isDownloadEnabled&&(updatedData.isDownloadEnabled=isDownloadEnabled),(isExpirationEnabled!==prevData.isExpirationEnabled||expiration?.toString()!==prevData.expiration?.toString())&&(updatedData.isExpirationEnabled=isExpirationEnabled,updatedData.expiration=isExpirationEnabled?expiration:null),(isPasswordEnabled!==prevData.isPasswordEnabled||password!==prevData.password)&&(updatedData.isPasswordEnabled=isPasswordEnabled,updatedData.password=isPasswordEnabled?password:null),(isVanityNameEnabled!==prevData.isVanityNameEnabled||vanityName!==prevData.vanityName)&&(updatedData.isVanityNameEnabled=isVanityNameEnabled,updatedData.vanityName=isVanityNameEnabled?vanityName:null),updatedData};export{getUpdatedLinkSettingsFormData};
|
|
1
|
+
import{t as OtpMode}from"../../../chunks/types.js";var getUpdatedLinkSettingsFormData=(nextData,prevData)=>{let{expiration,isDownloadEnabled,isExpirationEnabled,isOtpEnabled,isPasswordEnabled,isVanityNameEnabled,otpMode,password,vanityName}=nextData,updatedData={};return isDownloadEnabled!==prevData.isDownloadEnabled&&(updatedData.isDownloadEnabled=isDownloadEnabled),(isExpirationEnabled!==prevData.isExpirationEnabled||expiration?.toString()!==prevData.expiration?.toString())&&(updatedData.isExpirationEnabled=isExpirationEnabled,updatedData.expiration=isExpirationEnabled?expiration:null),(isPasswordEnabled!==prevData.isPasswordEnabled||password!==prevData.password)&&(updatedData.isPasswordEnabled=isPasswordEnabled,updatedData.password=isPasswordEnabled?password:null),(isOtpEnabled!==prevData.isOtpEnabled||otpMode!==prevData.otpMode)&&(updatedData.isOtpEnabled=isOtpEnabled,updatedData.otpMode=isOtpEnabled?otpMode:OtpMode.NONE),(isVanityNameEnabled!==prevData.isVanityNameEnabled||vanityName!==prevData.vanityName)&&(updatedData.isVanityNameEnabled=isVanityNameEnabled,updatedData.vanityName=isVanityNameEnabled?vanityName:null),updatedData};export{getUpdatedLinkSettingsFormData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._otpToggleRow_1eiby_1{align-items:center;gap:var(--bp-space-030);display:flex}._recommendedBadge_1eiby_7,._countBadge_1eiby_8{padding:var(--bp-space-010) var(--bp-space-030);border-radius:var(--bp-radius-10);letter-spacing:.04em;text-transform:uppercase;white-space:nowrap;align-items:center;display:inline-flex}._recommendedBadge_1eiby_7{background-color:var(--bp-surface-status-surface-info-secondary)}._countBadge_1eiby_8{background-color:var(--bp-surface-status-surface-gray)}._modeSelector_1eiby_26{gap:var(--bp-space-030);flex-direction:column;margin-inline-start:var(--bp-space-140);display:flex}._allowlistRow_1eiby_33{align-items:center;gap:var(--bp-space-040);margin-inline-start:var(--bp-space-070);display:flex}
|
|
@@ -169,5 +169,45 @@ declare const messages: {
|
|
|
169
169
|
description: string;
|
|
170
170
|
id: string;
|
|
171
171
|
};
|
|
172
|
+
otpToggleText: {
|
|
173
|
+
defaultMessage: string;
|
|
174
|
+
description: string;
|
|
175
|
+
id: string;
|
|
176
|
+
};
|
|
177
|
+
otpRecommendedBadge: {
|
|
178
|
+
defaultMessage: string;
|
|
179
|
+
description: string;
|
|
180
|
+
id: string;
|
|
181
|
+
};
|
|
182
|
+
otpModeSelectorLegend: {
|
|
183
|
+
defaultMessage: string;
|
|
184
|
+
description: string;
|
|
185
|
+
id: string;
|
|
186
|
+
};
|
|
187
|
+
otpModeOpenLabel: {
|
|
188
|
+
defaultMessage: string;
|
|
189
|
+
description: string;
|
|
190
|
+
id: string;
|
|
191
|
+
};
|
|
192
|
+
otpModeAllowlistLabel: {
|
|
193
|
+
defaultMessage: string;
|
|
194
|
+
description: string;
|
|
195
|
+
id: string;
|
|
196
|
+
};
|
|
197
|
+
otpConfigureButton: {
|
|
198
|
+
defaultMessage: string;
|
|
199
|
+
description: string;
|
|
200
|
+
id: string;
|
|
201
|
+
};
|
|
202
|
+
otpAllowlistedLabel: {
|
|
203
|
+
defaultMessage: string;
|
|
204
|
+
description: string;
|
|
205
|
+
id: string;
|
|
206
|
+
};
|
|
207
|
+
otpAllowlistCountBadge: {
|
|
208
|
+
defaultMessage: string;
|
|
209
|
+
description: string;
|
|
210
|
+
id: string;
|
|
211
|
+
};
|
|
172
212
|
};
|
|
173
213
|
export default messages;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OtpActiveModeType } from '../../types';
|
|
2
|
+
export interface OtpSectionProps {
|
|
3
|
+
allowlistItemCount: number;
|
|
4
|
+
canChange: boolean;
|
|
5
|
+
isAvailable: boolean;
|
|
6
|
+
isChecked: boolean;
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
onConfigureAllowlist?: () => void;
|
|
9
|
+
onModeChange: (mode: OtpActiveModeType) => void;
|
|
10
|
+
onToggle: (checked: boolean) => void;
|
|
11
|
+
otpMode: OtpActiveModeType;
|
|
12
|
+
}
|
|
13
|
+
export declare function OtpSection({ allowlistItemCount, canChange, isAvailable, isChecked, isDisabled, onConfigureAllowlist, onModeChange, onToggle, otpMode, }: OtpSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -174,6 +174,24 @@ export interface SharedLink {
|
|
|
174
174
|
*/
|
|
175
175
|
vanityName?: string;
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* The verification modes for OTP-protected shared links. Backend naming.
|
|
179
|
+
* - `NONE` - OTP is not enabled.
|
|
180
|
+
* - `OPEN` - "Anyone with an email" can verify and access.
|
|
181
|
+
* - `ALLOWLIST` - only allowlisted emails/domains can access.
|
|
182
|
+
*/
|
|
183
|
+
export declare const OtpMode: {
|
|
184
|
+
readonly ALLOWLIST: "allowlist";
|
|
185
|
+
readonly NONE: "none";
|
|
186
|
+
readonly OPEN: "open";
|
|
187
|
+
};
|
|
188
|
+
export type OtpModeType = (typeof OtpMode)[keyof typeof OtpMode];
|
|
189
|
+
/**
|
|
190
|
+
* The subset of {@link OtpModeType} that is user-selectable in the UI. When OTP is on,
|
|
191
|
+
* the mode is always `open` or `allowlist`; `none` is only used on the write path to
|
|
192
|
+
* signal that OTP is being disabled.
|
|
193
|
+
*/
|
|
194
|
+
export type OtpActiveModeType = Exclude<OtpModeType, typeof OtpMode.NONE>;
|
|
177
195
|
export interface SharedLinkSettings {
|
|
178
196
|
/**
|
|
179
197
|
* When `true`, the user can update the download settings of the shared link.
|
|
@@ -183,6 +201,11 @@ export interface SharedLinkSettings {
|
|
|
183
201
|
* When `true`, the user can update the expiration settings of the shared link.
|
|
184
202
|
*/
|
|
185
203
|
canChangeExpiration?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* When `true`, the user can update OTP protection and change its mode.
|
|
206
|
+
* Items or users without permission to change shared-link access surface as `false`.
|
|
207
|
+
*/
|
|
208
|
+
canChangeOtp?: boolean;
|
|
186
209
|
/**
|
|
187
210
|
* When `true`, the user can update the password settings of the shared link.
|
|
188
211
|
*/
|
|
@@ -203,6 +226,10 @@ export interface SharedLinkSettings {
|
|
|
203
226
|
* When `true`, users with the shared link can download the item.
|
|
204
227
|
*/
|
|
205
228
|
isDownloadEnabled?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* When `true`, the OTP protection section is visible to the user.
|
|
231
|
+
*/
|
|
232
|
+
isOtpAvailable?: boolean;
|
|
206
233
|
/**
|
|
207
234
|
* When `true`, the password settings of the shared link are visible to the user.
|
|
208
235
|
*/
|
|
@@ -215,6 +242,14 @@ export interface SharedLinkSettings {
|
|
|
215
242
|
* When `true`, the custom URL settings of the shared link are visible to the user.
|
|
216
243
|
*/
|
|
217
244
|
isVanityNameAvailable?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* The number of entries on the link's allowlist, shown as the "+N ITEMS" badge.
|
|
247
|
+
*/
|
|
248
|
+
otpAllowlistItemCount?: number;
|
|
249
|
+
/**
|
|
250
|
+
* The current saved OTP verification mode.
|
|
251
|
+
*/
|
|
252
|
+
otpMode?: OtpModeType;
|
|
218
253
|
}
|
|
219
254
|
export interface AccessLevel {
|
|
220
255
|
/**
|
|
@@ -371,6 +406,12 @@ export interface EventService {
|
|
|
371
406
|
* Used to enhance the experience for managing collaborators or override the default navigation behavior.
|
|
372
407
|
*/
|
|
373
408
|
onCollaboratorsManagementClick?: () => void;
|
|
409
|
+
/**
|
|
410
|
+
* Function to open the Manage Allowlist Access modal.
|
|
411
|
+
*
|
|
412
|
+
* When omitted, the "Configure" button is disabled.
|
|
413
|
+
*/
|
|
414
|
+
onOtpAllowlistConfigure?: () => void;
|
|
374
415
|
/**
|
|
375
416
|
* Function to observe when restricted collaborators are removed from the selection.
|
|
376
417
|
*
|
|
@@ -553,6 +594,10 @@ export interface LinkSettingsFormData {
|
|
|
553
594
|
* When `true`, the shared link will expire on a specific date.
|
|
554
595
|
*/
|
|
555
596
|
isExpirationEnabled: boolean;
|
|
597
|
+
/**
|
|
598
|
+
* When `true`, viewers must verify a one-time passcode to access the shared link.
|
|
599
|
+
*/
|
|
600
|
+
isOtpEnabled: boolean;
|
|
556
601
|
/**
|
|
557
602
|
* When `true`, users with the shared link must enter a password.
|
|
558
603
|
*/
|
|
@@ -561,6 +606,10 @@ export interface LinkSettingsFormData {
|
|
|
561
606
|
* When `true`, users can access the shared link with a custom URL.
|
|
562
607
|
*/
|
|
563
608
|
isVanityNameEnabled: boolean;
|
|
609
|
+
/**
|
|
610
|
+
* The selected verification mode. Only meaningful when `isOtpEnabled` is `true`.
|
|
611
|
+
*/
|
|
612
|
+
otpMode: OtpModeType;
|
|
564
613
|
/**
|
|
565
614
|
* The password required by users to access the shared link.
|
|
566
615
|
*/
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^16.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.6.
|
|
8
|
-
"@box/copy-input": "^2.2.
|
|
9
|
-
"@box/user-selector": "^2.2.
|
|
6
|
+
"@box/blueprint-web": "^16.15.0",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.6.3",
|
|
8
|
+
"@box/copy-input": "^2.2.3",
|
|
9
|
+
"@box/user-selector": "^2.2.3",
|
|
10
10
|
"lodash": "^4.17.15",
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"react-dom": "^18.0.0",
|
|
13
13
|
"react-intl": "^6.4.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^16.
|
|
17
|
-
"@box/blueprint-web-assets": "^5.6.
|
|
18
|
-
"@box/copy-input": "^2.2.
|
|
16
|
+
"@box/blueprint-web": "^16.15.0",
|
|
17
|
+
"@box/blueprint-web-assets": "^5.6.3",
|
|
18
|
+
"@box/copy-input": "^2.2.3",
|
|
19
19
|
"@box/eslint-plugin-blueprint": "2.2.0",
|
|
20
|
-
"@box/storybook-utils": "1.2.
|
|
20
|
+
"@box/storybook-utils": "1.2.3",
|
|
21
21
|
"react-intl": "^6.4.2"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|