@box/unified-share-modal 3.3.12 → 3.4.0
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/collaboration-section.js +1 -1
- 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/contexts/unified-share-modal-context.js +1 -1
- package/dist/esm/lib/hooks/use-access-levels.js +1 -1
- package/dist/esm/lib/unified-share-modal.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/contexts/unified-share-modal-context.d.ts +4 -2
- package/dist/types/lib/stories/shared.d.ts +6 -1
- package/dist/types/lib/types.d.ts +2 -1
- package/dist/types/lib/unified-share-modal.d.ts +6 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{parseEmails}from"../esm/lib/utils/email.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{useFormValidation}from"../esm/lib/hooks/use-form-validation.js";import{useCollaborationForm}from"../esm/lib/hooks/use-collaboration-form.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{t as CollaborationRole}from"./collaboration-role.js";import{t as SharedWithAvatars}from"./shared-with-avatars.js";import{t as ShieldRestrictionNotice}from"./shield-restriction-notice.js";import{t as TextAreaContainer}from"./text-area-container.js";import{useCallback,useEffect,useRef,useState}from"react";import{useIntl}from"react-intl";import{Focusable,Modal,Text,Tooltip,useLabelable,useNotification,useUniqueId}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{createPortal}from"react-dom";import{Globe}from"@box/blueprint-web-assets/icons/Medium";import{bpSize040}from"@box/blueprint-web-assets/tokens/tokens";import{UserSelectorContainer}from"@box/user-selector";import '../styles/collaboration-section.css';var collaboration_section_module_default={container:`_container_w04ru_27`,label:`_label_w04ru_33`,security:`_security_w04ru_60`,disclosures:`_disclosures_w04ru_64`,icon:`_icon_w04ru_70`,access:`_access_w04ru_76`};function CollaborationSection(){let{formatMessage}=useIntl(),[restrictionError,setRestrictionError]=useState(),{addNotification}=useNotification(),{validateShieldRestriction}=useFormValidation(),{contactValue,containerRef,form,setForm,setUserContacts,shieldRestriction,userContacts}=useUnifiedShareFormContext(),{collaborationAccess,collaborationNotices,config,contactService,invitationFormNotices,isFetching,isSubmitting,item,onOpenChange,sharingService,variant}=useUnifiedShareModalContext(),{permissions={},type:itemType}=item,{getContacts,getContactsAvatarUrls}=contactService,{sendInvitations,sendSharedLink}=sharingService,isDesktop=variant===`desktop`,isInvitationForm=form==="default"||form===`invite`,isFormExpanded=form===`invite`||form===`email`,hasInviteMessage=form===`invite`&&config.collaborationMessage,hasEmailMessage=form===`email`&&config.sharedLinkEmailMessage,hasExternalUser=userContacts.some(contact=>contact.isExternalUser),formAction,formNotification;form===`invite`&&(formAction=sendInvitations,formNotification=`invite-collaborators`),form===`email`&&(formAction=sendSharedLink,formNotification=`email-shared-link`);let{errors,handleFormReset,handleFormSubmit,handleSelectedUsersChange,handleUserSelectorBlur,updateContactValue}=useCollaborationForm(formAction,formNotification),contactsForm=useRef(form===`email`?`email`:`invite`);useEffect(()=>{contactsForm.current=form===`email`?`email`:`invite`},[form]),useEffect(()=>{(!userContacts.length||!userContacts.some(contact=>contact.chipVariant===`error`))&&setRestrictionError(null)},[userContacts]);let stopEscapeKeyPropagation=useCallback(event=>(event.stopPropagation(),!0),[]),handleFetchUsers=useCallback(query=>getContacts?getContacts(query,contactsForm.current):Promise.resolve([]),[getContacts]),handleFetchAvatarUrls=useCallback(contacts=>getContactsAvatarUrls?getContactsAvatarUrls(contacts):Promise.resolve({}),[getContactsAvatarUrls]),handleContactValueChange=input=>{isFormExpanded||setForm(`invite`),updateContactValue(input)},handlePaste=useCallback(event=>{let value=event.clipboardData.getData(`text`);parseEmails(value).length!==0&&(event.preventDefault(),isFormExpanded||setForm(`invite`),handleSelectedUsersChange([...userContacts,{value}]))},[handleSelectedUsersChange,isFormExpanded,setForm,userContacts]),handleCancel=()=>{handleFormReset(),setForm(`default`)},handleSubmit=async()=>{try{if(restrictionError){let errorMessage=validateShieldRestriction(userContacts,shieldRestriction);if(errorMessage){addNotification({...getNotificationArgs(formatMessage,`error`),styledText:errorMessage});return}}if(await handleFormSubmit())return;handleFormReset(),onOpenChange(!1),setForm(`default`)}catch(error){if(!error.shieldRestriction)return;let{shieldRestriction:shieldRestrictionError}=error,restrictedContacts=[...shieldRestrictionError.restrictedEmails??[],...shieldRestrictionError.restrictedGroups??[]],updatedUserContacts=userContacts.map(contact=>restrictedContacts.includes(contact.email)||restrictedContacts.includes(`${contact.id}`)?{...contact,chipVariant:`error`}:contact);setRestrictionError(shieldRestrictionError),setUserContacts(updatedUserContacts)}},userContactsTooltip,isUserContactsDisabled=!1;isInvitationForm&&!permissions.canInviteCollaborator&&(userContactsTooltip=formatMessage(messages.inviteDisabledTooltip),isUserContactsDisabled=!0),isInvitationForm&&itemType===`web_link`&&(userContactsTooltip=formatMessage(messages.inviteWebLinkDisabledTooltip),isUserContactsDisabled=!0);let userContactsId=useUniqueId(`usm-UserContacts-`),UserContactsLabel=useLabelable(formatMessage(isInvitationForm?messages.invitePeopleLabel:messages.emailSharedLinkLabel),userContactsId);return jsxs(`form`,{className:collaboration_section_module_default.container,onSubmit:event=>event.preventDefault(),children:[restrictionError&&jsx(ShieldRestrictionNotice,{error:restrictionError,isLoading:isSubmitting,onSelectedUsersChange:handleSelectedUsersChange}),collaborationNotices,jsxs(`div`,{children:[isInvitationForm&&config.collaborators&&jsx(SharedWithAvatars,{}),jsx(UserContactsLabel,{className:collaboration_section_module_default.label}),jsx(Tooltip,{content:userContactsTooltip,"data-testid":`usm-UserContacts-tooltip`,open:userContactsTooltip?void 0:!1,side:`bottom`,children:jsx(Focusable,{focusable:isUserContactsDisabled,children:jsx(UserSelectorContainer,{autoFocus:permissions.canInviteCollaborator,className:`usm-UserContacts-input`,clearButtonAriaLabel:formatMessage(messages.clearButton),clearOnBlur:!1,"data-target-id":`PillSelectorDropdown-AddNamesOrEmailAddresses`,disabled:isUserContactsDisabled||isSubmitting,displayChipVariant:contact=>contact.chipVariant,error:errors.userContacts,fetchAvatarUrls:handleFetchAvatarUrls,fetchUsers:handleFetchUsers,hideOnEscape:stopEscapeKeyPropagation,idForLabel:userContactsId,inputValue:contactValue,label:null,onBlur:handleUserSelectorBlur,onInputValueChange:handleContactValueChange,onPaste:handlePaste,onSelectedUsersChange:handleSelectedUsersChange,placeholder:userContacts.length?``:formatMessage(messages.invitePeoplePlaceholder),portalElement:containerRef,selectedUsers:userContacts,selectOnEnterOrTab:!0,variant:isFormExpanded?`textarea`:`input`})})}),isInvitationForm&&jsxs(`div`,{className:collaboration_section_module_default.access,children:[config.collaborationRole&&jsx(CollaborationRole,{}),collaborationAccess]})]}),(hasInviteMessage||hasEmailMessage)&&jsx(TextAreaContainer,{maxCount:config.collaborationMessageLimit}),isFormExpanded&&(hasExternalUser||invitationFormNotices)&&jsxs(`div`,{className:collaboration_section_module_default.disclosures,children:[hasExternalUser&&jsxs(`div`,{className:collaboration_section_module_default.security,children:[jsx(Globe,{className:collaboration_section_module_default.icon,height:bpSize040,width:bpSize040}),jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:formatMessage(messages.contentSharedWithExternalCollaborators)})]}),invitationFormNotices]}),isFormExpanded&&containerRef&&createPortal(jsxs(Fragment,{children:[!isFetching&&jsxs(Modal.Footer,{children:[jsx(Modal.Footer.SecondaryButton,{disabled:isSubmitting,onClick:handleCancel,children:formatMessage(messages.cancelButton)}),jsx(Modal.Footer.PrimaryButton,{"data-target-id":`Modal.Footer.PrimaryButton-USMSendInvite`,loading:isSubmitting,loadingAriaLabel:formatMessage(messages.loadingLabel),onClick:handleSubmit,children:formatMessage(messages.sendButton)})]}),!isDesktop&&jsx(Modal.Close,{"aria-label":formatMessage(messages.closeButton),disabled:isSubmitting})]}),containerRef)]})}export{CollaborationSection as t};
|
|
1
|
+
import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{parseEmails}from"../esm/lib/utils/email.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{useFormValidation}from"../esm/lib/hooks/use-form-validation.js";import{useCollaborationForm}from"../esm/lib/hooks/use-collaboration-form.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{t as CollaborationRole}from"./collaboration-role.js";import{t as SharedWithAvatars}from"./shared-with-avatars.js";import{t as ShieldRestrictionNotice}from"./shield-restriction-notice.js";import{t as TextAreaContainer}from"./text-area-container.js";import{useCallback,useEffect,useRef,useState}from"react";import{useIntl}from"react-intl";import{Focusable,Modal,Text,Tooltip,useLabelable,useNotification,useUniqueId}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{createPortal}from"react-dom";import{Globe}from"@box/blueprint-web-assets/icons/Medium";import{bpSize040}from"@box/blueprint-web-assets/tokens/tokens";import{UserSelectorContainer}from"@box/user-selector";import '../styles/collaboration-section.css';var collaboration_section_module_default={container:`_container_w04ru_27`,label:`_label_w04ru_33`,security:`_security_w04ru_60`,disclosures:`_disclosures_w04ru_64`,icon:`_icon_w04ru_70`,access:`_access_w04ru_76`};function CollaborationSection(){let{formatMessage}=useIntl(),[restrictionError,setRestrictionError]=useState(),{addNotification}=useNotification(),{validateShieldRestriction}=useFormValidation(),{contactValue,containerRef,form,setForm,setUserContacts,shieldRestriction,userContacts}=useUnifiedShareFormContext(),{collaborationAccess,collaborationNotices,config,contactService,invitationFormNotices,isFetching,isSubmitting,item,onOpenChange,sharingService,suggestedCollaborators,variant}=useUnifiedShareModalContext(),{permissions={},type:itemType}=item,{getContacts,getContactsAvatarUrls}=contactService,{sendInvitations,sendSharedLink}=sharingService,isDesktop=variant===`desktop`,isInvitationForm=form==="default"||form===`invite`,isFormExpanded=form===`invite`||form===`email`,shouldShowSuggestedOptions=isInvitationForm&&contactValue.trim().length>0,hasInviteMessage=form===`invite`&&config.collaborationMessage,hasEmailMessage=form===`email`&&config.sharedLinkEmailMessage,hasExternalUser=userContacts.some(contact=>contact.isExternalUser),formAction,formNotification;form===`invite`&&(formAction=sendInvitations,formNotification=`invite-collaborators`),form===`email`&&(formAction=sendSharedLink,formNotification=`email-shared-link`);let{errors,handleFormReset,handleFormSubmit,handleSelectedUsersChange,handleUserSelectorBlur,updateContactValue}=useCollaborationForm(formAction,formNotification),contactsForm=useRef(form===`email`?`email`:`invite`);useEffect(()=>{contactsForm.current=form===`email`?`email`:`invite`},[form]),useEffect(()=>{(!userContacts.length||!userContacts.some(contact=>contact.chipVariant===`error`))&&setRestrictionError(null)},[userContacts]);let stopEscapeKeyPropagation=useCallback(event=>(event.stopPropagation(),!0),[]),handleFetchUsers=useCallback(query=>getContacts?getContacts(query,contactsForm.current):Promise.resolve([]),[getContacts]),handleFetchAvatarUrls=useCallback(contacts=>getContactsAvatarUrls?getContactsAvatarUrls(contacts):Promise.resolve({}),[getContactsAvatarUrls]),handleContactValueChange=input=>{isFormExpanded||setForm(`invite`),updateContactValue(input)},handlePaste=useCallback(event=>{let value=event.clipboardData.getData(`text`);parseEmails(value).length!==0&&(event.preventDefault(),isFormExpanded||setForm(`invite`),handleSelectedUsersChange([...userContacts,{value}]))},[handleSelectedUsersChange,isFormExpanded,setForm,userContacts]),handleCancel=()=>{handleFormReset(),setForm(`default`)},handleSubmit=async()=>{try{if(restrictionError){let errorMessage=validateShieldRestriction(userContacts,shieldRestriction);if(errorMessage){addNotification({...getNotificationArgs(formatMessage,`error`),styledText:errorMessage});return}}if(await handleFormSubmit())return;handleFormReset(),onOpenChange(!1),setForm(`default`)}catch(error){if(!error.shieldRestriction)return;let{shieldRestriction:shieldRestrictionError}=error,restrictedContacts=[...shieldRestrictionError.restrictedEmails??[],...shieldRestrictionError.restrictedGroups??[]],updatedUserContacts=userContacts.map(contact=>restrictedContacts.includes(contact.email)||restrictedContacts.includes(`${contact.id}`)?{...contact,chipVariant:`error`}:contact);setRestrictionError(shieldRestrictionError),setUserContacts(updatedUserContacts)}},userContactsTooltip,isUserContactsDisabled=!1;isInvitationForm&&!permissions.canInviteCollaborator&&(userContactsTooltip=formatMessage(messages.inviteDisabledTooltip),isUserContactsDisabled=!0),isInvitationForm&&itemType===`web_link`&&(userContactsTooltip=formatMessage(messages.inviteWebLinkDisabledTooltip),isUserContactsDisabled=!0);let userContactsId=useUniqueId(`usm-UserContacts-`),UserContactsLabel=useLabelable(formatMessage(isInvitationForm?messages.invitePeopleLabel:messages.emailSharedLinkLabel),userContactsId);return jsxs(`form`,{className:collaboration_section_module_default.container,onSubmit:event=>event.preventDefault(),children:[restrictionError&&jsx(ShieldRestrictionNotice,{error:restrictionError,isLoading:isSubmitting,onSelectedUsersChange:handleSelectedUsersChange}),collaborationNotices,jsxs(`div`,{children:[isInvitationForm&&config.collaborators&&jsx(SharedWithAvatars,{}),jsx(UserContactsLabel,{className:collaboration_section_module_default.label}),jsx(Tooltip,{content:userContactsTooltip,"data-testid":`usm-UserContacts-tooltip`,open:userContactsTooltip?void 0:!1,side:`bottom`,children:jsx(Focusable,{focusable:isUserContactsDisabled,children:jsx(UserSelectorContainer,{autoFocus:permissions.canInviteCollaborator,className:`usm-UserContacts-input`,clearButtonAriaLabel:formatMessage(messages.clearButton),clearOnBlur:!1,"data-target-id":`PillSelectorDropdown-AddNamesOrEmailAddresses`,disabled:isUserContactsDisabled||isSubmitting,displayChipVariant:contact=>contact.chipVariant,error:errors.userContacts,fetchAvatarUrls:handleFetchAvatarUrls,fetchUsers:handleFetchUsers,hideOnEscape:stopEscapeKeyPropagation,idForLabel:userContactsId,inputValue:contactValue,label:null,onBlur:handleUserSelectorBlur,onInputValueChange:handleContactValueChange,onPaste:handlePaste,onSelectedUsersChange:handleSelectedUsersChange,placeholder:userContacts.length?``:formatMessage(messages.invitePeoplePlaceholder),portalElement:containerRef,selectedUsers:userContacts,selectOnEnterOrTab:!0,suggestedOptions:shouldShowSuggestedOptions?suggestedCollaborators:void 0,variant:isFormExpanded?`textarea`:`input`})})}),isInvitationForm&&jsxs(`div`,{className:collaboration_section_module_default.access,children:[config.collaborationRole&&jsx(CollaborationRole,{}),collaborationAccess]})]}),(hasInviteMessage||hasEmailMessage)&&jsx(TextAreaContainer,{maxCount:config.collaborationMessageLimit}),isFormExpanded&&(hasExternalUser||invitationFormNotices)&&jsxs(`div`,{className:collaboration_section_module_default.disclosures,children:[hasExternalUser&&jsxs(`div`,{className:collaboration_section_module_default.security,children:[jsx(Globe,{className:collaboration_section_module_default.icon,height:bpSize040,width:bpSize040}),jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:formatMessage(messages.contentSharedWithExternalCollaborators)})]}),invitationFormNotices]}),isFormExpanded&&containerRef&&createPortal(jsxs(Fragment,{children:[!isFetching&&jsxs(Modal.Footer,{children:[jsx(Modal.Footer.SecondaryButton,{disabled:isSubmitting,onClick:handleCancel,children:formatMessage(messages.cancelButton)}),jsx(Modal.Footer.PrimaryButton,{"data-target-id":`Modal.Footer.PrimaryButton-USMSendInvite`,loading:isSubmitting,loadingAriaLabel:formatMessage(messages.loadingLabel),onClick:handleSubmit,children:formatMessage(messages.sendButton)})]}),!isDesktop&&jsx(Modal.Close,{"aria-label":formatMessage(messages.closeButton),disabled:isSubmitting})]}),containerRef)]})}export{CollaborationSection as t};
|
|
@@ -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{DEFAULT_COLLABORATION_ROLES,DEFAULT_CONFIGURATION}from"../constants.js";import{createContext,useContext,useEffect,useMemo,useState}from"react";import{jsx}from"react/jsx-runtime";var UnifiedShareModalContext=createContext(null),useUnifiedShareModalContext=()=>{let context=useContext(UnifiedShareModalContext);if(!context)throw Error(`useUnifiedShareModalContext must be used with UnifiedShareModalContext.Provider`);return context},UnifiedShareModalProvider=({children,collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isOpen,isSubmitting,item,onOpenChange,sharedLink,sharedLinkNotices,sharingService,variant})=>{let[collaborator,setCollaborator]=useState(null),[isLoading,setIsLoading]=useState(!1),[view,setView]=useState(`unified-share-form`);useEffect(()=>{isOpen||(setIsLoading(!1),setView(`unified-share-form`))},[isOpen]);let contextValue=useMemo(()=>({collaborationAccess,collaborationNotices,collaborationRoles:collaborationRoles??DEFAULT_COLLABORATION_ROLES,collaborator,collaborators:collaborators??[],config:{...DEFAULT_CONFIGURATION,...config},contactService:contactService??{},currentUser:currentUser??{},eventService:eventService??{},initialContacts:initialContacts??[],invitationFormNotices,isFetching,isOpen,isSubmitting:isSubmitting??isLoading,item,onOpenChange,setCollaborator,setIsLoading,setView,sharedLink:sharedLink??{},sharedLinkNotices,sharingService:sharingService??{},variant,view}),[collaborationAccess,collaborationNotices,collaborationRoles,collaborator,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isLoading,isOpen,isSubmitting,item,onOpenChange,sharedLink,sharedLinkNotices,sharingService,variant,view]);return jsx(UnifiedShareModalContext.Provider,{value:contextValue,children})};export{UnifiedShareModalContext,UnifiedShareModalProvider,useUnifiedShareModalContext};
|
|
1
|
+
import{DEFAULT_COLLABORATION_ROLES,DEFAULT_CONFIGURATION}from"../constants.js";import{createContext,useContext,useEffect,useMemo,useState}from"react";import{jsx}from"react/jsx-runtime";var UnifiedShareModalContext=createContext(null),useUnifiedShareModalContext=()=>{let context=useContext(UnifiedShareModalContext);if(!context)throw Error(`useUnifiedShareModalContext must be used with UnifiedShareModalContext.Provider`);return context},UnifiedShareModalProvider=({children,collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isOpen,isSubmitting,item,onOpenChange,sharedLink,sharedLinkNotices,sharingService,suggestedCollaborators,variant})=>{let[collaborator,setCollaborator]=useState(null),[isLoading,setIsLoading]=useState(!1),[view,setView]=useState(`unified-share-form`);useEffect(()=>{isOpen||(setIsLoading(!1),setView(`unified-share-form`))},[isOpen]);let contextValue=useMemo(()=>({collaborationAccess,collaborationNotices,collaborationRoles:collaborationRoles??DEFAULT_COLLABORATION_ROLES,collaborator,collaborators:collaborators??[],config:{...DEFAULT_CONFIGURATION,...config},contactService:contactService??{},currentUser:currentUser??{},eventService:eventService??{},initialContacts:initialContacts??[],invitationFormNotices,isFetching,isOpen,isSubmitting:isSubmitting??isLoading,item,onOpenChange,setCollaborator,setIsLoading,setView,sharedLink:sharedLink??{},sharedLinkNotices,sharingService:sharingService??{},suggestedCollaborators:suggestedCollaborators??[],variant,view}),[collaborationAccess,collaborationNotices,collaborationRoles,collaborator,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isLoading,isOpen,isSubmitting,item,onOpenChange,sharedLink,sharedLinkNotices,sharingService,suggestedCollaborators,variant,view]);return jsx(UnifiedShareModalContext.Provider,{value:contextValue,children})};export{UnifiedShareModalContext,UnifiedShareModalProvider,useUnifiedShareModalContext};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{UnifiedShareModalProvider}from"./contexts/unified-share-modal-context.js";import{UnifiedShareBase}from"./unified-share-base.js";import{useCallback,useEffect,useState}from"react";import{jsx}from"react/jsx-runtime";function UnifiedShareModal({children,collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isOpen:isControlledOpen,isSubmitting,item,onLoad,onOpenChange,sharedLink,sharedLinkNotices,sharingService,variant=`modal`}){let[isOpen,setIsOpen]=useState(isControlledOpen??(!children||variant===`desktop`)),[isLoading,setIsLoading]=useState(!!onLoad);useEffect(()=>{isControlledOpen!==void 0&&setIsOpen(isControlledOpen)},[isControlledOpen]),useEffect(()=>{(async()=>{onLoad&&(isOpen&&await onLoad(),setIsLoading(!isOpen))})()},[isOpen,onLoad]);let handleOpenChange=useCallback(open=>{isControlledOpen===void 0&&variant!==`desktop`&&setIsOpen(open),onOpenChange&&onOpenChange(open)},[isControlledOpen,onOpenChange,variant]);return jsx(UnifiedShareModalProvider,{collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching:isFetching??isLoading,isOpen,isSubmitting,item,onOpenChange:handleOpenChange,sharedLink,sharedLinkNotices,sharingService,variant,children:jsx(UnifiedShareBase,{children})})}export{UnifiedShareModal};
|
|
1
|
+
import{UnifiedShareModalProvider}from"./contexts/unified-share-modal-context.js";import{UnifiedShareBase}from"./unified-share-base.js";import{useCallback,useEffect,useState}from"react";import{jsx}from"react/jsx-runtime";function UnifiedShareModal({children,collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isOpen:isControlledOpen,isSubmitting,item,onLoad,onOpenChange,sharedLink,sharedLinkNotices,sharingService,suggestedCollaborators,variant=`modal`}){let[isOpen,setIsOpen]=useState(isControlledOpen??(!children||variant===`desktop`)),[isLoading,setIsLoading]=useState(!!onLoad);useEffect(()=>{isControlledOpen!==void 0&&setIsOpen(isControlledOpen)},[isControlledOpen]),useEffect(()=>{(async()=>{onLoad&&(isOpen&&await onLoad(),setIsLoading(!isOpen))})()},[isOpen,onLoad]);let handleOpenChange=useCallback(open=>{isControlledOpen===void 0&&variant!==`desktop`&&setIsOpen(open),onOpenChange&&onOpenChange(open)},[isControlledOpen,onOpenChange,variant]);return jsx(UnifiedShareModalProvider,{collaborationAccess,collaborationNotices,collaborationRoles,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching:isFetching??isLoading,isOpen,isSubmitting,item,onOpenChange:handleOpenChange,sharedLink,sharedLinkNotices,sharingService,suggestedCollaborators,variant,children:jsx(UnifiedShareBase,{children})})}export{UnifiedShareModal};
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, ReactElement, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
import { SuggestedCollaborator, UserContactType } from '@box/user-selector';
|
|
3
3
|
import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User, VariantType, ViewType } from '../types';
|
|
4
4
|
export interface UnifiedShareModalContextValue {
|
|
5
5
|
collaborationAccess?: ReactElement;
|
|
@@ -24,6 +24,7 @@ export interface UnifiedShareModalContextValue {
|
|
|
24
24
|
sharedLink: Partial<SharedLink>;
|
|
25
25
|
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
26
26
|
sharingService: SharingService;
|
|
27
|
+
suggestedCollaborators?: SuggestedCollaborator[];
|
|
27
28
|
variant: VariantType;
|
|
28
29
|
view: ViewType;
|
|
29
30
|
}
|
|
@@ -49,6 +50,7 @@ export interface UnifiedShareModalProviderProps {
|
|
|
49
50
|
sharedLink?: SharedLink;
|
|
50
51
|
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
51
52
|
sharingService?: SharingService;
|
|
53
|
+
suggestedCollaborators?: SuggestedCollaborator[];
|
|
52
54
|
variant: VariantType;
|
|
53
55
|
}
|
|
54
|
-
export declare const UnifiedShareModalProvider: ({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen, isSubmitting, item, onOpenChange, sharedLink, sharedLinkNotices, sharingService, variant, }: UnifiedShareModalProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare const UnifiedShareModalProvider: ({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen, isSubmitting, item, onOpenChange, sharedLink, sharedLinkNotices, sharingService, suggestedCollaborators, variant, }: UnifiedShareModalProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
import { UserContactType, SuggestedCollaborator } from '@box/user-selector';
|
|
3
3
|
import { UnifiedShareModalContextValue } from '../contexts';
|
|
4
4
|
import { UnifiedShareModalProps } from '../unified-share-modal';
|
|
5
5
|
import { CollaborationRole, Collaborator, Configuration, Item, SharedLink, SharedLinkSettings } from '../types';
|
|
@@ -8,6 +8,7 @@ export declare const mockCollaborators: Collaborator[];
|
|
|
8
8
|
export declare const mockCollaboratorsExtended: Collaborator[];
|
|
9
9
|
export declare const mockConfiguration: Configuration;
|
|
10
10
|
export declare const mockContacts: UserContactType[];
|
|
11
|
+
export declare const mockSuggestedCollaborators: SuggestedCollaborator[];
|
|
11
12
|
export declare const mockContactService: {
|
|
12
13
|
getContacts: (input: any) => Promise<UserContactType[]>;
|
|
13
14
|
getContactsByEmail: (emails: string[]) => Promise<Record<string, UserContactType>>;
|
|
@@ -25,11 +26,15 @@ export declare const mockItemPermissions: {
|
|
|
25
26
|
canShare: boolean;
|
|
26
27
|
};
|
|
27
28
|
export declare const mockBoxFile: Item;
|
|
29
|
+
export declare const mockBoxFileViewer: Item;
|
|
28
30
|
export declare const mockBoxFolder: Item;
|
|
29
31
|
export declare const mockWorkflow: Item;
|
|
30
32
|
export declare const mockPrompt: Item;
|
|
31
33
|
export declare const mockSharedLinkSettings: SharedLinkSettings;
|
|
32
34
|
export declare const mockSharedLink: SharedLink;
|
|
35
|
+
export declare const mockSharedLinkOtpOff: SharedLink;
|
|
36
|
+
export declare const mockSharedLinkOtpOpen: SharedLink;
|
|
37
|
+
export declare const mockSharedLinkOtpAllowlist: SharedLink;
|
|
33
38
|
export declare const useMockSharedLink: (sharedLinkArg: any) => {
|
|
34
39
|
sharedLink: SharedLink;
|
|
35
40
|
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
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { UserContactType } from '@box/user-selector';
|
|
2
|
+
import { UserContactType, SuggestedCollaborator } from '@box/user-selector';
|
|
3
3
|
import { CollaborationRole, Collaborator, Configuration, ContactService, EventService, Item, SharedLink, SharingService, User, VariantType } from './types';
|
|
4
4
|
export interface UnifiedShareModalProps {
|
|
5
5
|
/**
|
|
@@ -90,6 +90,10 @@ export interface UnifiedShareModalProps {
|
|
|
90
90
|
* The service for managing the collaborations and shared link of the item.
|
|
91
91
|
*/
|
|
92
92
|
sharingService?: SharingService;
|
|
93
|
+
/**
|
|
94
|
+
* Candidate collaborators to prioritize in invite dropdown results.
|
|
95
|
+
*/
|
|
96
|
+
suggestedCollaborators?: SuggestedCollaborator[];
|
|
93
97
|
/**
|
|
94
98
|
* The variant of the Unified Share Modal.
|
|
95
99
|
*
|
|
@@ -99,4 +103,4 @@ export interface UnifiedShareModalProps {
|
|
|
99
103
|
*/
|
|
100
104
|
variant?: VariantType;
|
|
101
105
|
}
|
|
102
|
-
export declare function UnifiedShareModal({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen: isControlledOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharedLinkNotices, sharingService, variant, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
|
|
106
|
+
export declare function UnifiedShareModal({ children, collaborationAccess, collaborationNotices, collaborationRoles, collaborators, config, contactService, currentUser, eventService, initialContacts, invitationFormNotices, isFetching, isOpen: isControlledOpen, isSubmitting, item, onLoad, onOpenChange, sharedLink, sharedLinkNotices, sharingService, suggestedCollaborators, variant, }: UnifiedShareModalProps): import("react/jsx-runtime").JSX.Element;
|