@box/unified-share-modal 3.3.12 → 3.3.13
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/shared-link-footer.js +1 -0
- package/dist/chunks/shared-link-section.js +1 -1
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/messages.js +1 -1
- package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-footer.js +1 -0
- package/dist/esm/lib/contexts/shared-link-settings-context.js +1 -1
- package/dist/esm/lib/hooks/use-access-levels.js +1 -1
- package/dist/styles/shared-link-footer.css +1 -0
- package/dist/styles/shared-link-section.css +1 -1
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts +35 -0
- package/dist/types/lib/components/unified-share-form-modal/shared-link-section/shared-link-footer.d.ts +5 -0
- package/dist/types/lib/stories/shared.d.ts +4 -0
- package/dist/types/lib/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useIntl}from"react-intl";import{Link,Text}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{Globe,Lock}from"@box/blueprint-web-assets/icons/Medium";import{bpSize040}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/shared-link-footer.css';var shared_link_footer_module_default={disclosures:`_disclosures_c0arr_1`,row:`_row_c0arr_7`,icon:`_icon_c0arr_13`,settings:`_settings_c0arr_18`};function FooterRow({children,icon:Icon}){return jsxs(`div`,{className:shared_link_footer_module_default.row,children:[jsx(Icon,{className:shared_link_footer_module_default.icon,height:bpSize040,width:bpSize040}),jsx(Text,{as:`span`,color:`textOnLightSecondary`,children})]})}function SettingsLink({dataTargetId,isSubmitting,label,onClick}){return jsx(Link,{"aria-disabled":isSubmitting,"aria-haspopup":`dialog`,className:shared_link_footer_module_default.settings,"data-target-id":dataTargetId,onClick,onKeyDown:callOnKeyboardEvent(onClick,{canPreventDefault:!0}),role:`button`,tabIndex:isSubmitting?-1:0,variant:`standalone`,children:label})}function SharedLinkFooter({onSharedLinkSettingsClick}){let{formatMessage}=useIntl(),{config,eventService,isSubmitting,item,sharedLink,sharedLinkNotices}=useUnifiedShareModalContext(),{permissions={}}=item,{onOtpAllowlistConfigure}=eventService,otpMode=sharedLink.settings?.otpMode??`none`,allowlistCount=sharedLink.settings?.otpAllowlistItemCount,canManageShare=!!permissions.canSetShareAccess,canChangeOtp=!!sharedLink.settings?.canChangeOtp,isOtpFooterVisible=!!sharedLink.settings?.isOtpAvailable&&sharedLink.access===`open`,handleConfigureAllowlistClick=()=>{isSubmitting||onOtpAllowlistConfigure&&onOtpAllowlistConfigure()};if(isOtpFooterVisible)return jsxs(`div`,{className:shared_link_footer_module_default.disclosures,children:[otpMode===`none`&&jsx(FooterRow,{icon:Globe,children:formatMessage(messages.sharedLinkOtpOffPrompt,{enableLink:canManageShare&&canChangeOtp&&config.sharedLinkSettings?jsx(SettingsLink,{isSubmitting,label:formatMessage(messages.sharedLinkEnableOtp),onClick:onSharedLinkSettingsClick}):``})}),otpMode===`open`&&jsx(FooterRow,{icon:Lock,children:formatMessage(messages.sharedLinkOtpOpen)}),otpMode===`allowlist`&&jsx(FooterRow,{icon:Lock,children:(()=>{let configureLink=canManageShare&&canChangeOtp?jsx(SettingsLink,{isSubmitting,label:formatMessage(messages.sharedLinkConfigureAllowlist),onClick:handleConfigureAllowlistClick}):``;return canManageShare&&allowlistCount!==void 0?formatMessage(messages.sharedLinkOtpAllowlistCount,{count:allowlistCount,configureLink}):formatMessage(messages.sharedLinkOtpAllowlist,{configureLink})})()}),sharedLinkNotices]});let isOpenAccess=sharedLink.access===`open`,isCompanyEditable=sharedLink.access===`company`&&sharedLink.permission===`can_edit`;return!isOpenAccess&&!isCompanyEditable&&!sharedLinkNotices?null:jsxs(`div`,{className:shared_link_footer_module_default.disclosures,children:[isOpenAccess&&jsx(FooterRow,{icon:Globe,children:sharedLink.permission===`can_edit`?formatMessage(messages.sharedLinkEditablePubliclyAvailable):formatMessage(messages.sharedLinkPubliclyAvailable)}),isCompanyEditable&&jsx(FooterRow,{icon:Globe,children:formatMessage(messages.sharedLinkElevatedEditableCompanyAvailable)}),sharedLinkNotices]})}export{SharedLinkFooter as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{formatDateFromTimestampToDateString}from"../esm/lib/utils/date.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{useSharingAction}from"../esm/lib/hooks/use-sharing-action.js";import{t as SharedLinkAccess}from"./shared-link-access.js";import{t as SharedLinkPermission}from"./shared-link-permission.js";import{useCallback,useEffect,useRef}from"react";import{useIntl}from"react-intl";import{Button,Focusable,Link,Status,Switch,Text,Tooltip,useNotification}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{ClockBadge}from"@box/blueprint-web-assets/icons/Line";import{CopyInput}from"@box/copy-input";import{
|
|
1
|
+
import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{formatDateFromTimestampToDateString}from"../esm/lib/utils/date.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import messages from"../esm/lib/components/unified-share-form-modal/shared-link-section/messages.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{useSharingAction}from"../esm/lib/hooks/use-sharing-action.js";import{t as SharedLinkAccess}from"./shared-link-access.js";import{t as SharedLinkFooter}from"./shared-link-footer.js";import{t as SharedLinkPermission}from"./shared-link-permission.js";import{useCallback,useEffect,useRef}from"react";import{useIntl}from"react-intl";import{Button,Focusable,Link,Status,Switch,Text,Tooltip,useNotification}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{ClockBadge}from"@box/blueprint-web-assets/icons/Line";import{CopyInput}from"@box/copy-input";import{Mail}from"@box/blueprint-web-assets/icons/Medium";import{SurfaceStatusSurfaceRed}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/shared-link-section.css';var shared_link_section_module_default={container:`_container_w9erl_1`,toggle:`_toggle_w9erl_7`,settings:`_settings_w9erl_13`,copy:`_copy_w9erl_22`,access:`_access_w9erl_30`};function SharedLinkSection(){let{formatMessage}=useIntl(),{addNotification}=useNotification(),copyInputRef=useRef(null),{isInteracted,isSharedLinkAutoCopied,isSharedLinkAutoCreated,setForm}=useUnifiedShareFormContext(),{config,eventService,isFetching,isSubmitting,item,setView,sharedLink,sharingService}=useUnifiedShareModalContext(),{permissions={}}=item,{onSharedLinkCopy,onSharedLinkSettingsClick}=eventService,{createSharedLink}=sharingService,{notifications,sharedLinkAutoCopy,sharedLinkAutoCreate}=config,hasSharedLink=!!sharedLink.url,isAutoCopyEnabled=sharedLinkAutoCopy&&!isSharedLinkAutoCopied.current&&!isInteracted,isAutoCreateEnabled=sharedLinkAutoCreate&&!isSharedLinkAutoCreated.current&&!isInteracted,{onAction:onCreate}=useSharingAction(useCallback(async()=>{let response=await createSharedLink();return isAutoCopyEnabled?{messages:[]}:response},[isAutoCopyEnabled,createSharedLink]),`create-shared-link`);useEffect(()=>{(async()=>{isFetching||isSubmitting||((isAutoCopyEnabled||isAutoCreateEnabled)&&!hasSharedLink&&!isSharedLinkAutoCreated.current&&(isSharedLinkAutoCreated.current=!0,await onCreate()),isAutoCopyEnabled&&hasSharedLink&©InputRef.current&©InputRef.current.click())})()},[hasSharedLink,isAutoCopyEnabled,isAutoCreateEnabled,isFetching,isSharedLinkAutoCopied,isSharedLinkAutoCreated,isSubmitting,onCreate]);let handleCopySuccess=useCallback(result=>{if(onSharedLinkCopy&&onSharedLinkCopy(result),!isAutoCopyEnabled)return;isSharedLinkAutoCopied.current=!0;let message;message=typeof result==`string`?isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopySuccessNoticeText):formatMessage(messages.autoCopySuccessNoticeText):isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopyErrorNoticeText):null,message&¬ifications.includes(`auto-copy-shared-link`)&&addNotification({...getNotificationArgs(formatMessage,`success`),styledText:message})},[addNotification,formatMessage,isAutoCopyEnabled,isSharedLinkAutoCopied,isSharedLinkAutoCreated,notifications,onSharedLinkCopy]),handleSharedLinkToggleChange=async checked=>{if(checked){await onCreate();return}setView(`remove-shared-link`)},handleSharedLinkSettingsClick=()=>{if(onSharedLinkSettingsClick){onSharedLinkSettingsClick();return}setView(`shared-link-settings`)},sharedLinkToggleTooltip,isSharedLinkToggleDisabled=!1;return!hasSharedLink&&!isSubmitting&&(sharedLinkToggleTooltip=formatMessage(messages.sharedLinkToggleTooltip)),!hasSharedLink&&!permissions.canShare&&(sharedLinkToggleTooltip=formatMessage(messages.createLinkDisabledTooltip),isSharedLinkToggleDisabled=!0),hasSharedLink&&!permissions.canSetShareAccess&&(sharedLinkToggleTooltip=formatMessage(messages.removeLinkDisabledTooltip),isSharedLinkToggleDisabled=!0),jsxs(`div`,{className:shared_link_section_module_default.container,children:[jsx(Text,{as:`label`,variant:`bodyDefaultBold`,children:formatMessage(messages.shareLinkLabel)}),jsxs(`div`,{className:shared_link_section_module_default.toggle,children:[jsx(Tooltip,{align:`start`,content:sharedLinkToggleTooltip,"data-testid":`usm-SharedLinkToggle-tooltip`,open:sharedLinkToggleTooltip?void 0:!1,children:jsx(Focusable,{focusable:isSharedLinkToggleDisabled,children:jsx(Switch.Item,{autoFocus:!permissions.canInviteCollaborator,checked:hasSharedLink,"data-target-id":`Toggle-CreateSharedLink`,disabled:isSharedLinkToggleDisabled||isSubmitting,label:formatMessage(messages.sharedLinkToggleLabel),onCheckedChange:handleSharedLinkToggleChange,value:`shared-link`})})}),hasSharedLink&&!!sharedLink.expiresAt&&jsx(Tooltip,{content:formatMessage(messages.expirationIconTooltip,{expirationDate:formatDateFromTimestampToDateString(sharedLink.expiresAt)}),"data-testid":`usm-SharedLinkExpiration-tooltip`,children:jsx(Status,{color:SurfaceStatusSurfaceRed,hideText:!0,icon:ClockBadge,text:formatMessage(messages.expirationIconLabel)})}),hasSharedLink&&config.sharedLinkSettings&&jsx(Link,{"aria-disabled":isSubmitting,"aria-haspopup":`dialog`,className:shared_link_section_module_default.settings,"data-target-id":`PlainButton-SharedLinkSettings`,onClick:handleSharedLinkSettingsClick,onKeyDown:callOnKeyboardEvent(handleSharedLinkSettingsClick,{canPreventDefault:!0}),role:`button`,tabIndex:isSubmitting?-1:0,variant:`standalone`,children:formatMessage(messages.sharedLinkSettingsLabel)})]}),hasSharedLink&&jsxs(`div`,{className:shared_link_section_module_default.copy,children:[jsx(CopyInput,{ref:copyInputRef,autoFocus:sharedLinkAutoCreate&&isSharedLinkAutoCreated.current&&!isInteracted,"data-target-id":`Button-CopySharedLink`,disabled:isSubmitting,hideLabel:!0,label:formatMessage(messages.sharedLinkUrlLabel),onCopy:handleCopySuccess,value:sharedLink.url}),config.sharedLinkEmail&&jsx(Tooltip,{align:`end`,content:formatMessage(messages.sharedLinkEmailLabel),children:jsx(Button,{"aria-label":formatMessage(messages.sharedLinkEmailLabel),"data-target-id":`Button-SendSharedLink`,disabled:isSubmitting,endIcon:Mail,onClick:()=>setForm(`email`),size:`large`,variant:`secondary`})})]}),hasSharedLink&&(config.sharedLinkAccess||config.sharedLinkPermission)&&jsxs(`div`,{className:shared_link_section_module_default.access,children:[config.sharedLinkAccess&&jsx(SharedLinkAccess,{}),config.sharedLinkPermission&&jsx(SharedLinkPermission,{})]}),hasSharedLink&&jsx(SharedLinkFooter,{onSharedLinkSettingsClick:handleSharedLinkSettingsClick})]})}export{SharedLinkSection as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineMessages}from"react-intl";var messages=defineMessages({closeButton:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.closeButton`,defaultMessage:`Close`},shareLinkLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.shareLinkLabel`,defaultMessage:`Share Link`},sharedLinkToggleLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleLabel`,defaultMessage:`Shared link`},sharedLinkToggleTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleTooltip`,defaultMessage:`Create and copy link`},createLinkDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.createLinkDisabledTooltip`,defaultMessage:`You do not have permission to create the link`},removeLinkDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.removeLinkDisabledTooltip`,defaultMessage:`You do not have permission to remove the link`},sharedLinkSettingsLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkSettingsLabel`,defaultMessage:`Link Settings`},sharedLinkUrlLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkUrlLabel`,defaultMessage:`Shared link URL`},sharedLinkEmailLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEmailLabel`,defaultMessage:`Send Shared Link`},sharedLinkPubliclyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkPubliclyAvailable`,defaultMessage:`This content is publicly available to anyone with the link.`},sharedLinkEditablePubliclyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEditablePubliclyAvailable`,defaultMessage:`Publicly available for anyone to view and download. Any logged in users with the link can edit.`},sharedLinkElevatedEditableCompanyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkElevatedEditableCompanyAvailable`,defaultMessage:`People who have access to this link can edit.`},expirationIconLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconLabel`,defaultMessage:`Expires`},expirationIconTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconTooltip`,defaultMessage:`This link will expire and be inaccessible on {expirationDate}`},openAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelLabel`,defaultMessage:`People with the link`},openAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelDescription`,defaultMessage:`Publicly accessible and no sign-in required`},companyAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelLabel`,defaultMessage:`People in your company`},companyAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelDescription`,defaultMessage:`Anyone in your company with the link or people invited to this {item} can access`},enterpriseAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelLabel`,defaultMessage:`People in {enterprise}`},enterpriseAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelDescription`,defaultMessage:`Anyone at {enterprise} with the link or people invited to this {item} can access`},collaboratorsAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelLabel`,defaultMessage:`Invited people only`},collaboratorsAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelDescription`,defaultMessage:`Only invited people can access this {item}`},fileAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.fileAccessLevelItem`,defaultMessage:`file`},folderAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.folderAccessLevelItem`,defaultMessage:`folder`},hubsAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.hubsAccessLevelItem`,defaultMessage:`hub`},promptAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.promptAccessLevelItem`,defaultMessage:`prompt`},webLinkAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.webLinkAccessLevelItem`,defaultMessage:`bookmark`},workflowAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.workflowAccessLevelItem`,defaultMessage:`workflow`},disabledAccessLevelTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.disabledAccessLevelTooltip`,defaultMessage:`This option is not available due to a security policy`},canEditPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canEditPermissionLevelLabel`,defaultMessage:`Can edit`},canDownloadPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canDownloadPermissionLevelLabel`,defaultMessage:`Can view and download`},canPreviewPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canPreviewPermissionLevelLabel`,defaultMessage:`Can view only`},canEditBoxNoteDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canEditBoxNoteDisabledTooltip`,defaultMessage:`This permission can only be changed in Box Notes`},autoCreateCopyErrorNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopyErrorNoticeText`,defaultMessage:`Shared link created. Click Copy to share.`},autoCreateCopySuccessNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopySuccessNoticeText`,defaultMessage:`Shared link created and copied to clipboard.`},autoCopySuccessNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCopySuccessNoticeText`,defaultMessage:`Shared link copied to clipboard.`}});export{messages as default};
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({closeButton:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.closeButton`,defaultMessage:`Close`},shareLinkLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.shareLinkLabel`,defaultMessage:`Share Link`},sharedLinkToggleLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleLabel`,defaultMessage:`Shared link`},sharedLinkToggleTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkToggleTooltip`,defaultMessage:`Create and copy link`},createLinkDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.createLinkDisabledTooltip`,defaultMessage:`You do not have permission to create the link`},removeLinkDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.removeLinkDisabledTooltip`,defaultMessage:`You do not have permission to remove the link`},sharedLinkSettingsLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkSettingsLabel`,defaultMessage:`Link Settings`},sharedLinkUrlLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkUrlLabel`,defaultMessage:`Shared link URL`},sharedLinkEmailLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEmailLabel`,defaultMessage:`Send Shared Link`},sharedLinkPubliclyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkPubliclyAvailable`,defaultMessage:`This content is publicly available to anyone with the link.`},sharedLinkEditablePubliclyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEditablePubliclyAvailable`,defaultMessage:`Publicly available for anyone to view and download. Any logged in users with the link can edit.`},sharedLinkElevatedEditableCompanyAvailable:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkElevatedEditableCompanyAvailable`,defaultMessage:`People who have access to this link can edit.`},sharedLinkOtpOffPrompt:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkOtpOffPrompt`,defaultMessage:`This content is publicly available to anyone with the link. Protect this link with a One-Time Passcode. {enableLink}`},sharedLinkOtpOpen:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkOtpOpen`,defaultMessage:`Access is allowed after verifying the One-Time Passcode.`},sharedLinkOtpAllowlistCount:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkOtpAllowlistCount`,defaultMessage:`{count, plural, one {# item} other {# items}} on the allowlist. {configureLink}`},sharedLinkOtpAllowlist:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkOtpAllowlist`,defaultMessage:`Access is allowed for people on the allowlist after verifying the One-Time Passcode. {configureLink}`},sharedLinkEnableOtp:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkEnableOtp`,defaultMessage:`Enable`},sharedLinkConfigureAllowlist:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.sharedLinkConfigureAllowlist`,defaultMessage:`Configure`},expirationIconLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconLabel`,defaultMessage:`Expires`},expirationIconTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.expirationIconTooltip`,defaultMessage:`This link will expire and be inaccessible on {expirationDate}`},openAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelLabel`,defaultMessage:`People with the link`},openAccessLevelLabelOtp:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelLabelOtp`,defaultMessage:`Authorized people with the link`},openAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.openAccessLevelDescription`,defaultMessage:`Publicly accessible and no sign-in required`},companyAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelLabel`,defaultMessage:`People in your company`},companyAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.companyAccessLevelDescription`,defaultMessage:`Anyone in your company with the link or people invited to this {item} can access`},enterpriseAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelLabel`,defaultMessage:`People in {enterprise}`},enterpriseAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.enterpriseAccessLevelDescription`,defaultMessage:`Anyone at {enterprise} with the link or people invited to this {item} can access`},collaboratorsAccessLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelLabel`,defaultMessage:`Invited people only`},collaboratorsAccessLevelDescription:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.collaboratorsAccessLevelDescription`,defaultMessage:`Only invited people can access this {item}`},fileAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.fileAccessLevelItem`,defaultMessage:`file`},folderAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.folderAccessLevelItem`,defaultMessage:`folder`},hubsAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.hubsAccessLevelItem`,defaultMessage:`hub`},promptAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.promptAccessLevelItem`,defaultMessage:`prompt`},webLinkAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.webLinkAccessLevelItem`,defaultMessage:`bookmark`},workflowAccessLevelItem:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.workflowAccessLevelItem`,defaultMessage:`workflow`},disabledAccessLevelTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.disabledAccessLevelTooltip`,defaultMessage:`This option is not available due to a security policy`},canEditPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canEditPermissionLevelLabel`,defaultMessage:`Can edit`},canDownloadPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canDownloadPermissionLevelLabel`,defaultMessage:`Can view and download`},canPreviewPermissionLevelLabel:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canPreviewPermissionLevelLabel`,defaultMessage:`Can view only`},canEditBoxNoteDisabledTooltip:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.canEditBoxNoteDisabledTooltip`,defaultMessage:`This permission can only be changed in Box Notes`},autoCreateCopyErrorNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopyErrorNoticeText`,defaultMessage:`Shared link created. Click Copy to share.`},autoCreateCopySuccessNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCreateCopySuccessNoticeText`,defaultMessage:`Shared link created and copied to clipboard.`},autoCopySuccessNoticeText:{id:`groupSharedFeatures.usm.unifiedShareFormModal.sharedLinkSection.autoCopySuccessNoticeText`,defaultMessage:`Shared link copied to clipboard.`}});export{messages as default};
|
package/dist/esm/lib/components/unified-share-form-modal/shared-link-section/shared-link-footer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as SharedLinkFooter}from"../../../../../chunks/shared-link-footer.js";export{SharedLinkFooter};
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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=OtpMode.NONE}=settings,[containerRef,setContainerRef]=useState(null),initialFormData=useMemo(()=>{let isOtpEnabled=otpMode!==OtpMode.NONE;return{expiration:expiresAt?formatDateFromTimestampToCalendarDate(expiresAt):null,isDownloadEnabled:!!isDownloadEnabled,isExpirationEnabled:!!expiresAt,isOtpEnabled,isPasswordEnabled:!!isPasswordEnabled,isVanityNameEnabled:!!vanityName,otpMode,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
|
-
import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{getAllowedAccessLevels}from"../utils/permission.js";import messages from"../components/unified-share-form-modal/shared-link-section/messages.js";import{useMemo}from"react";import{useIntl}from"react-intl";var getAccessLevelLabel=(formatMessage,accessLevel,enterprise)=>{let{id:access,label}=accessLevel,message;switch(access){case`collaborators`:message=messages.collaboratorsAccessLevelLabel;break;case`company`:message=enterprise?messages.enterpriseAccessLevelLabel:messages.companyAccessLevelLabel;break;case`open`:message=messages.openAccessLevelLabel;break}return label??(message?formatMessage(message,{enterprise}):``)},getAccessLevelDescription=(formatMessage,accessLevel,enterprise,type)=>{let{description,id:access}=accessLevel,message,item;switch(access){case`collaborators`:message=messages.collaboratorsAccessLevelDescription;break;case`company`:message=enterprise?messages.enterpriseAccessLevelDescription:messages.companyAccessLevelDescription;break;case`open`:message=messages.openAccessLevelDescription;break}switch(type){case`file`:item=messages.fileAccessLevelItem;break;case`folder`:item=messages.folderAccessLevelItem;break;case`hubs`:item=messages.hubsAccessLevelItem;break;case`prompt`:item=messages.promptAccessLevelItem;break;case`web_link`:item=messages.webLinkAccessLevelItem;break;case`workflow`:item=messages.workflowAccessLevelItem;break}return description??(message?formatMessage(message,{enterprise,item:formatMessage(item)}):``)},useAccessLevels=()=>{let{formatMessage}=useIntl(),{currentUser,item,sharedLink}=useUnifiedShareModalContext(),{enterprise={}}=currentUser,{name:enterpriseName}=enterprise,{type:itemType}=item,{access,accessLevels}=sharedLink,allowedLevels=useMemo(()=>getAllowedAccessLevels(accessLevels).map(level=>({...level,description:getAccessLevelDescription(formatMessage,level,enterpriseName,itemType),label:getAccessLevelLabel(formatMessage,level,enterpriseName)})),[accessLevels,enterpriseName,formatMessage,itemType]);return{allowedLevels,selectedAccess:useMemo(()=>allowedLevels.find(({id})=>access===id),[access,allowedLevels])}};export{useAccessLevels};
|
|
1
|
+
import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{getAllowedAccessLevels}from"../utils/permission.js";import messages from"../components/unified-share-form-modal/shared-link-section/messages.js";import{useMemo}from"react";import{useIntl}from"react-intl";var getAccessLevelLabel=(formatMessage,accessLevel,enterprise,isOtpOn=!1)=>{let{id:access,label}=accessLevel,message;switch(access){case`collaborators`:message=messages.collaboratorsAccessLevelLabel;break;case`company`:message=enterprise?messages.enterpriseAccessLevelLabel:messages.companyAccessLevelLabel;break;case`open`:message=isOtpOn?messages.openAccessLevelLabelOtp:messages.openAccessLevelLabel;break}return label??(message?formatMessage(message,{enterprise}):``)},getAccessLevelDescription=(formatMessage,accessLevel,enterprise,type)=>{let{description,id:access}=accessLevel,message,item;switch(access){case`collaborators`:message=messages.collaboratorsAccessLevelDescription;break;case`company`:message=enterprise?messages.enterpriseAccessLevelDescription:messages.companyAccessLevelDescription;break;case`open`:message=messages.openAccessLevelDescription;break}switch(type){case`file`:item=messages.fileAccessLevelItem;break;case`folder`:item=messages.folderAccessLevelItem;break;case`hubs`:item=messages.hubsAccessLevelItem;break;case`prompt`:item=messages.promptAccessLevelItem;break;case`web_link`:item=messages.webLinkAccessLevelItem;break;case`workflow`:item=messages.workflowAccessLevelItem;break}return description??(message?formatMessage(message,{enterprise,item:formatMessage(item)}):``)},useAccessLevels=()=>{let{formatMessage}=useIntl(),{currentUser,item,sharedLink}=useUnifiedShareModalContext(),{enterprise={}}=currentUser,{name:enterpriseName}=enterprise,{type:itemType}=item,{access,accessLevels,settings}=sharedLink,isOtpOn=access===`open`&&!!settings?.otpMode&&settings.otpMode!==`none`,allowedLevels=useMemo(()=>getAllowedAccessLevels(accessLevels).map(level=>({...level,description:getAccessLevelDescription(formatMessage,level,enterpriseName,itemType),label:getAccessLevelLabel(formatMessage,level,enterpriseName,isOtpOn)})),[accessLevels,enterpriseName,formatMessage,itemType,isOtpOn]);return{allowedLevels,selectedAccess:useMemo(()=>allowedLevels.find(({id})=>access===id),[access,allowedLevels])}};export{useAccessLevels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._disclosures_c0arr_1{gap:var(--bp-space-010);flex-direction:column;display:flex}._row_c0arr_7{align-items:flex-start;gap:var(--bp-space-010);display:flex}._icon_c0arr_13{height:var(--bp-size-050);flex-shrink:0}._settings_c0arr_18{cursor:pointer}._settings_c0arr_18[aria-disabled=true]{opacity:.3;pointer-events:none}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_w9erl_1{gap:var(--bp-space-030);flex-direction:column;display:flex}._toggle_w9erl_7{gap:var(--bp-space-020);align-items:center;display:flex}._settings_w9erl_13{cursor:pointer;margin-left:auto}._settings_w9erl_13[aria-disabled=true]{opacity:.3;pointer-events:none}._copy_w9erl_22{gap:var(--bp-space-020);display:flex}._copy_w9erl_22>div:first-child{flex-grow:1}._access_w9erl_30{gap:var(--bp-space-010);flex-wrap:wrap;display:flex}
|
package/dist/types/lib/components/unified-share-form-modal/shared-link-section/messages.d.ts
CHANGED
|
@@ -59,6 +59,36 @@ declare const messages: {
|
|
|
59
59
|
description: string;
|
|
60
60
|
id: string;
|
|
61
61
|
};
|
|
62
|
+
sharedLinkOtpOffPrompt: {
|
|
63
|
+
defaultMessage: string;
|
|
64
|
+
description: string;
|
|
65
|
+
id: string;
|
|
66
|
+
};
|
|
67
|
+
sharedLinkOtpOpen: {
|
|
68
|
+
defaultMessage: string;
|
|
69
|
+
description: string;
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
72
|
+
sharedLinkOtpAllowlistCount: {
|
|
73
|
+
defaultMessage: string;
|
|
74
|
+
description: string;
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
77
|
+
sharedLinkOtpAllowlist: {
|
|
78
|
+
defaultMessage: string;
|
|
79
|
+
description: string;
|
|
80
|
+
id: string;
|
|
81
|
+
};
|
|
82
|
+
sharedLinkEnableOtp: {
|
|
83
|
+
defaultMessage: string;
|
|
84
|
+
description: string;
|
|
85
|
+
id: string;
|
|
86
|
+
};
|
|
87
|
+
sharedLinkConfigureAllowlist: {
|
|
88
|
+
defaultMessage: string;
|
|
89
|
+
description: string;
|
|
90
|
+
id: string;
|
|
91
|
+
};
|
|
62
92
|
expirationIconLabel: {
|
|
63
93
|
defaultMessage: string;
|
|
64
94
|
description: string;
|
|
@@ -74,6 +104,11 @@ declare const messages: {
|
|
|
74
104
|
description: string;
|
|
75
105
|
id: string;
|
|
76
106
|
};
|
|
107
|
+
openAccessLevelLabelOtp: {
|
|
108
|
+
defaultMessage: string;
|
|
109
|
+
description: string;
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
77
112
|
openAccessLevelDescription: {
|
|
78
113
|
defaultMessage: string;
|
|
79
114
|
description: string;
|
|
@@ -25,11 +25,15 @@ export declare const mockItemPermissions: {
|
|
|
25
25
|
canShare: boolean;
|
|
26
26
|
};
|
|
27
27
|
export declare const mockBoxFile: Item;
|
|
28
|
+
export declare const mockBoxFileViewer: Item;
|
|
28
29
|
export declare const mockBoxFolder: Item;
|
|
29
30
|
export declare const mockWorkflow: Item;
|
|
30
31
|
export declare const mockPrompt: Item;
|
|
31
32
|
export declare const mockSharedLinkSettings: SharedLinkSettings;
|
|
32
33
|
export declare const mockSharedLink: SharedLink;
|
|
34
|
+
export declare const mockSharedLinkOtpOff: SharedLink;
|
|
35
|
+
export declare const mockSharedLinkOtpOpen: SharedLink;
|
|
36
|
+
export declare const mockSharedLinkOtpAllowlist: SharedLink;
|
|
33
37
|
export declare const useMockSharedLink: (sharedLinkArg: any) => {
|
|
34
38
|
sharedLink: SharedLink;
|
|
35
39
|
sharingService: {
|
|
@@ -409,7 +409,8 @@ export interface EventService {
|
|
|
409
409
|
/**
|
|
410
410
|
* Function to open the Manage Allowlist Access modal.
|
|
411
411
|
*
|
|
412
|
-
* When omitted, the "Configure" button is disabled
|
|
412
|
+
* When omitted, the settings "Configure" button is disabled and the footer link is
|
|
413
|
+
* not rendered.
|
|
413
414
|
*/
|
|
414
415
|
onOtpAllowlistConfigure?: () => void;
|
|
415
416
|
/**
|