@box/unified-share-modal 3.5.25 → 3.6.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/access-list.js +1 -0
- package/dist/chunks/collaboration-role.js +1 -1
- package/dist/chunks/collaboration-section.js +1 -1
- package/dist/chunks/collaborator-list-item.js +1 -1
- package/dist/chunks/collaborator-list.js +1 -1
- package/dist/chunks/manage-access-list-modal.js +1 -0
- package/dist/chunks/otp-section.js +1 -1
- package/dist/chunks/shared-link-footer.js +1 -1
- package/dist/chunks/shared-link-section.js +1 -1
- package/dist/chunks/shared-with-avatars.js +1 -1
- package/dist/chunks/shield-restriction-notice.js +1 -1
- package/dist/esm/lib/components/index.js +1 -1
- package/dist/esm/lib/components/manage-access-list-modal/access-list.js +1 -0
- package/dist/esm/lib/components/manage-access-list-modal/index.js +1 -0
- package/dist/esm/lib/components/manage-access-list-modal/manage-access-list-modal.js +1 -0
- package/dist/esm/lib/components/manage-access-list-modal/messages.js +1 -0
- package/dist/esm/lib/components/shared-link-settings-modal/shared-link-settings.js +1 -1
- package/dist/esm/lib/constants.js +1 -1
- package/dist/esm/lib/containers/index.js +1 -0
- package/dist/esm/lib/containers/manage-access-list-container.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/hooks/use-collaboration-form.js +1 -1
- package/dist/esm/lib/hooks/use-link-settings-form.js +1 -1
- package/dist/esm/lib/hooks/use-permission-levels.js +1 -1
- package/dist/esm/lib/hooks/use-sharing-action.js +1 -1
- package/dist/esm/lib/messages.js +1 -1
- package/dist/esm/lib/unified-share-base.js +1 -1
- package/dist/esm/lib/utils/index.js +1 -1
- package/dist/esm/lib/utils/validation.js +1 -1
- package/dist/styles/access-list.css +1 -0
- package/dist/styles/manage-access-list-modal.css +1 -0
- package/dist/types/lib/components/index.d.ts +1 -0
- package/dist/types/lib/components/manage-access-list-modal/access-list.d.ts +7 -0
- package/dist/types/lib/components/manage-access-list-modal/index.d.ts +1 -0
- package/dist/types/lib/components/manage-access-list-modal/manage-access-list-modal.d.ts +10 -0
- package/dist/types/lib/components/manage-access-list-modal/messages.d.ts +113 -0
- package/dist/types/lib/components/shared-link-settings-modal/otp-section.d.ts +2 -2
- package/dist/types/lib/constants.d.ts +2 -1
- package/dist/types/lib/containers/index.d.ts +1 -0
- package/dist/types/lib/containers/manage-access-list-container.d.ts +1 -0
- package/dist/types/lib/contexts/shared-link-settings-context.d.ts +3 -3
- package/dist/types/lib/contexts/unified-share-modal-context.d.ts +1 -1
- package/dist/types/lib/hooks/use-form-validation.d.ts +1 -1
- package/dist/types/lib/hooks/use-link-settings-form.d.ts +2 -2
- package/dist/types/lib/hooks/use-sharing-action.d.ts +3 -5
- package/dist/types/lib/messages.d.ts +5 -5
- package/dist/types/lib/stories/shared.d.ts +6 -21
- package/dist/types/lib/types.d.ts +32 -3
- package/dist/types/lib/unified-share-modal.d.ts +1 -1
- package/dist/types/lib/utils/validation.d.ts +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{formatDateFromTimestampToDateString}from"../esm/lib/utils/date.js";import messages from"../esm/lib/components/manage-access-list-modal/messages.js";import{useIntl}from"react-intl";import{Cell,Column,EllipsizableText,IconButton,Row,Status,Table,TableBody,TableHeader,Tooltip}from"@box/blueprint-web";import{Trash}from"@box/blueprint-web-assets/icons/Medium";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/access-list.css';var access_list_module_default={item:`_item_1sy1e_1`,remove:`_remove_1sy1e_7`};function AccessList({entries,isDisabled=!1,onRemove}){let{formatMessage}=useIntl();return jsxs(Table,{"aria-label":formatMessage(messages.listLabel),children:[jsxs(TableHeader,{children:[jsx(Column,{isRowHeader:!0,width:`2fr`,children:formatMessage(messages.itemColumn)}),jsx(Column,{width:`1fr`,children:formatMessage(messages.dateColumn)}),jsx(Column,{hideHeader:!0,width:70,children:formatMessage(messages.removeColumn)})]}),jsx(TableBody,{children:entries.map(({createdAt,type,value})=>jsxs(Row,{children:[jsx(Cell,{children:jsxs(`div`,{className:access_list_module_default.item,children:[jsx(EllipsizableText,{as:`span`,lineClamp:1,children:value}),type===`domain`&&jsx(Status,{colorIndex:0,text:formatMessage(messages.domainBadge)})]})}),jsx(Cell,{children:jsx(EllipsizableText,{as:`span`,lineClamp:1,children:formatDateFromTimestampToDateString(createdAt)})}),jsx(Cell,{children:jsx(`div`,{className:access_list_module_default.remove,children:jsx(Tooltip,{content:formatMessage(messages.removeButton),children:jsx(IconButton,{"aria-label":formatMessage(messages.removeButton),disabled:isDisabled,icon:Trash,onClick:()=>onRemove(value)})})})})]},value))})]})}export{AccessList as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getDefaultCollaborationRole,isInvitationRoleSupported}from"../esm/lib/utils/collaborator.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import messages from"../esm/lib/components/unified-share-form-modal/messages.js";import messages$1 from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{useEffect,useMemo,useState}from"react";import{useIntl}from"react-intl";import{DropdownMenu,Focusable,Tooltip,TriggerButton}from"@box/blueprint-web";import camelCase from"lodash/camelCase";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/collaboration-role.css';var collaboration_role_module_default={button:`_button_jl1fl_1`,focusable:`_focusable_jl1fl_10`,content:`_content_jl1fl_14`,option:`_option_jl1fl_17`};function CollaborationRole(){let{formatMessage}=useIntl(),[isMenuOpen,setIsMenuOpen]=useState(!1),{collaborationRole,setCollaborationRole}=useUnifiedShareFormContext(),{collaborationRoles,eventService,isSubmitting,item,variant}=useUnifiedShareModalContext(),{permissions={},type:itemType}=item,{onCollaborationRoleChange}=eventService,isDesktop=variant===`desktop`,roles=useMemo(()=>collaborationRoles.map(role=>{let{description,id,label}=role,isRoleSupported=isInvitationRoleSupported(id),messageId=camelCase(id),descriptionMessageId=messageId;id===`editor`&&itemType===`folder`&&(descriptionMessageId+=`Folder`);let defaultLabel=id,defaultDescription=``;return isRoleSupported&&(defaultLabel=formatMessage(messages[`${messageId}Role`]),defaultDescription=formatMessage(messages$1[`${descriptionMessageId}Description`])),{...role,description:description??defaultDescription,label:label??defaultLabel}}),[collaborationRoles,formatMessage,itemType]);if(useEffect(()=>{setCollaborationRole(getDefaultCollaborationRole(roles))},[roles,setCollaborationRole]),!roles.length||!collaborationRole)return null;let{id:selectedId,label:selectedLabel}=collaborationRole,disabledTooltipMessage;return permissions.canInviteCollaborator||(disabledTooltipMessage=formatMessage(messages$1.inviteDisabledTooltip)),itemType===`web_link`&&(disabledTooltipMessage=formatMessage(messages$1.inviteWebLinkDisabledTooltip)),disabledTooltipMessage?jsx(Tooltip,{align:`start`,content:disabledTooltipMessage,"data-testid":`usm-CollaborationRole-tooltip`,side:`bottom`,children:jsx(Focusable,{className:collaboration_role_module_default.focusable,children:jsx(TriggerButton,{caretDirection:`down`,className:collaboration_role_module_default.button,disabled:!0,label:formatMessage(messages$1.inviteAsRoleLabel,{role:selectedLabel}),size:`extraSmall`,variant:`tertiary`})})}):jsxs(DropdownMenu.Root,{isFullScreenEnabled:isDesktop,menuItemsSize:`medium`,onOpenChange:setIsMenuOpen,open:isMenuOpen,children:[jsx(DropdownMenu.Trigger,{children:jsx(TriggerButton,{caretDirection:isMenuOpen?`up`:`down`,className:collaboration_role_module_default.button,"data-target-id":`PlainButton-InviteePermissionsMenuToggle`,disabled:isSubmitting,label:formatMessage(messages$1.inviteAsRoleLabel,{role:selectedLabel}),size:`extraSmall`,variant:`tertiary`})}),jsxs(DropdownMenu.Content,{align:`start`,className:collaboration_role_module_default.content,children:[isDesktop&&jsxs(DropdownMenu.Header,{children:[jsx(DropdownMenu.Header.MenuCloseButton,{"aria-label":formatMessage(messages$1.closeButton),iconVariant:`back`}),jsx(DropdownMenu.Header.TextContent,{title:formatMessage(messages$1.invitePeopleLabel)})]}),roles.map(role=>{let{description,isDisabled,id,label}=role;return jsx(DropdownMenu.CheckboxItem,{checked:selectedId===id,disabled:isDisabled,onSelect:()=>{setCollaborationRole(role),onCollaborationRoleChange&&onCollaborationRoleChange(id)},children:jsx(DropdownMenu.Item.MainContent,{caption:description,className:collaboration_role_module_default.option,label})},id)})]})]})}export{CollaborationRole as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{parseEmails}from"../esm/lib/utils/email.js";import{getNotificationArgs}from"../esm/lib/utils/notification.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.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{Globe}from"@box/blueprint-web-assets/icons/Medium";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{createPortal}from"react-dom";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,onFormReset,onFormSubmit,onSelectedUsersChange,onUserSelectorBlur,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`),onSelectedUsersChange([...userContacts,{value}]))},[onSelectedUsersChange,isFormExpanded,setForm,userContacts]),handleCancel=()=>{onFormReset(),setForm(`default`)},handleSubmit=async()=>{try{if(restrictionError){let errorMessage=validateShieldRestriction(userContacts,shieldRestriction);if(errorMessage){addNotification({...getNotificationArgs(formatMessage,`error`),styledText:errorMessage});return}}if(await onFormSubmit())return;onFormReset(),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}),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:onUserSelectorBlur,onInputValueChange:handleContactValueChange,onPaste:handlePaste,onSelectedUsersChange,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isCollaboratorRoleSupported}from"../esm/lib/utils/collaborator.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import messages from"../esm/lib/components/unified-share-form-modal/collaborator-list/messages.js";import{CollaboratorAvatar}from"../esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js";import messages$1 from"../esm/lib/components/unified-share-form-modal/messages.js";import{useIntl}from"react-intl";import{Cell,EllipsizableText,IconButton,Row,Tooltip}from"@box/blueprint-web";import camelCase from"lodash/camelCase";import{jsx,jsxs}from"react/jsx-runtime";import{XMark}from"@box/blueprint-web-assets/icons/Fill";import '../styles/collaborator-list-item.css';var collaborator_list_item_module_default={nameCell:`_nameCell_19s89_1`,nameDetails:`_nameDetails_19s89_7`,roleCell:`_roleCell_19s89_17`};function CollaboratorListItem({collaborator,isSmall}){let{formatMessage}=useIntl(),{email,hasCustomRole,id,isPending,isRemovable,name,role}=collaborator,{item,setCollaborator,setView}=useUnifiedShareModalContext(),{permissions={}}=item,roleDefaultLabel=isCollaboratorRoleSupported(role)?formatMessage(messages$1[`${camelCase(role)}Role`]):``,collaboratorRole=hasCustomRole?role:roleDefaultLabel;return jsxs(Row,{id,children:[jsx(Cell,{children:jsxs(`div`,{className:collaborator_list_item_module_default.nameCell,children:[jsx(CollaboratorAvatar,{collaborator,isBadgeable:!0,size:`large`}),jsxs(`div`,{className:collaborator_list_item_module_default.nameDetails,children:[jsx(EllipsizableText,{as:`span`,lineClamp:1,variant:`bodyDefaultSemibold`,children:name}),email&&jsx(EllipsizableText,{as:`span`,color:`textOnLightSecondary`,lineClamp:1,variant:`caption`,children:email})]})]})}),!isSmall&&jsx(Cell,{children:jsxs(`div`,{className:collaborator_list_item_module_default.roleCell,children:[jsx(EllipsizableText,{as:`span`,color:`textOnLightSecondary`,lineClamp:1,children:isPending?formatMessage(messages.pendingRole):collaboratorRole}),isRemovable&&permissions.canRemoveCollaborator&&jsx(Tooltip,{content:formatMessage(messages.removeButton),children:jsx(IconButton,{"aria-label":formatMessage(messages.removeButton),icon:XMark,onClick:()=>{setCollaborator(collaborator),setView(`remove-collaborator`)}})})]})})]})}export{CollaboratorListItem as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import messages from"../esm/lib/components/unified-share-form-modal/collaborator-list/messages.js";import{t as CollaboratorListItem}from"./collaborator-list-item.js";import{useIntl}from"react-intl";import{Breakpoint,Column,Divider,Link,Modal,Table,TableBody,TableHeader,useBreakpoint}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{createPortal}from"react-dom";import '../styles/collaborator-list.css';var collaborator_list_module_default={divider:`_divider_ozw7g_1`,manage:`_manage_ozw7g_8`,link:`_link_ozw7g_14`,list:`_list_ozw7g_18`,scroll:`_scroll_ozw7g_34`,header:`_header_ozw7g_40`};function CollaboratorList(){let{formatMessage}=useIntl(),isSmall=useBreakpoint()===Breakpoint.Small,{collaborators,config,eventService,isFetching,isSubmitting,item,variant}=useUnifiedShareModalContext(),{id:itemId,type:itemType}=item,{onCollaboratorsManagementClick}=eventService,isDesktop=variant===`desktop`,{containerRef,setIsCollaboratorsOpen}=useUnifiedShareFormContext();return jsxs(Fragment,{children:[isDesktop&&jsx(Divider,{className:collaborator_list_module_default.divider}),config.collaboratorsManagement&&jsx(`div`,{className:collaborator_list_module_default.manage,children:onCollaboratorsManagementClick?jsx(Link,{className:collaborator_list_module_default.link,onClick:onCollaboratorsManagementClick,onKeyDown:callOnKeyboardEvent(onCollaboratorsManagementClick,{canPreventDefault:!0}),role:`button`,tabIndex:0,variant:`standalone`,children:formatMessage(messages.manageAllLink)}):jsx(Link,{href:`/${itemType}/${itemId}/collaborators`,rel:`noopener`,target:`_blank`,variant:`standalone`,children:formatMessage(messages.manageAllLink)})}),jsx(`div`,{className:collaborator_list_module_default.list,children:jsx(`div`,{className:collaborator_list_module_default.scroll,children:jsxs(Table,{"aria-label":formatMessage(messages.listLabel),children:[jsxs(TableHeader,{className:collaborator_list_module_default.header,children:[jsx(Column,{hideHeader:!0,isRowHeader:!0,width:`11fr`,children:formatMessage(messages.nameColumn)}),!isSmall&&jsx(Column,{hideHeader:!0,width:`10fr`,children:formatMessage(messages.roleColumn)})]}),jsx(TableBody,{children:collaborators.slice(0,config.collaboratorsLimit).map(collaborator=>jsx(CollaboratorListItem,{collaborator,isSmall},collaborator.id))})]})})}),containerRef&&createPortal(jsxs(Fragment,{children:[!isFetching&&jsx(Modal.Footer,{children:jsx(Modal.Footer.SecondaryButton,{onClick:()=>setIsCollaboratorsOpen(!1),children:formatMessage(messages.doneButton)})}),!isDesktop&&jsx(Modal.Close,{"aria-label":formatMessage(messages.closeButton),disabled:isSubmitting})]}),containerRef)]})}export{CollaboratorList as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isDomainValid,isEmailValid}from"../esm/lib/utils/validation.js";import messages from"../esm/lib/components/manage-access-list-modal/messages.js";import{t as AccessList}from"./access-list.js";import{useEffect,useMemo,useState}from"react";import clsx from"clsx";import noop from"lodash/noop";import{useIntl}from"react-intl";import{Button,Divider,Modal,SearchInput,Text,TextInput}from"@box/blueprint-web";import{Plus}from"@box/blueprint-web-assets/icons/Medium";import{jsx,jsxs}from"react/jsx-runtime";import '../styles/manage-access-list-modal.css';var manage_access_list_modal_module_default={content:`_content_1hi1x_1`,isFullscreen:`_isFullscreen_1hi1x_1`,body:`_body_1hi1x_10`,divider:`_divider_1hi1x_23`,add:`_add_1hi1x_31`},INPUT_MAX_LENGTH=255;function ManageAccessListModal({entries:initialEntries,isDesktop=!1,isOpen,isSubmitting=!1,onOpenChange,onSubmit}){let{formatMessage}=useIntl(),[entries,setEntries]=useState(initialEntries),[inputValue,setInputValue]=useState(``),[inputError,setInputError]=useState(``),[searchValue,setSearchValue]=useState(``),[isInputVisible,setIsInputVisible]=useState(!1);useEffect(()=>{entries.length||setIsInputVisible(!0)},[entries]);let listItems=useMemo(()=>{let query=searchValue.trim().toLowerCase(),items=[...entries].sort((a,b)=>b.createdAt-a.createdAt);return query?items.filter(({value})=>value.toLowerCase().includes(query)):items},[entries,searchValue]),handleInputSubmit=()=>{let input=inputValue.trim();if(!input||entries.some(({value})=>value.toLowerCase()===input.toLowerCase()))return setInputValue(``),entries;if(input.length>INPUT_MAX_LENGTH)return setInputError(formatMessage(messages.inputMaxLengthError)),null;let type=input.includes(`@`)?`email`:`domain`;if(type===`email`&&!isEmailValid(input)||type===`domain`&&!isDomainValid(input))return setInputError(formatMessage(messages.inputInvalidError)),null;let nextEntries=[{createdAt:Date.now(),type,value:input},...entries];return setInputValue(``),setEntries(nextEntries),nextEntries};return jsx(Modal,{onOpenChange:isSubmitting?noop:onOpenChange,open:isOpen,children:jsxs(Modal.Content,{className:clsx(manage_access_list_modal_module_default.content,isDesktop&&manage_access_list_modal_module_default.isFullscreen),onEscapeKeyDown:event=>{event.stopPropagation()},onPointerDownOutside:event=>{event.preventDefault()},size:`large`,children:[jsx(Modal.Header,{children:formatMessage(messages.title)}),jsx(Modal.ScrollableContainer,{children:jsxs(Modal.Body,{className:manage_access_list_modal_module_default.body,children:[isDesktop&&jsx(Divider,{className:manage_access_list_modal_module_default.divider}),jsx(Text,{as:`p`,children:formatMessage(messages.description)}),jsx(SearchInput.Controlled,{onChange:event=>setSearchValue(event.target.value),onClearInput:()=>setSearchValue(``),placeholder:formatMessage(messages.searchPlaceholder),searchInputAriaLabel:formatMessage(messages.searchLabel),searchInputClearAriaLabel:formatMessage(messages.clearButton),value:searchValue}),isInputVisible&&jsx(TextInput,{autoFocus:!0,disabled:isSubmitting,error:inputError,hideLabel:!0,label:formatMessage(messages.inputLabel),onChange:event=>{setInputError(``),setInputValue(event.target.value)},onKeyDown:event=>{event.key===`Enter`&&!isSubmitting&&handleInputSubmit()},placeholder:formatMessage(messages.inputPlaceholder),value:inputValue}),jsx(AccessList,{entries:listItems,isDisabled:isSubmitting,onRemove:target=>{setEntries(prev=>prev.filter(({value})=>value!==target))}}),listItems.length===0&&jsx(Text,{as:`p`,color:`textOnLightSecondary`,children:formatMessage(searchValue.trim()?messages.noSearchResults:messages.emptyAccessList)})]})}),jsxs(Modal.Footer,{children:[jsx(Button,{className:manage_access_list_modal_module_default.add,disabled:isSubmitting,onClick:()=>setIsInputVisible(!0),size:`large`,startIcon:Plus,variant:`tertiary`,children:formatMessage(messages.addButton)}),jsx(Modal.Footer.SecondaryButton,{disabled:isSubmitting,onClick:()=>onOpenChange(!1),children:formatMessage(messages.cancelButton)}),jsx(Modal.Footer.PrimaryButton,{loading:isSubmitting,loadingAriaLabel:formatMessage(messages.loadingLabel),onClick:()=>{let validEntries=handleInputSubmit();validEntries&&onSubmit(validEntries)},children:formatMessage(messages.saveButton)})]}),!isDesktop&&jsx(Modal.Close,{"aria-label":formatMessage(messages.closeButton),disabled:isSubmitting})]})})}export{ManageAccessListModal as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OTP_MODE}from"../esm/lib/constants.js";import messages from"../esm/lib/components/shared-link-settings-modal/messages.js";import{useIntl}from"react-intl";import{Button,Radio,Switch,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import '../styles/otp-section.css';var otp_section_module_default={toggle:`_toggle_2m015_1`,recommendedBadge:`_recommendedBadge_2m015_7`,countBadge:`_countBadge_2m015_8`,modeSelector:`_modeSelector_2m015_26`,allowlist:`_allowlist_2m015_33`};function OtpSection({
|
|
1
|
+
import{OTP_MODE}from"../esm/lib/constants.js";import messages from"../esm/lib/components/shared-link-settings-modal/messages.js";import{useIntl}from"react-intl";import{Button,Radio,Switch,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import '../styles/otp-section.css';var otp_section_module_default={toggle:`_toggle_2m015_1`,recommendedBadge:`_recommendedBadge_2m015_7`,countBadge:`_countBadge_2m015_8`,modeSelector:`_modeSelector_2m015_26`,allowlist:`_allowlist_2m015_33`};function OtpSection({accessCount,canChange,isAvailable,isChecked,isDisabled,onConfigureClick,onModeChange,onToggle,otpMode}){let{formatMessage}=useIntl();if(!isAvailable)return null;let isSectionDisabled=isDisabled||!canChange;return jsxs(Fragment,{children:[jsxs(`div`,{className:otp_section_module_default.toggle,children:[jsx(Switch.Item,{checked:isChecked,disabled:isSectionDisabled,label:formatMessage(messages.otpToggleText),onCheckedChange:onToggle,value:`otp-settings`}),!isSectionDisabled&&jsx(Text,{as:`span`,className:otp_section_module_default.recommendedBadge,color:`textOnLightDefault`,variant:`captionBold`,children:formatMessage(messages.otpRecommendedBadge)})]}),isChecked&&jsxs(`div`,{className:otp_section_module_default.modeSelector,children:[jsx(Radio.Legend,{header:formatMessage(messages.otpModeSelectorLegend),children:jsxs(Radio.Group,{disabled:isSectionDisabled,onValueChange:value=>onModeChange(value),value:otpMode,children:[jsx(Radio.Item,{label:formatMessage(messages.otpModeOpenLabel),value:OTP_MODE.OPEN}),jsx(Radio.Item,{label:formatMessage(messages.otpModeAccessListLabel),value:OTP_MODE.ALLOWLIST})]})}),otpMode===OTP_MODE.ALLOWLIST&&jsxs(`div`,{className:otp_section_module_default.allowlist,children:[jsx(Button,{disabled:isSectionDisabled,onClick:onConfigureClick,size:`small`,variant:`secondary`,children:formatMessage(messages.otpConfigureButton)}),accessCount>0&&jsxs(Fragment,{children:[jsx(Text,{as:`span`,color:`textOnLightSecondary`,variant:`bodyDefault`,children:formatMessage(messages.otpAccessListLabel)}),jsx(Text,{as:`span`,className:otp_section_module_default.countBadge,color:`textOnLightDefault`,variant:`captionBold`,children:formatMessage(messages.otpAccessListCountBadge,{count:accessCount})})]})]})]})]})}export{OtpSection as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{OTP_MODE}from"../esm/lib/constants.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.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{Globe,Lock}from"@box/blueprint-web-assets/icons/Medium";import{jsx,jsxs}from"react/jsx-runtime";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({isSubmitting,label,onClick}){return jsx(Link,{"aria-disabled":isSubmitting,"aria-haspopup":`dialog`,className:shared_link_footer_module_default.settings,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,setView,sharedLink,sharedLinkNotices}=useUnifiedShareModalContext(),{permissions={}}=item,{canSetShareAccess}=permissions,{access,settings={},permission}=sharedLink,{canChangeOtp,isOtpAvailable,otpAccessEntries,otpAllowlistItemCount,otpMode=OTP_MODE.NONE}=settings,{onOtpAllowlistConfigure}=eventService,otpAccessCount=otpAccessEntries?otpAccessEntries.length:otpAllowlistItemCount,isEditPermission=permission===`can_edit`,isOpenAccess=access===`open`,isCompanyEditable=access===`company`&&isEditPermission,isOtpNoticeVisible=isOpenAccess&&isOtpAvailable&&(canChangeOtp||otpMode!==`none`),handleOtpConfigureClick=()=>{if(!isSubmitting){if(onOtpAllowlistConfigure){onOtpAllowlistConfigure();return}setView(`manage-access-list`)}};return isOtpNoticeVisible?jsxs(`div`,{className:shared_link_footer_module_default.disclosures,children:[otpMode===`none`&&jsx(FooterRow,{icon:Globe,children:formatMessage(messages.sharedLinkOtpOffPrompt,{enableLink:canSetShareAccess&&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=canSetShareAccess&&canChangeOtp?jsx(SettingsLink,{isSubmitting,label:formatMessage(messages.sharedLinkConfigureAccessList),onClick:handleOtpConfigureClick}):``;return canSetShareAccess&&otpAccessCount!==void 0?formatMessage(messages.sharedLinkOtpAccessListCount,{count:otpAccessCount,configureLink}):formatMessage(messages.sharedLinkOtpAccessList,{configureLink})})()}),sharedLinkNotices]}):!isOpenAccess&&!isCompanyEditable&&!sharedLinkNotices?null:jsxs(`div`,{className:shared_link_footer_module_default.disclosures,children:[isOpenAccess&&jsx(FooterRow,{icon:Globe,children:formatMessage(isEditPermission?messages.sharedLinkEditablePubliclyAvailable:messages.sharedLinkPubliclyAvailable)}),isCompanyEditable&&jsx(FooterRow,{icon:Globe,children:formatMessage(messages.sharedLinkElevatedEditableCompanyAvailable)}),sharedLinkNotices]})}export{SharedLinkFooter as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
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{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.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{Mail}from"@box/blueprint-web-assets/icons/Medium";import{jsx,jsxs}from"react/jsx-runtime";import{ClockBadge}from"@box/blueprint-web-assets/icons/Line";import{CopyInput}from"@box/copy-input";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;return createSharedLink&&(response=await createSharedLink()),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{settings={}}=sharedLink,{otpAccessEntries,otpAllowlistItemCount,otpMode}=settings,otpAccessCount=otpAccessEntries?otpAccessEntries.length:otpAllowlistItemCount,isEmptyAllowlist=otpMode===`allowlist`&&!otpAccessCount,message,variant=`success`;typeof result==`string`?isEmptyAllowlist?(message=formatMessage(messages.copyWithEmptyAllowlistNotice),variant=`warning`):message=isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopySuccessNoticeText):formatMessage(messages.autoCopySuccessNoticeText):message=isSharedLinkAutoCreated.current?formatMessage(messages.autoCreateCopyErrorNoticeText):null,message&¬ifications.includes(`auto-copy-shared-link`)&&addNotification({...getNotificationArgs(formatMessage,variant),styledText:message})},[addNotification,formatMessage,isAutoCopyEnabled,isSharedLinkAutoCopied,isSharedLinkAutoCreated,notifications,onSharedLinkCopy,sharedLink]),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{
|
|
1
|
+
import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import{CollaboratorAvatar}from"../esm/lib/components/unified-share-form-modal/collaborator-list/collaborator-avatar.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{useIntl}from"react-intl";import{Avatar,Text}from"@box/blueprint-web";import{jsx,jsxs}from"react/jsx-runtime";import{Gray10}from"@box/blueprint-web-assets/tokens/tokens";import '../styles/shared-with-avatars.css';var shared_with_avatars_module_default={container:`_container_13wac_27`,avatars:`_avatars_13wac_44`},AVATAR_LIMIT=3;function SharedWithAvatars(){let{formatMessage}=useIntl(),{collaborators,currentUser,eventService,isSubmitting}=useUnifiedShareModalContext(),{setIsCollaboratorsOpen}=useUnifiedShareFormContext(),{onCollaboratorsClick}=eventService,{id:currentUserId}=currentUser,sharedWithCollabs=collaborators.filter(({isCurrentUser,userId})=>!(isCurrentUser||currentUserId&¤tUserId===userId));if(!sharedWithCollabs.length)return null;let sharedWithAvatars=sharedWithCollabs.slice(0,AVATAR_LIMIT),sharedWithOverflow=sharedWithCollabs.length-AVATAR_LIMIT,handleClick=()=>{if(onCollaboratorsClick){onCollaboratorsClick();return}setIsCollaboratorsOpen(!0)};return jsxs(`div`,{"aria-disabled":isSubmitting,className:shared_with_avatars_module_default.container,onClick:handleClick,onKeyDown:callOnKeyboardEvent(handleClick),role:`button`,tabIndex:isSubmitting?-1:0,children:[jsx(Text,{as:`span`,color:`textOnLightSecondary`,children:formatMessage(messages.sharedWithLabel)}),jsxs(`div`,{className:shared_with_avatars_module_default.avatars,children:[sharedWithAvatars.map(collaborator=>jsx(CollaboratorAvatar,{collaborator,size:`medium`},collaborator.id)),sharedWithOverflow>0&&jsx(Avatar,{color:Gray10,size:`medium`,text:`+${sharedWithOverflow}`})]})]})}export{SharedWithAvatars as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{isCollaboratorRestricted}from"../esm/lib/utils/collaborator.js";import{callOnKeyboardEvent}from"../esm/lib/utils/event.js";import{useUnifiedShareModalContext}from"../esm/lib/contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../esm/lib/contexts/unified-share-form-context.js";import messages from"../esm/lib/components/unified-share-form-modal/collaboration-section/messages.js";import{useEffect,useState}from"react";import{FormattedMessage,useIntl}from"react-intl";import{InlineNotice,Link,LoadingIndicator,Select}from"@box/blueprint-web";import{jsx}from"react/jsx-runtime";import partition from"lodash/partition";import '../styles/shield-restriction-notice.css';var shield_restriction_notice_module_default={select:`_select_1e0dl_1`,link:`_link_1e0dl_5`,loading:`_loading_1e0dl_9`,notice:`_notice_1e0dl_15`};function ShieldRestrictionNotice({error,isLoading,onSelectedUsersChange}){let{formatMessage}=useIntl(),[isFetching,setIsFetching]=useState(!1),[justificationReasons,setJustificationReasons]=useState([]),{setShieldRestriction,setUserContacts,shieldRestriction,userContacts}=useUnifiedShareFormContext(),{eventService,item,contactService}=useUnifiedShareModalContext(),{getJustificationReasons}=contactService,{onRestrictedUsersRemoveClick}=eventService,{isJustificationAllowed,restrictionType,restrictedEmails=[],restrictedGroups=[]}=error,restrictedContacts=[...restrictedEmails,...restrictedGroups];useEffect(()=>(isJustificationAllowed&&setShieldRestriction({isJustificationAllowed:!0}),()=>{setShieldRestriction({isJustificationAllowed:!1})}),[isJustificationAllowed,setShieldRestriction]),useEffect(()=>{(async()=>{if(!(!getJustificationReasons||justificationReasons.length))try{setIsFetching(!0);let{classificationId,options}=await getJustificationReasons(item);setShieldRestriction({classificationId}),setJustificationReasons(options)}finally{setIsFetching(!1)}})()},[item,getJustificationReasons,isJustificationAllowed,justificationReasons,setShieldRestriction]);let removeButtonLabelMessage=isJustificationAllowed?messages.justifiableContactRestrictionRemoveButtonLabel:messages.contactRestrictionRemoveButtonLabel,handleRemove=()=>{let[removedContacts,allowedContacts]=partition(userContacts,contact=>isCollaboratorRestricted(contact,restrictedEmails,restrictedGroups));onSelectedUsersChange(allowedContacts),setUserContacts(allowedContacts),onRestrictedUsersRemoveClick&&onRestrictedUsersRemoveClick(removedContacts)},justificationSelectSection=jsx(Select,{className:shield_restriction_notice_module_default.select,hideLabel:!0,label:formatMessage(messages.businessJustification),onValueChange:value=>{setShieldRestriction({justificationReason:justificationReasons.find(reason=>reason.id===value)})},placeholder:formatMessage(messages.justificationSelectPlaceholder),value:shieldRestriction.justificationReason?.id,children:jsx(Select.Content,{align:`start`,children:justificationReasons.map(option=>jsx(Select.Option,{text:option.title,value:option.id},option.id))})}),link=jsx(Link,{"aria-disabled":isLoading,className:shield_restriction_notice_module_default.link,onClick:handleRemove,onKeyDown:callOnKeyboardEvent(handleRemove,{canPreventDefault:!0}),role:`button`,tabIndex:isLoading?-1:0,children:formatMessage(removeButtonLabelMessage)}),{message,...values}=restrictionType===`information_barrier`?{message:messages.contactRestrictionInformationBarrierNotice,count:restrictedContacts.length,removeLink:link}:!isFetching&&isJustificationAllowed&&justificationReasons?.length>0?{message:messages.justifiableContactRestrictionNotice,count:restrictedContacts.length,justificationSelect:justificationSelectSection,removeLink:link}:{message:messages.contactRestrictionNotice,count:restrictedContacts.length,removeLink:link};return jsx(InlineNotice,{className:shield_restriction_notice_module_default.notice,icon:()=>null,role:`alert`,variant:`error`,variantIconAriaLabel:formatMessage(messages.errorNoticeIconAriaLabel),children:isFetching?jsx(`div`,{className:shield_restriction_notice_module_default.loading,children:jsx(LoadingIndicator,{"aria-label":formatMessage(messages.loadingJustificationReasonsLabel),size:`small`})}):jsx(FormattedMessage,{...message,values})})}export{ShieldRestrictionNotice as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as RemoveCollaboratorModal}from"../../../chunks/remove-collaborator-modal.js";import{t as RemoveSharedLinkModal}from"../../../chunks/remove-shared-link-modal.js";import{t as SharedLinkSettingsModal}from"../../../chunks/shared-link-settings-modal.js";import{t as UnifiedShareFormModal}from"../../../chunks/unified-share-form-modal.js";export{RemoveCollaboratorModal,RemoveSharedLinkModal,SharedLinkSettingsModal,UnifiedShareFormModal};
|
|
1
|
+
import{t as ManageAccessListModal}from"../../../chunks/manage-access-list-modal.js";import{t as RemoveCollaboratorModal}from"../../../chunks/remove-collaborator-modal.js";import{t as RemoveSharedLinkModal}from"../../../chunks/remove-shared-link-modal.js";import{t as SharedLinkSettingsModal}from"../../../chunks/shared-link-settings-modal.js";import{t as UnifiedShareFormModal}from"../../../chunks/unified-share-form-modal.js";export{ManageAccessListModal,RemoveCollaboratorModal,RemoveSharedLinkModal,SharedLinkSettingsModal,UnifiedShareFormModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as AccessList}from"../../../../chunks/access-list.js";export{AccessList};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as ManageAccessListModal}from"../../../../chunks/manage-access-list-modal.js";export{ManageAccessListModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as ManageAccessListModal}from"../../../../chunks/manage-access-list-modal.js";export{ManageAccessListModal};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({title:{id:`groupSharedFeatures.usm.manageAccessListModal.title`,defaultMessage:`Manage Access List`},description:{id:`groupSharedFeatures.usm.manageAccessListModal.description`,defaultMessage:`Add the email addresses or domains allowed to access this shared link. Recipients will verify their identity with a one-time passcode.`},closeButton:{id:`groupSharedFeatures.usm.manageAccessListModal.closeButton`,defaultMessage:`Close`},loadingLabel:{id:`groupSharedFeatures.usm.manageAccessListModal.loadingLabel`,defaultMessage:`Loading`},addButton:{id:`groupSharedFeatures.usm.manageAccessListModal.addButton`,defaultMessage:`Add`},cancelButton:{id:`groupSharedFeatures.usm.manageAccessListModal.cancelButton`,defaultMessage:`Cancel`},saveButton:{id:`groupSharedFeatures.usm.manageAccessListModal.saveButton`,defaultMessage:`Save`},searchLabel:{id:`groupSharedFeatures.usm.manageAccessListModal.searchLabel`,defaultMessage:`Search`},searchPlaceholder:{id:`groupSharedFeatures.usm.manageAccessListModal.searchPlaceholder`,defaultMessage:`Search domains or email addresses`},clearButton:{id:`groupSharedFeatures.usm.manageAccessListModal.clearButton`,defaultMessage:`Clear`},inputLabel:{id:`groupSharedFeatures.usm.manageAccessListModal.inputLabel`,defaultMessage:`Recipient`},inputPlaceholder:{id:`groupSharedFeatures.usm.manageAccessListModal.inputPlaceholder`,defaultMessage:`Enter email or domain`},inputMaxLengthError:{id:`groupSharedFeatures.usm.manageAccessListModal.inputMaxLengthError`,defaultMessage:`Please enter an email or domain that is fewer than 256 characters.`},inputInvalidError:{id:`groupSharedFeatures.usm.manageAccessListModal.inputInvalidError`,defaultMessage:`Invalid email address or domain`},listLabel:{id:`groupSharedFeatures.usm.manageAccessListModal.listLabel`,defaultMessage:`Access list`},itemColumn:{id:`groupSharedFeatures.usm.manageAccessListModal.itemColumn`,defaultMessage:`ITEM`},dateColumn:{id:`groupSharedFeatures.usm.manageAccessListModal.dateColumn`,defaultMessage:`DATE ADDED`},removeColumn:{id:`groupSharedFeatures.usm.manageAccessListModal.removeColumn`,defaultMessage:`REMOVE`},domainBadge:{id:`groupSharedFeatures.usm.manageAccessListModal.domainBadge`,defaultMessage:`DOMAIN`},removeButton:{id:`groupSharedFeatures.usm.manageAccessListModal.removeButton`,defaultMessage:`Remove`},emptyAccessList:{id:`groupSharedFeatures.usm.manageAccessListModal.emptyAccessList`,defaultMessage:`Only collaborators can access until entries are added.`},noSearchResults:{id:`groupSharedFeatures.usm.manageAccessListModal.noSearchResults`,defaultMessage:`No results found`}});export{messages as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OTP_MODE}from"../../constants.js";import{useUnifiedShareModalContext}from"../../contexts/unified-share-modal-context.js";import{useAccessLevels}from"../../hooks/use-access-levels.js";import{useSharedLinkSettingsContext}from"../../contexts/shared-link-settings-context.js";import messages from"./messages.js";import{DownloadSection}from"./download-section.js";import{ExpirationSection}from"./expiration-section.js";import{t as OtpSection}from"../../../../chunks/otp-section.js";import{PasswordSection}from"./password-section.js";import{VanitySection}from"./vanity-section.js";import{useMemo}from"react";import{useIntl}from"react-intl";import{InlineNotice,Link,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function SharedLinkSettings(){let{formatMessage}=useIntl(),{eventService,isSubmitting,sharedLink}=useUnifiedShareModalContext(),{settings={},vanityDomain=``}=sharedLink,{canChangeDownload,canChangeExpiration,canChangeOtp,canChangePassword,canChangeVanityName,isDownloadAvailable,isOtpAvailable,isPasswordAvailable,isVanityNameAvailable,otpAllowlistItemCount=0}=settings,{onOtpAllowlistConfigure}=eventService,{selectedAccess}=useAccessLevels(),{errors,formData,initialFormData,setFieldError,setFieldValue,validatePassword}=useSharedLinkSettingsContext(),accessNoticeMessage=useMemo(()=>{if(!selectedAccess)return null;switch(selectedAccess.id){case`collaborators`:return messages.subtitleCollaborators;case`open`:{let subtitleOpenMessage=formData.isDownloadEnabled?messages.subtitleOpenDownload:messages.subtitleOpenView,subtitleOtpMessage=formData.isDownloadEnabled?messages.subtitleOtpDownload:messages.subtitleOtpView;return formData.isOtpEnabled?subtitleOtpMessage:subtitleOpenMessage}case`company`:return formData.isDownloadEnabled?messages.subtitleCompanyDownload:messages.subtitleCompanyView;default:return null}},[formData.isDownloadEnabled,formData.isOtpEnabled,selectedAccess]),handleExpirationToggle=nextChecked=>{setFieldError(`expiration`,void 0),setFieldValue(`isExpirationEnabled`,nextChecked)},handleExpirationChange=value=>{setFieldError(`expiration`,void 0),setFieldValue(`expiration`,value)},handleVanityToggle=nextChecked=>{setFieldError(`vanityName`,void 0),setFieldValue(`isVanityNameEnabled`,nextChecked)},handleVanityNameChange=event=>{setFieldError(`vanityName`,void 0),setFieldValue(`vanityName`,event.target.value)},isOtpSectionVisible=!!isOtpAvailable&&selectedAccess?.id===`open`,isPasswordSectionVisible=!!isPasswordAvailable&&selectedAccess?.id===`open`,canTogglePassword=!!canChangePassword&&!(formData.isOtpEnabled&&!canChangeOtp),canToggleOtp=!!canChangeOtp&&!(formData.isPasswordEnabled&&!canChangePassword),handlePasswordToggle=nextChecked=>{setFieldError(`password`,void 0),setFieldValue(`isPasswordEnabled`,nextChecked),nextChecked&&isOtpSectionVisible&&canChangeOtp&&setFieldValue(`isOtpEnabled`,!1)},handleOtpToggle=nextChecked=>{setFieldValue(`isOtpEnabled`,nextChecked),nextChecked&&formData.otpMode===OTP_MODE.NONE&&setFieldValue(`otpMode`,OTP_MODE.OPEN),nextChecked&&isPasswordSectionVisible&&canChangePassword&&(setFieldValue(`isPasswordEnabled`,!1),setFieldValue(`password`,``),setFieldError(`password`,void 0))},handleOtpModeChange=mode=>{setFieldValue(`otpMode`,mode)},handlePasswordChange=event=>{setFieldError(`password`,void 0),setFieldValue(`password`,event.target.value)},handleDownloadToggle=nextChecked=>{setFieldValue(`isDownloadEnabled`,nextChecked)},handlePasswordBlur=event=>{let isSubmitFocused=document.getElementById(`usm-SharedLinkSettingsModal-primaryButton`)?.contains(event.relatedTarget);initialFormData.isPasswordEnabled&&!formData.password||isSubmitFocused||validatePassword(formData.password)},canChangeAllSettings=canChangeDownload&&canChangeExpiration&&(!isOtpSectionVisible||canChangeOtp)&&(!isPasswordSectionVisible||canChangePassword)&&canChangeVanityName,passwordSection=jsx(PasswordSection,{canChange:canTogglePassword,error:errors.password,isAvailable:isPasswordSectionVisible,isChecked:formData.isPasswordEnabled,isDefaultChecked:initialFormData.isPasswordEnabled,isDisabled:isSubmitting,onBlur:handlePasswordBlur,onChange:handlePasswordChange,onFocus:()=>setFieldError(`password`,void 0),onToggle:handlePasswordToggle,password:formData.password});return jsxs(Fragment,{children:[!canChangeAllSettings&&jsx(InlineNotice,{variant:`warning`,variantIconAriaLabel:formatMessage(messages.warningNoticeIconAriaLabel),children:formatMessage(messages.inaccessibleSettingsNotice)}),accessNoticeMessage&&jsx(Text,{as:`p`,color:`textOnLightSecondary`,children:formatMessage(accessNoticeMessage,{learnSharedLinkSettingsLink:jsx(Link,{href:`https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings`,rel:`noreferrer`,target:`_blank`,children:formatMessage(messages.learnSharedLinkSettingsLink)})})}),jsx(ExpirationSection,{canChange:!!canChangeExpiration,error:errors.expiration,expiration:formData.expiration,isChecked:formData.isExpirationEnabled,isDisabled:isSubmitting,onChange:handleExpirationChange,onToggle:handleExpirationToggle}),jsx(OtpSection,{
|
|
1
|
+
import{OTP_MODE}from"../../constants.js";import{useUnifiedShareModalContext}from"../../contexts/unified-share-modal-context.js";import{useAccessLevels}from"../../hooks/use-access-levels.js";import{useSharedLinkSettingsContext}from"../../contexts/shared-link-settings-context.js";import messages from"./messages.js";import{DownloadSection}from"./download-section.js";import{ExpirationSection}from"./expiration-section.js";import{t as OtpSection}from"../../../../chunks/otp-section.js";import{PasswordSection}from"./password-section.js";import{VanitySection}from"./vanity-section.js";import{useMemo}from"react";import{useIntl}from"react-intl";import{InlineNotice,Link,Text}from"@box/blueprint-web";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function SharedLinkSettings(){let{formatMessage}=useIntl(),{eventService,isSubmitting,setView,sharedLink}=useUnifiedShareModalContext(),{settings={},vanityDomain=``}=sharedLink,{canChangeDownload,canChangeExpiration,canChangeOtp,canChangePassword,canChangeVanityName,isDownloadAvailable,isOtpAvailable,isPasswordAvailable,isVanityNameAvailable,otpAccessEntries,otpAllowlistItemCount=0}=settings,{onOtpAllowlistConfigure}=eventService,otpAccessCount=otpAccessEntries?otpAccessEntries.length:otpAllowlistItemCount,{selectedAccess}=useAccessLevels(),{errors,formData,initialFormData,setFieldError,setFieldValue,validatePassword}=useSharedLinkSettingsContext(),accessNoticeMessage=useMemo(()=>{if(!selectedAccess)return null;switch(selectedAccess.id){case`collaborators`:return messages.subtitleCollaborators;case`open`:{let subtitleOpenMessage=formData.isDownloadEnabled?messages.subtitleOpenDownload:messages.subtitleOpenView,subtitleOtpMessage=formData.isDownloadEnabled?messages.subtitleOtpDownload:messages.subtitleOtpView;return formData.isOtpEnabled?subtitleOtpMessage:subtitleOpenMessage}case`company`:return formData.isDownloadEnabled?messages.subtitleCompanyDownload:messages.subtitleCompanyView;default:return null}},[formData.isDownloadEnabled,formData.isOtpEnabled,selectedAccess]),handleExpirationToggle=nextChecked=>{setFieldError(`expiration`,void 0),setFieldValue(`isExpirationEnabled`,nextChecked)},handleExpirationChange=value=>{setFieldError(`expiration`,void 0),setFieldValue(`expiration`,value)},handleVanityToggle=nextChecked=>{setFieldError(`vanityName`,void 0),setFieldValue(`isVanityNameEnabled`,nextChecked)},handleVanityNameChange=event=>{setFieldError(`vanityName`,void 0),setFieldValue(`vanityName`,event.target.value)},isOtpSectionVisible=!!isOtpAvailable&&selectedAccess?.id===`open`,isPasswordSectionVisible=!!isPasswordAvailable&&selectedAccess?.id===`open`,canTogglePassword=!!canChangePassword&&!(formData.isOtpEnabled&&!canChangeOtp),canToggleOtp=!!canChangeOtp&&!(formData.isPasswordEnabled&&!canChangePassword),handlePasswordToggle=nextChecked=>{setFieldError(`password`,void 0),setFieldValue(`isPasswordEnabled`,nextChecked),nextChecked&&isOtpSectionVisible&&canChangeOtp&&setFieldValue(`isOtpEnabled`,!1)},handleOtpToggle=nextChecked=>{setFieldValue(`isOtpEnabled`,nextChecked),nextChecked&&formData.otpMode===OTP_MODE.NONE&&setFieldValue(`otpMode`,OTP_MODE.OPEN),nextChecked&&isPasswordSectionVisible&&canChangePassword&&(setFieldValue(`isPasswordEnabled`,!1),setFieldValue(`password`,``),setFieldError(`password`,void 0))},handleOtpModeChange=mode=>{setFieldValue(`otpMode`,mode)},handleOtpConfigureClick=()=>{if(onOtpAllowlistConfigure){onOtpAllowlistConfigure();return}setView(`manage-access-list`)},handlePasswordChange=event=>{setFieldError(`password`,void 0),setFieldValue(`password`,event.target.value)},handleDownloadToggle=nextChecked=>{setFieldValue(`isDownloadEnabled`,nextChecked)},handlePasswordBlur=event=>{let isSubmitFocused=document.getElementById(`usm-SharedLinkSettingsModal-primaryButton`)?.contains(event.relatedTarget);initialFormData.isPasswordEnabled&&!formData.password||isSubmitFocused||validatePassword(formData.password)},canChangeAllSettings=canChangeDownload&&canChangeExpiration&&(!isOtpSectionVisible||canChangeOtp)&&(!isPasswordSectionVisible||canChangePassword)&&canChangeVanityName,passwordSection=jsx(PasswordSection,{canChange:canTogglePassword,error:errors.password,isAvailable:isPasswordSectionVisible,isChecked:formData.isPasswordEnabled,isDefaultChecked:initialFormData.isPasswordEnabled,isDisabled:isSubmitting,onBlur:handlePasswordBlur,onChange:handlePasswordChange,onFocus:()=>setFieldError(`password`,void 0),onToggle:handlePasswordToggle,password:formData.password});return jsxs(Fragment,{children:[!canChangeAllSettings&&jsx(InlineNotice,{variant:`warning`,variantIconAriaLabel:formatMessage(messages.warningNoticeIconAriaLabel),children:formatMessage(messages.inaccessibleSettingsNotice)}),accessNoticeMessage&&jsx(Text,{as:`p`,color:`textOnLightSecondary`,children:formatMessage(accessNoticeMessage,{learnSharedLinkSettingsLink:jsx(Link,{href:`https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings`,rel:`noreferrer`,target:`_blank`,children:formatMessage(messages.learnSharedLinkSettingsLink)})})}),jsx(ExpirationSection,{canChange:!!canChangeExpiration,error:errors.expiration,expiration:formData.expiration,isChecked:formData.isExpirationEnabled,isDisabled:isSubmitting,onChange:handleExpirationChange,onToggle:handleExpirationToggle}),jsx(OtpSection,{accessCount:otpAccessCount,canChange:canToggleOtp,isAvailable:isOtpSectionVisible,isChecked:formData.isOtpEnabled,isDisabled:isSubmitting,onConfigureClick:handleOtpConfigureClick,onModeChange:handleOtpModeChange,onToggle:handleOtpToggle,otpMode:formData.otpMode}),!isOtpAvailable&&passwordSection,jsx(VanitySection,{canChange:!!canChangeVanityName,error:errors.vanityName,isAvailable:!!isVanityNameAvailable,isChecked:formData.isVanityNameEnabled,isDisabled:isSubmitting,onChange:handleVanityNameChange,onToggle:handleVanityToggle,vanityDomain,vanityName:formData.vanityName}),jsx(DownloadSection,{canChange:!!canChangeDownload,isAvailable:!!isDownloadAvailable,isChecked:formData.isDownloadEnabled,isDisabled:isSubmitting,onToggle:handleDownloadToggle}),isOtpAvailable&&passwordSection]})}export{SharedLinkSettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var OTP_MODE={ALLOWLIST:`allowlist`,NONE:`none`,OPEN:`open`},DEFAULT_NOTIFICATIONS=[`invite-collaborators`,`remove-collaborator`,`create-shared-link`,`delete-shared-link`,`update-shared-link`,`email-shared-link`,`
|
|
1
|
+
var OTP_MODE={ALLOWLIST:`allowlist`,NONE:`none`,OPEN:`open`},DEFAULT_VIEW=`unified-share-form`,DEFAULT_NOTIFICATIONS=[`invite-collaborators`,`remove-collaborator`,`auto-copy-shared-link`,`create-shared-link`,`delete-shared-link`,`update-shared-link`,`email-shared-link`,`update-otp-access`],DEFAULT_CONFIGURATION={collaboration:!0,collaborationLimit:100,collaborationMessage:!0,collaborationMessageLimit:750,collaborationRole:!0,collaborators:!0,collaboratorsLimit:100,collaboratorsManagement:!0,notifications:DEFAULT_NOTIFICATIONS,sharedLink:!0,sharedLinkAccess:!0,sharedLinkAutoCopy:!1,sharedLinkAutoCreate:!1,sharedLinkEmail:!0,sharedLinkEmailMessage:!0,sharedLinkPermission:!0,sharedLinkSettings:!0},DEFAULT_COLLABORATION_ROLES=[{id:`editor`,isDefault:!0},{id:`viewer`}],SUPPORTED_INVITATION_ROLES=[`co_owner`,`editor`,`previewer`,`previewer_uploader`,`uploader`,`viewer`,`viewer_uploader`],SUPPORTED_COLLABORATOR_ROLES=[`owner`,...SUPPORTED_INVITATION_ROLES],SUPPORTED_ACCESS_LEVELS=[`open`,`company`,`collaborators`],SUPPORTED_PERMISSION_LEVELS=[`can_edit`,`can_download`,`can_preview`],FILE_EXTENSION_BOX_NOTE=`boxnote`;export{DEFAULT_COLLABORATION_ROLES,DEFAULT_CONFIGURATION,DEFAULT_NOTIFICATIONS,DEFAULT_VIEW,FILE_EXTENSION_BOX_NOTE,OTP_MODE,SUPPORTED_ACCESS_LEVELS,SUPPORTED_COLLABORATOR_ROLES,SUPPORTED_INVITATION_ROLES,SUPPORTED_PERMISSION_LEVELS};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ManageAccessListContainer}from"./manage-access-list-container.js";export{ManageAccessListContainer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as ManageAccessListModal}from"../../../chunks/manage-access-list-modal.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{useSharingAction}from"../hooks/use-sharing-action.js";import{jsx}from"react/jsx-runtime";function ManageAccessListContainer(){let{isOpen,isSubmitting,setView,sharedLink,sharingService,variant,view}=useUnifiedShareModalContext(),{settings={}}=sharedLink,{otpAccessEntries=[]}=settings,{updateSharedLinkOtpAccess}=sharingService,{onAction:onSubmit}=useSharingAction(updateSharedLinkOtpAccess,`update-otp-access`),handleClose=()=>{setView(null)};return!isOpen||view!==`manage-access-list`?null:jsx(ManageAccessListModal,{entries:otpAccessEntries,isDesktop:variant===`desktop`,isOpen:!0,isSubmitting,onOpenChange:handleClose,onSubmit:async entries=>{await onSubmit(entries),handleClose()}})}export{ManageAccessListContainer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{OTP_MODE}from"../constants.js";import{useUnifiedShareModalContext}from"./unified-share-modal-context.js";import{
|
|
1
|
+
import{OTP_MODE}from"../constants.js";import{formatDateFromTimestampToCalendarDate}from"../utils/date.js";import{useUnifiedShareModalContext}from"./unified-share-modal-context.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=OTP_MODE.NONE}=settings,[containerRef,setContainerRef]=useState(null),initialFormData=useMemo(()=>{let isOtpEnabled=otpMode!==OTP_MODE.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,onFormReset,onFormSubmit,setFieldError,setFieldValue,validatePassword}=useLinkSettingsForm(initialFormData),contextValue=useMemo(()=>({containerRef,errors,formData,initialFormData,resetForm:onFormReset,setContainerRef,setFieldError,setFieldValue,submitForm:onFormSubmit,validatePassword}),[containerRef,errors,formData,initialFormData,onFormReset,onFormSubmit,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,suggestedCollaborators,variant})=>{let[collaborator,setCollaborator]=useState(null),[isLoading,setIsLoading]=useState(!1),[
|
|
1
|
+
import{DEFAULT_COLLABORATION_ROLES,DEFAULT_CONFIGURATION,DEFAULT_VIEW}from"../constants.js";import{createContext,useCallback,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),[views,setViews]=useState([DEFAULT_VIEW]),setView=useCallback(view=>{setViews(current=>{let[,...rest]=current;return view?[view,...current]:[...rest]})},[]);useEffect(()=>{isOpen||(setIsLoading(!1),setViews([DEFAULT_VIEW]))},[isOpen,setViews]);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:views[0]}),[collaborationAccess,collaborationNotices,collaborationRoles,collaborator,collaborators,config,contactService,currentUser,eventService,initialContacts,invitationFormNotices,isFetching,isLoading,isOpen,isSubmitting,item,onOpenChange,setView,sharedLink,sharedLinkNotices,sharingService,suggestedCollaborators,variant,views]);return jsx(UnifiedShareModalContext.Provider,{value:contextValue,children})};export{UnifiedShareModalContext,UnifiedShareModalProvider,useUnifiedShareModalContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getAllowedAccessLevels}from"../utils/permission.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.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.openOtpAccessLevelLabel: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{
|
|
1
|
+
import{parseEmails}from"../utils/email.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{useUnifiedShareFormContext}from"../contexts/unified-share-form-context.js";import{useFormValidation}from"./use-form-validation.js";import{useSharingAction}from"./use-sharing-action.js";import{useCallback}from"react";import differenceBy from"lodash/differenceBy";import uniqBy from"lodash/uniqBy";var useCollaborationForm=(formAction,formNotification)=>{let{errors,setFieldError,validateCollaborationLimit,validateUserContact,validateUserSelector}=useFormValidation(),{config,contactService}=useUnifiedShareModalContext(),{collaborationLimit}=config,{collaborationRole,form,messageValue,setContactValue,setMessageValue,setUserContacts,shieldRestriction,userContacts}=useUnifiedShareFormContext(),{onAction:onFormSubmit}=useSharingAction(formAction,formNotification),{getContactsByEmail}=contactService,updateContactValue=useCallback(input=>{validateCollaborationLimit(userContacts,collaborationLimit)||setFieldError(`userContacts`,``),setContactValue(input)},[collaborationLimit,setContactValue,setFieldError,userContacts,validateCollaborationLimit]),processContacts=useCallback(async emails=>{let fetchedContacts={};if(getContactsByEmail&&emails.length>0){let response=await getContactsByEmail(emails);for(let key of Object.keys(response))fetchedContacts[key.toLowerCase()]=response[key]}return emails.map(email=>fetchedContacts[email.toLowerCase()]||{email,id:0,isExternalUser:!0,name:email,value:email,type:`user`})},[getContactsByEmail]),handleSelectedUsersChange=useCallback(async users=>{setFieldError(`userContacts`,``),validateUserSelector(users);let nextUserContacts;if(users.length<=userContacts.length||users[users.length-1].id!==void 0)nextUserContacts=users;else{let previousContacts=users.slice(0,-1),rawInput=users[users.length-1].value,parsedEmails=parseEmails(rawInput);parsedEmails.length===0&&validateUserContact(rawInput);let processedContacts=await processContacts(uniqBy(differenceBy(parsedEmails,previousContacts.filter(user=>user.email).map(user=>user.email),email=>email.toLowerCase()),email=>email.toLowerCase()));nextUserContacts=[...previousContacts,...processedContacts]}collaborationLimit&&validateCollaborationLimit(nextUserContacts,collaborationLimit),setUserContacts(nextUserContacts)},[collaborationLimit,processContacts,setFieldError,setUserContacts,userContacts,validateCollaborationLimit,validateUserContact,validateUserSelector]),handleUserSelectorBlur=useCallback(event=>{let isInputFocused=event.relatedTarget?.closest(`.usm-UserContacts-input`),isPopupFocused=document.querySelector(`[aria-labelledby^="usm-UserContacts-"]`)?.contains(event.relatedTarget);if(isInputFocused||isPopupFocused)return;let value=event.target.value.trim();value&&handleSelectedUsersChange([...userContacts,{value}])},[handleSelectedUsersChange,userContacts]),handleFormReset=()=>{setUserContacts([]),setContactValue(``),setMessageValue(``),setFieldError(`userContacts`,``)};return{errors,onFormReset:handleFormReset,onFormSubmit:async()=>{if(errors.userContacts||validateUserSelector(userContacts))return!0;let formData={contacts:userContacts,message:messageValue};return form===`invite`&&(formData.role=collaborationRole.id),shieldRestriction.isJustificationAllowed&&(formData.justificationReason=shieldRestriction.justificationReason,formData.classificationId=shieldRestriction.classificationId),await onFormSubmit(formData),handleFormReset(),!1},onSelectedUsersChange:handleSelectedUsersChange,onUserSelectorBlur:handleUserSelectorBlur,updateContactValue}};export{useCollaborationForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getUpdatedLinkSettingsFormData}from"../utils/form.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{useFormValidation}from"./use-form-validation.js";import{useSharingAction}from"./use-sharing-action.js";import{useCallback,useEffect,useRef,useState}from"react";import isEqual from"lodash/isEqual";var useLinkSettingsForm=initialFormData=>{let initialFormDataRef=useRef(initialFormData),[formData,setFormData]=useState(initialFormData),{errors,setErrors,setFieldError,validateExpiration,validatePassword,validateVanityName}=useFormValidation(),{sharingService}=useUnifiedShareModalContext(),{updateSharedLink}=sharingService,{onAction:onUpdate}=useSharingAction(updateSharedLink,`update-shared-link`);useEffect(()=>{isEqual(initialFormData,initialFormDataRef.current)||(setFormData(initialFormData),setErrors({}),initialFormDataRef.current=initialFormData)},[initialFormData,setErrors]);let setFieldValue=useCallback((field,value)=>{setFormData(prev=>({...prev,[field]:value}))},[]);return{errors,formData,onFormReset:useCallback(()=>{setFormData(initialFormDataRef.current),setErrors({})},[setErrors]),onFormSubmit:useCallback(async()=>{let updatedFormData=getUpdatedLinkSettingsFormData(formData,initialFormData),{expiration,isExpirationEnabled,isPasswordEnabled,isVanityNameEnabled,password,vanityName}=updatedFormData,hasExpirationError=isExpirationEnabled&&validateExpiration(expiration),hasPasswordError=isPasswordEnabled&&validatePassword(password),hasVanityNameError=isVanityNameEnabled&&validateVanityName(vanityName);if(hasExpirationError||hasPasswordError||hasVanityNameError)return!0;try{await onUpdate({...initialFormData,...updatedFormData})}catch(_error){return Object.entries(_error).forEach(([field,value])=>setFieldError(field,value)),!0}return!1},[formData,initialFormData,onUpdate,setFieldError,validateExpiration,validatePassword,validateVanityName]),setFieldError,setFieldValue,validatePassword}};export{useLinkSettingsForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getAllowedPermissionLevels}from"../utils/permission.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import messages from"../components/unified-share-form-modal/shared-link-section/messages.js";import{useMemo}from"react";import{useIntl}from"react-intl";var getPermissionLevelLabel=(formatMessage,permissionLevel)=>{let{id:permission,label}=permissionLevel,message;switch(permission){case`can_download`:message=messages.canDownloadPermissionLevelLabel;break;case`can_edit`:message=messages.canEditPermissionLevelLabel;break;case`can_preview`:message=messages.canPreviewPermissionLevelLabel;break}return label??(message?formatMessage(message):``)},usePermissionLevels=()=>{let{formatMessage}=useIntl(),{sharedLink}=useUnifiedShareModalContext(),{permission,permissionLevels}=sharedLink,allowedLevels=useMemo(()=>getAllowedPermissionLevels(permissionLevels).map(level=>{let{description}=level;return{...level,description:description??``,label:getPermissionLevelLabel(formatMessage,level)}}),[permissionLevels,formatMessage]);return{allowedLevels,selectedPermission:useMemo(()=>allowedLevels.find(({id})=>permission===id),[permission,allowedLevels])}};export{usePermissionLevels};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{getNotificationArgs,getNotificationMessage}from"../utils/notification.js";import{useUnifiedShareModalContext}from"../contexts/unified-share-modal-context.js";import{useCallback,useMemo}from"react";import{useIntl}from"react-intl";import{useNotification}from"@box/blueprint-web";var useSharingAction=(action,notification)=>{let{formatMessage}=useIntl(),{addNotification}=useNotification(),{config,item,setIsLoading}=useUnifiedShareModalContext(),{notifications=[]}=config,{name:itemName}=item,isNotificationEnabled=useMemo(()=>notifications.includes(notification),[notification,notifications]);return{onAction:useCallback(async(...args)=>{setIsLoading(!0);try{if(action){let{messages:customMessages}=await action(...args)??{},successMessage=getNotificationMessage(formatMessage,`success`,notification,{itemName});customMessages?customMessages.forEach(({text,type,...options})=>{addNotification({...getNotificationArgs(formatMessage,type),styledText:text,...options})}):isNotificationEnabled&&successMessage&&addNotification({...getNotificationArgs(formatMessage,`success`),styledText:successMessage})}}catch(_error){let error=_error,errorMessage=getNotificationMessage(formatMessage,`error`,notification);if(isNotificationEnabled&&errorMessage&&addNotification({...getNotificationArgs(formatMessage,`error`),styledText:errorMessage}),error?.fields&&Object.values(error.fields).length)throw error.fields}finally{setIsLoading(!1)}},[action,addNotification,formatMessage,isNotificationEnabled,itemName,notification,setIsLoading])}};export{useSharingAction};
|
package/dist/esm/lib/messages.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defineMessages}from"react-intl";var messages=defineMessages({noticeCloseLabel:{id:`groupSharedFeatures.usm.noticeCloseLabel`,defaultMessage:`Close`},successNoticeIcon:{id:`groupSharedFeatures.usm.successNoticeIcon`,defaultMessage:`Success`},errorNoticeIcon:{id:`groupSharedFeatures.usm.errorNoticeIcon`,defaultMessage:`Error`},warningNoticeIcon:{id:`groupSharedFeatures.usm.warningNoticeIcon`,defaultMessage:`Warning`},defaultErrorNoticeText:{id:`groupSharedFeatures.usm.defaultErrorNoticeText`,defaultMessage:`Something went wrong. Please try again later.`},removeCollaboratorSuccessNoticeText:{id:`groupSharedFeatures.usm.removeCollaboratorSuccessNoticeText`,defaultMessage:`The collaborator has been removed successfully.`},removeCollaboratorErrorNoticeText:{id:`groupSharedFeatures.usm.removeCollaboratorErrorNoticeText`,defaultMessage:`Unable to remove the collaborator. Please try again later.`},deleteSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.deleteSharedLinkSuccessNoticeText`,defaultMessage:`The shared link for “{itemName}” has been removed successfully.`},deleteSharedLinkErrorNoticeText:{id:`groupSharedFeatures.usm.deleteSharedLinkErrorNoticeText`,defaultMessage:`Unable to remove the shared link. Please try again later.`},updateSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.updateSharedLinkSuccessNoticeText`,defaultMessage:`The shared link settings were saved successfully.`},createSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.createSharedLinkSuccessNoticeText`,defaultMessage:`Shared link created.`},createSharedLinkErrorNoticeText:{id:`groupSharedFeatures.usm.createSharedLinkErrorNoticeText`,defaultMessage:`Unable to create a shared link. Please try again later.`},emailSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.emailSharedLinkSuccessNoticeText`,defaultMessage:`The shared link for “{itemName}” was sent successfully.`},vanityNameInvalidErrorMessage:{id:`groupSharedFeatures.usm.vanityNameInvalidErrorMessage`,defaultMessage:`Custom URLs must be between 12-30 characters, and can include letters, numbers, and hyphens`},vanityNameRequiredErrorMessage:{id:`groupSharedFeatures.usm.vanityNameRequiredErrorMessage`,defaultMessage:`Please enter a custom URL`},expirationRequiredErrorMessage:{id:`groupSharedFeatures.usm.expirationRequiredErrorMessage`,defaultMessage:`Please select an expiration date`},expirationFutureDateErrorMessage:{id:`groupSharedFeatures.usm.expirationFutureDateErrorMessage`,defaultMessage:`Expiration date must be in the future`},invalidEmailErrorMessage:{id:`groupSharedFeatures.usm.invalidEmailErrorMessage`,defaultMessage:`Invalid email address`},emailRequiredErrorMessage:{id:`groupSharedFeatures.usm.emailRequiredErrorMessage`,defaultMessage:`Enter at least one valid email`},contactsLimitErrorMessage:{id:`groupSharedFeatures.usm.contactsLimitErrorMessage`,defaultMessage:`Oops! The maximum number of collaborators that can be added at once is {maxContacts} collaborators. Please try again by splitting your invitations into batches.`},
|
|
1
|
+
import{defineMessages}from"react-intl";var messages=defineMessages({noticeCloseLabel:{id:`groupSharedFeatures.usm.noticeCloseLabel`,defaultMessage:`Close`},successNoticeIcon:{id:`groupSharedFeatures.usm.successNoticeIcon`,defaultMessage:`Success`},errorNoticeIcon:{id:`groupSharedFeatures.usm.errorNoticeIcon`,defaultMessage:`Error`},warningNoticeIcon:{id:`groupSharedFeatures.usm.warningNoticeIcon`,defaultMessage:`Warning`},defaultErrorNoticeText:{id:`groupSharedFeatures.usm.defaultErrorNoticeText`,defaultMessage:`Something went wrong. Please try again later.`},removeCollaboratorSuccessNoticeText:{id:`groupSharedFeatures.usm.removeCollaboratorSuccessNoticeText`,defaultMessage:`The collaborator has been removed successfully.`},removeCollaboratorErrorNoticeText:{id:`groupSharedFeatures.usm.removeCollaboratorErrorNoticeText`,defaultMessage:`Unable to remove the collaborator. Please try again later.`},deleteSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.deleteSharedLinkSuccessNoticeText`,defaultMessage:`The shared link for “{itemName}” has been removed successfully.`},deleteSharedLinkErrorNoticeText:{id:`groupSharedFeatures.usm.deleteSharedLinkErrorNoticeText`,defaultMessage:`Unable to remove the shared link. Please try again later.`},updateSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.updateSharedLinkSuccessNoticeText`,defaultMessage:`The shared link settings were saved successfully.`},createSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.createSharedLinkSuccessNoticeText`,defaultMessage:`Shared link created.`},createSharedLinkErrorNoticeText:{id:`groupSharedFeatures.usm.createSharedLinkErrorNoticeText`,defaultMessage:`Unable to create a shared link. Please try again later.`},emailSharedLinkSuccessNoticeText:{id:`groupSharedFeatures.usm.emailSharedLinkSuccessNoticeText`,defaultMessage:`The shared link for “{itemName}” was sent successfully.`},updateOtpAccessSuccessNoticeText:{id:`groupSharedFeatures.usm.updateOtpAccessSuccessNoticeText`,defaultMessage:`Access List updated.`},vanityNameInvalidErrorMessage:{id:`groupSharedFeatures.usm.vanityNameInvalidErrorMessage`,defaultMessage:`Custom URLs must be between 12-30 characters, and can include letters, numbers, and hyphens`},vanityNameRequiredErrorMessage:{id:`groupSharedFeatures.usm.vanityNameRequiredErrorMessage`,defaultMessage:`Please enter a custom URL`},expirationRequiredErrorMessage:{id:`groupSharedFeatures.usm.expirationRequiredErrorMessage`,defaultMessage:`Please select an expiration date`},expirationFutureDateErrorMessage:{id:`groupSharedFeatures.usm.expirationFutureDateErrorMessage`,defaultMessage:`Expiration date must be in the future`},invalidEmailErrorMessage:{id:`groupSharedFeatures.usm.invalidEmailErrorMessage`,defaultMessage:`Invalid email address`},emailRequiredErrorMessage:{id:`groupSharedFeatures.usm.emailRequiredErrorMessage`,defaultMessage:`Enter at least one valid email`},contactsLimitErrorMessage:{id:`groupSharedFeatures.usm.contactsLimitErrorMessage`,defaultMessage:`Oops! The maximum number of collaborators that can be added at once is {maxContacts} collaborators. Please try again by splitting your invitations into batches.`},passwordContainMinCharactersErrorMessage:{id:`groupSharedFeatures.usm.passwordContainMinCharactersErrorMessage`,defaultMessage:`Password must contain at least 8 characters`},passwordContainInvalidCharacterErrorMessage:{id:`groupSharedFeatures.usm.passwordContainInvalidCharacterErrorMessage`,defaultMessage:`Password cannot contain a space, "<" or ">"`},passwordContainLetterNumberOrSymbolErrorMessage:{id:`groupSharedFeatures.usm.passwordContainLetterNumberOrSymbolErrorMessage`,defaultMessage:`Password must contain at least one upper case letter, number, or special character`},justificationRequiredErrorNotice:{id:`groupSharedFeatures.usm.justificationRequiredErrorNotice`,defaultMessage:`Please select a justification or remove the {count, plural, one {{count} restricted user} other {{count} restricted users}} to continue.`},restrictedContactsErrorNotice:{id:`groupSharedFeatures.usm.restrictedContactsErrorNotice`,defaultMessage:`Please remove the {count, plural, one {{count} restricted user} other {{count} restricted users}} to continue.`}});export{messages as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useUnifiedShareModalContext}from"./contexts/unified-share-modal-context.js";import{UnifiedShareFormProvider}from"./contexts/unified-share-form-context.js";import{SharedLinkSettingsProvider}from"./contexts/shared-link-settings-context.js";import{t as RemoveCollaboratorModal}from"../../chunks/remove-collaborator-modal.js";import{t as RemoveSharedLinkModal}from"../../chunks/remove-shared-link-modal.js";import{t as SharedLinkSettingsModal}from"../../chunks/shared-link-settings-modal.js";import{t as UnifiedShareFormModal}from"../../chunks/unified-share-form-modal.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function UnifiedShareBase({children}){let{isOpen,onOpenChange,setView,view}=useUnifiedShareModalContext();return jsxs(Fragment,{children:[jsx(UnifiedShareFormProvider,{children:jsx(UnifiedShareFormModal,{isOpen:isOpen&&view===`unified-share-form`,onOpenChange,children})}),jsx(SharedLinkSettingsProvider,{children:jsx(SharedLinkSettingsModal,{isOpen:isOpen&&view===`shared-link-settings`,onOpenChange:()=>setView(
|
|
1
|
+
import{useUnifiedShareModalContext}from"./contexts/unified-share-modal-context.js";import{UnifiedShareFormProvider}from"./contexts/unified-share-form-context.js";import{SharedLinkSettingsProvider}from"./contexts/shared-link-settings-context.js";import{t as RemoveCollaboratorModal}from"../../chunks/remove-collaborator-modal.js";import{t as RemoveSharedLinkModal}from"../../chunks/remove-shared-link-modal.js";import{t as SharedLinkSettingsModal}from"../../chunks/shared-link-settings-modal.js";import{t as UnifiedShareFormModal}from"../../chunks/unified-share-form-modal.js";import{ManageAccessListContainer}from"./containers/manage-access-list-container.js";import{Fragment,jsx,jsxs}from"react/jsx-runtime";function UnifiedShareBase({children}){let{isOpen,onOpenChange,setView,view}=useUnifiedShareModalContext();return jsxs(Fragment,{children:[jsx(UnifiedShareFormProvider,{children:jsx(UnifiedShareFormModal,{isOpen:isOpen&&view===`unified-share-form`,onOpenChange,children})}),jsx(SharedLinkSettingsProvider,{children:jsx(SharedLinkSettingsModal,{isOpen:isOpen&&view===`shared-link-settings`,onOpenChange:()=>setView(null)})}),jsx(RemoveSharedLinkModal,{isOpen:isOpen&&view===`remove-shared-link`,onOpenChange:()=>setView(null)}),jsx(RemoveCollaboratorModal,{isOpen:isOpen&&view===`remove-collaborator`,onOpenChange:()=>setView(null)}),jsx(ManageAccessListContainer,{})]})}export{UnifiedShareBase};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAvatarBadgeSize,getDefaultCollaborationRole,getFirstInitial,isCollaboratorRestricted,isCollaboratorRoleSupported,isInvitationRoleSupported}from"./collaborator.js";import{formatDateFromTimestampToCalendarDate,formatDateFromTimestampToDateString,formatTomorrowDateToCalendarDate}from"./date.js";import{doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,isEmailValid,isVanityNameValid}from"./validation.js";import{parseEmails}from"./email.js";import{callOnKeyboardEvent}from"./event.js";import{getUpdatedLinkSettingsFormData}from"./form.js";import{getNotificationArgs,getNotificationMessage}from"./notification.js";import{getAllowedAccessLevels,getAllowedPermissionLevels}from"./permission.js";export{callOnKeyboardEvent,doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,formatDateFromTimestampToCalendarDate,formatDateFromTimestampToDateString,formatTomorrowDateToCalendarDate,getAllowedAccessLevels,getAllowedPermissionLevels,getAvatarBadgeSize,getDefaultCollaborationRole,getFirstInitial,getNotificationArgs,getNotificationMessage,getUpdatedLinkSettingsFormData,isCollaboratorRestricted,isCollaboratorRoleSupported,isEmailValid,isInvitationRoleSupported,isVanityNameValid,parseEmails};
|
|
1
|
+
import{getAvatarBadgeSize,getDefaultCollaborationRole,getFirstInitial,isCollaboratorRestricted,isCollaboratorRoleSupported,isInvitationRoleSupported}from"./collaborator.js";import{formatDateFromTimestampToCalendarDate,formatDateFromTimestampToDateString,formatTomorrowDateToCalendarDate}from"./date.js";import{doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,isDomainValid,isEmailValid,isVanityNameValid}from"./validation.js";import{parseEmails}from"./email.js";import{callOnKeyboardEvent}from"./event.js";import{getUpdatedLinkSettingsFormData}from"./form.js";import{getNotificationArgs,getNotificationMessage}from"./notification.js";import{getAllowedAccessLevels,getAllowedPermissionLevels}from"./permission.js";export{callOnKeyboardEvent,doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,formatDateFromTimestampToCalendarDate,formatDateFromTimestampToDateString,formatTomorrowDateToCalendarDate,getAllowedAccessLevels,getAllowedPermissionLevels,getAvatarBadgeSize,getDefaultCollaborationRole,getFirstInitial,getNotificationArgs,getNotificationMessage,getUpdatedLinkSettingsFormData,isCollaboratorRestricted,isCollaboratorRoleSupported,isDomainValid,isEmailValid,isInvitationRoleSupported,isVanityNameValid,parseEmails};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var VANITY_NAME_REGEX=/^[a-zA-Z0-9-]{12,30}$/,EMAIL_REGEX=/^[A-Z0-9._'%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isVanityNameValid=vanityName=>VANITY_NAME_REGEX.test(vanityName),isEmailValid=email=>EMAIL_REGEX.test(email),doesPasswordContainMinCharacters=password=>password.length>=8,doesPasswordContainNumber=password=>password.replace(/\D/g,``).length>=1,doesPasswordContainSymbol=password=>password.replace(/\s/g,``).replace(/\w/g,``).length>=1,doesPasswordContainLetter=password=>/[a-zA-Z]/.test(password),doesPasswordContainMixedCase=password=>/[a-z]/.test(password)&&/[A-Z]/.test(password),doesPasswordContainInvalidCharacter=password=>/[\s<>]/.test(password);export{doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,isEmailValid,isVanityNameValid};
|
|
1
|
+
var VANITY_NAME_REGEX=/^[a-zA-Z0-9-]{12,30}$/,DOMAIN_REGEX=/^(?!-)[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/,EMAIL_REGEX=/^[A-Z0-9._'%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isVanityNameValid=vanityName=>VANITY_NAME_REGEX.test(vanityName),isDomainValid=domain=>DOMAIN_REGEX.test(domain),isEmailValid=email=>EMAIL_REGEX.test(email),doesPasswordContainMinCharacters=password=>password.length>=8,doesPasswordContainNumber=password=>password.replace(/\D/g,``).length>=1,doesPasswordContainSymbol=password=>password.replace(/\s/g,``).replace(/\w/g,``).length>=1,doesPasswordContainLetter=password=>/[a-zA-Z]/.test(password),doesPasswordContainMixedCase=password=>/[a-z]/.test(password)&&/[A-Z]/.test(password),doesPasswordContainInvalidCharacter=password=>/[\s<>]/.test(password);export{doesPasswordContainInvalidCharacter,doesPasswordContainLetter,doesPasswordContainMinCharacters,doesPasswordContainMixedCase,doesPasswordContainNumber,doesPasswordContainSymbol,isDomainValid,isEmailValid,isVanityNameValid};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._item_1sy1e_1{gap:var(--bp-space-020);align-items:center;display:flex}._remove_1sy1e_7{justify-content:center;align-items:center;display:flex}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._content_1hi1x_1._content_1hi1x_1._isFullscreen_1hi1x_1{border-radius:0;width:100vw;max-width:none;height:100vh;max-height:none;margin:0;animation:none!important}._content_1hi1x_1._content_1hi1x_1._isFullscreen_1hi1x_1 ._body_1hi1x_10{flex-grow:1;padding-top:0;position:relative;overflow:auto}._body_1hi1x_10._body_1hi1x_10{gap:var(--bp-space-050);flex-direction:column;display:flex}._divider_1hi1x_23._divider_1hi1x_23{z-index:1;width:100%;margin-bottom:var(--bp-space-060);position:sticky;top:0}._add_1hi1x_31{margin-right:auto}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OtpAccessEntry } from '../../types';
|
|
2
|
+
export interface AccessListProps {
|
|
3
|
+
entries: OtpAccessEntry[];
|
|
4
|
+
isDisabled?: boolean;
|
|
5
|
+
onRemove: (value: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function AccessList({ entries, isDisabled, onRemove }: AccessListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './manage-access-list-modal';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OtpAccessEntry } from '../../types';
|
|
2
|
+
export interface ManageAccessListModalProps {
|
|
3
|
+
entries: OtpAccessEntry[];
|
|
4
|
+
isDesktop?: boolean;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
isSubmitting?: boolean;
|
|
7
|
+
onOpenChange: (open: boolean) => void;
|
|
8
|
+
onSubmit: (entries: OtpAccessEntry[]) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function ManageAccessListModal({ entries: initialEntries, isDesktop, isOpen, isSubmitting, onOpenChange, onSubmit, }: ManageAccessListModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
declare const messages: {
|
|
2
|
+
title: {
|
|
3
|
+
defaultMessage: string;
|
|
4
|
+
description: string;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
description: {
|
|
8
|
+
defaultMessage: string;
|
|
9
|
+
description: string;
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
closeButton: {
|
|
13
|
+
defaultMessage: string;
|
|
14
|
+
description: string;
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
loadingLabel: {
|
|
18
|
+
defaultMessage: string;
|
|
19
|
+
description: string;
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
addButton: {
|
|
23
|
+
defaultMessage: string;
|
|
24
|
+
description: string;
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
cancelButton: {
|
|
28
|
+
defaultMessage: string;
|
|
29
|
+
description: string;
|
|
30
|
+
id: string;
|
|
31
|
+
};
|
|
32
|
+
saveButton: {
|
|
33
|
+
defaultMessage: string;
|
|
34
|
+
description: string;
|
|
35
|
+
id: string;
|
|
36
|
+
};
|
|
37
|
+
searchLabel: {
|
|
38
|
+
defaultMessage: string;
|
|
39
|
+
description: string;
|
|
40
|
+
id: string;
|
|
41
|
+
};
|
|
42
|
+
searchPlaceholder: {
|
|
43
|
+
defaultMessage: string;
|
|
44
|
+
description: string;
|
|
45
|
+
id: string;
|
|
46
|
+
};
|
|
47
|
+
clearButton: {
|
|
48
|
+
defaultMessage: string;
|
|
49
|
+
description: string;
|
|
50
|
+
id: string;
|
|
51
|
+
};
|
|
52
|
+
inputLabel: {
|
|
53
|
+
defaultMessage: string;
|
|
54
|
+
description: string;
|
|
55
|
+
id: string;
|
|
56
|
+
};
|
|
57
|
+
inputPlaceholder: {
|
|
58
|
+
defaultMessage: string;
|
|
59
|
+
description: string;
|
|
60
|
+
id: string;
|
|
61
|
+
};
|
|
62
|
+
inputMaxLengthError: {
|
|
63
|
+
defaultMessage: string;
|
|
64
|
+
description: string;
|
|
65
|
+
id: string;
|
|
66
|
+
};
|
|
67
|
+
inputInvalidError: {
|
|
68
|
+
defaultMessage: string;
|
|
69
|
+
description: string;
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
72
|
+
listLabel: {
|
|
73
|
+
defaultMessage: string;
|
|
74
|
+
description: string;
|
|
75
|
+
id: string;
|
|
76
|
+
};
|
|
77
|
+
itemColumn: {
|
|
78
|
+
defaultMessage: string;
|
|
79
|
+
description: string;
|
|
80
|
+
id: string;
|
|
81
|
+
};
|
|
82
|
+
dateColumn: {
|
|
83
|
+
defaultMessage: string;
|
|
84
|
+
description: string;
|
|
85
|
+
id: string;
|
|
86
|
+
};
|
|
87
|
+
removeColumn: {
|
|
88
|
+
defaultMessage: string;
|
|
89
|
+
description: string;
|
|
90
|
+
id: string;
|
|
91
|
+
};
|
|
92
|
+
domainBadge: {
|
|
93
|
+
defaultMessage: string;
|
|
94
|
+
description: string;
|
|
95
|
+
id: string;
|
|
96
|
+
};
|
|
97
|
+
removeButton: {
|
|
98
|
+
defaultMessage: string;
|
|
99
|
+
description: string;
|
|
100
|
+
id: string;
|
|
101
|
+
};
|
|
102
|
+
emptyAccessList: {
|
|
103
|
+
defaultMessage: string;
|
|
104
|
+
description: string;
|
|
105
|
+
id: string;
|
|
106
|
+
};
|
|
107
|
+
noSearchResults: {
|
|
108
|
+
defaultMessage: string;
|
|
109
|
+
description: string;
|
|
110
|
+
id: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export default messages;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OtpAccessType } from '../../types';
|
|
2
2
|
export interface OtpSectionProps {
|
|
3
|
-
|
|
3
|
+
accessCount: number;
|
|
4
4
|
canChange: boolean;
|
|
5
5
|
isAvailable: boolean;
|
|
6
6
|
isChecked: boolean;
|
|
@@ -10,4 +10,4 @@ export interface OtpSectionProps {
|
|
|
10
10
|
onToggle: (checked: boolean) => void;
|
|
11
11
|
otpMode: OtpAccessType;
|
|
12
12
|
}
|
|
13
|
-
export declare function OtpSection({
|
|
13
|
+
export declare function OtpSection({ accessCount, canChange, isAvailable, isChecked, isDisabled, onConfigureClick, onModeChange, onToggle, otpMode, }: OtpSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AccessLevelType, Configuration, NotificationType, OtpModeType, PermissionLevelType } from './types';
|
|
1
|
+
import { AccessLevelType, Configuration, NotificationType, OtpModeType, PermissionLevelType, ViewType } from './types';
|
|
2
2
|
export declare const OTP_MODE: Record<string, OtpModeType>;
|
|
3
|
+
export declare const DEFAULT_VIEW: ViewType;
|
|
3
4
|
export declare const DEFAULT_NOTIFICATIONS: NotificationType[];
|
|
4
5
|
export declare const DEFAULT_CONFIGURATION: Configuration;
|
|
5
6
|
export declare const DEFAULT_COLLABORATION_ROLES: ({
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './manage-access-list-container';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ManageAccessListContainer(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { FormErrors } from '../hooks';
|
|
2
|
+
import { FieldError, FormErrors } from '../hooks';
|
|
3
3
|
import { LinkSettingsFormData } from '../types';
|
|
4
4
|
export interface SharedLinkSettingsContextValue {
|
|
5
5
|
containerRef: HTMLDivElement | null;
|
|
@@ -8,8 +8,8 @@ export interface SharedLinkSettingsContextValue {
|
|
|
8
8
|
initialFormData: LinkSettingsFormData;
|
|
9
9
|
resetForm: () => void;
|
|
10
10
|
setContainerRef: Dispatch<SetStateAction<HTMLDivElement | null>>;
|
|
11
|
-
setFieldError: (field:
|
|
12
|
-
setFieldValue: (field:
|
|
11
|
+
setFieldError: (field: string, error: FieldError) => void;
|
|
12
|
+
setFieldValue: (field: string, value: unknown) => void;
|
|
13
13
|
submitForm: () => Promise<boolean>;
|
|
14
14
|
validatePassword: (password: string) => boolean;
|
|
15
15
|
}
|
|
@@ -20,7 +20,7 @@ export interface UnifiedShareModalContextValue {
|
|
|
20
20
|
onOpenChange: (open: boolean) => void;
|
|
21
21
|
setCollaborator: Dispatch<SetStateAction<Collaborator | null>>;
|
|
22
22
|
setIsLoading: Dispatch<SetStateAction<boolean>>;
|
|
23
|
-
setView:
|
|
23
|
+
setView: (view: ViewType | null) => void;
|
|
24
24
|
sharedLink: Partial<SharedLink>;
|
|
25
25
|
sharedLinkNotices?: ReactElement | ReactElement[];
|
|
26
26
|
sharingService: SharingService;
|
|
@@ -12,5 +12,5 @@ export declare const useFormValidation: () => {
|
|
|
12
12
|
validateUserContact: (user: string) => boolean;
|
|
13
13
|
validateUserSelector: (users: UserContactType[]) => boolean;
|
|
14
14
|
setErrors: import('react').Dispatch<import('react').SetStateAction<FormErrors>>;
|
|
15
|
-
setFieldError: (field:
|
|
15
|
+
setFieldError: (field: string, error: FieldError) => void;
|
|
16
16
|
};
|
|
@@ -4,7 +4,7 @@ export declare const useLinkSettingsForm: (initialFormData: LinkSettingsFormData
|
|
|
4
4
|
formData: LinkSettingsFormData;
|
|
5
5
|
onFormReset: () => void;
|
|
6
6
|
onFormSubmit: () => Promise<boolean>;
|
|
7
|
-
setFieldError: (field:
|
|
8
|
-
setFieldValue: (field:
|
|
7
|
+
setFieldError: (field: string, error: import('./use-form-validation').FieldError) => void;
|
|
8
|
+
setFieldValue: (field: string, value: unknown) => void;
|
|
9
9
|
validatePassword: (password: string) => boolean;
|
|
10
10
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { NotificationType,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
onAction: (...args: Parameters<SharingAction>) => Promise<void>;
|
|
1
|
+
import { NotificationType, SharingResponse } from '../types';
|
|
2
|
+
export declare const useSharingAction: <TArgs extends unknown[]>(action?: (...args: TArgs) => Promise<SharingResponse | void>, notification?: NotificationType) => {
|
|
3
|
+
onAction: (...args: TArgs) => Promise<void>;
|
|
5
4
|
};
|
|
6
|
-
export {};
|
|
@@ -64,6 +64,11 @@ declare const messages: {
|
|
|
64
64
|
description: string;
|
|
65
65
|
id: string;
|
|
66
66
|
};
|
|
67
|
+
updateOtpAccessSuccessNoticeText: {
|
|
68
|
+
defaultMessage: string;
|
|
69
|
+
description: string;
|
|
70
|
+
id: string;
|
|
71
|
+
};
|
|
67
72
|
vanityNameInvalidErrorMessage: {
|
|
68
73
|
defaultMessage: string;
|
|
69
74
|
description: string;
|
|
@@ -99,11 +104,6 @@ declare const messages: {
|
|
|
99
104
|
description: string;
|
|
100
105
|
id: string;
|
|
101
106
|
};
|
|
102
|
-
passwordRequiredErrorMessage: {
|
|
103
|
-
defaultMessage: string;
|
|
104
|
-
description: string;
|
|
105
|
-
id: string;
|
|
106
|
-
};
|
|
107
107
|
passwordContainMinCharactersErrorMessage: {
|
|
108
108
|
defaultMessage: string;
|
|
109
109
|
description: string;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SuggestedCollaborator, UserContactType } from '@box/user-selector';
|
|
3
3
|
import { UnifiedShareModalContextValue } from '../contexts';
|
|
4
4
|
import { UnifiedShareModalProps } from '../unified-share-modal';
|
|
5
|
-
import { CollaborationRole, Collaborator, Configuration, Item, SharedLink, SharedLinkSettings } from '../types';
|
|
5
|
+
import { CollaborationRole, Collaborator, Configuration, ContactService, Item, OtpAccessEntry, SharedLink, SharedLinkSettings, SharingService } from '../types';
|
|
6
|
+
export declare const mockAccessEntries: OtpAccessEntry[];
|
|
6
7
|
export declare const mockCollaborationRoles: CollaborationRole[];
|
|
7
8
|
export declare const mockCollaborators: Collaborator[];
|
|
8
9
|
export declare const mockCollaboratorsExtended: Collaborator[];
|
|
9
10
|
export declare const mockConfiguration: Configuration;
|
|
10
11
|
export declare const mockContacts: UserContactType[];
|
|
11
12
|
export declare const mockSuggestedCollaborators: SuggestedCollaborator[];
|
|
12
|
-
export declare const mockContactService:
|
|
13
|
-
getContacts: (input: any) => Promise<UserContactType[]>;
|
|
14
|
-
getContactsByEmail: (emails: string[]) => Promise<Record<string, UserContactType>>;
|
|
15
|
-
};
|
|
13
|
+
export declare const mockContactService: ContactService;
|
|
16
14
|
export declare const mockClassification: {
|
|
17
15
|
colorId: number;
|
|
18
16
|
name: string;
|
|
@@ -26,27 +24,14 @@ export declare const mockItemPermissions: {
|
|
|
26
24
|
canShare: boolean;
|
|
27
25
|
};
|
|
28
26
|
export declare const mockBoxFile: Item;
|
|
29
|
-
export declare const mockBoxFileViewer: Item;
|
|
30
27
|
export declare const mockBoxFolder: Item;
|
|
31
28
|
export declare const mockWorkflow: Item;
|
|
32
29
|
export declare const mockPrompt: Item;
|
|
33
30
|
export declare const mockSharedLinkSettings: SharedLinkSettings;
|
|
34
31
|
export declare const mockSharedLink: SharedLink;
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const mockSharedLinkOtpOpen: SharedLink;
|
|
37
|
-
export declare const mockSharedLinkOtpAllowlist: SharedLink;
|
|
38
|
-
export declare const useMockSharedLink: (sharedLinkArg: any) => {
|
|
32
|
+
export declare const useMockSharedLink: (sharedLinkArg: SharedLink) => {
|
|
39
33
|
sharedLink: SharedLink;
|
|
40
|
-
sharingService:
|
|
41
|
-
sendInvitations: (formData: any) => Promise<void>;
|
|
42
|
-
removeCollaborator: () => Promise<void>;
|
|
43
|
-
sendSharedLink: (formData: any) => Promise<void>;
|
|
44
|
-
createSharedLink: () => Promise<void>;
|
|
45
|
-
deleteSharedLink: () => Promise<void>;
|
|
46
|
-
updateSharedLink: (formData: any) => Promise<void>;
|
|
47
|
-
changeSharedLinkAccess: (access: any) => Promise<void>;
|
|
48
|
-
changeSharedLinkPermission: (permission: any) => Promise<void>;
|
|
49
|
-
};
|
|
34
|
+
sharingService: SharingService;
|
|
50
35
|
};
|
|
51
36
|
export declare const defaultArgs: UnifiedShareModalProps;
|
|
52
37
|
export declare const defaultContext: UnifiedShareModalContextValue;
|
|
@@ -28,7 +28,7 @@ export type FormType = 'default' | 'invite' | 'email';
|
|
|
28
28
|
/**
|
|
29
29
|
* Supported success and error notifications when the user performs sharing actions.
|
|
30
30
|
*/
|
|
31
|
-
export type NotificationType = 'invite-collaborators' | 'remove-collaborator' | 'create-shared-link' | 'delete-shared-link' | 'update-shared-link' | 'email-shared-link' | '
|
|
31
|
+
export type NotificationType = 'invite-collaborators' | 'remove-collaborator' | 'auto-copy-shared-link' | 'create-shared-link' | 'delete-shared-link' | 'update-shared-link' | 'email-shared-link' | 'update-otp-access';
|
|
32
32
|
/**
|
|
33
33
|
* Supported roles for inviting a new collaborator. The available roles are dependent on the Enterprise settings.
|
|
34
34
|
*
|
|
@@ -54,10 +54,13 @@ export type OtpModeType = 'open' | 'allowlist' | 'none';
|
|
|
54
54
|
/**
|
|
55
55
|
* The access modes for verified OTP-protected shared links.
|
|
56
56
|
*
|
|
57
|
-
* This is a subset of {@link OtpModeType} that is selectable in the UI. When OTP is
|
|
58
|
-
* the mode is always `open` or `allowlist`.
|
|
57
|
+
* This is a subset of {@link OtpModeType} that is selectable in the UI. When OTP is enabled, the mode is `open` or `allowlist`.
|
|
59
58
|
*/
|
|
60
59
|
export type OtpAccessType = Exclude<OtpModeType, 'none'>;
|
|
60
|
+
/**
|
|
61
|
+
* Supported types for an entry in the allowlist for OTP-protected shared links.
|
|
62
|
+
*/
|
|
63
|
+
export type OtpAccessEntryType = 'email' | 'domain';
|
|
61
64
|
/**
|
|
62
65
|
* Supported item types in the Unified Share Modal.
|
|
63
66
|
*/
|
|
@@ -239,8 +242,14 @@ export interface SharedLinkSettings {
|
|
|
239
242
|
* When `true`, the custom URL settings of the shared link are visible to the user.
|
|
240
243
|
*/
|
|
241
244
|
isVanityNameAvailable?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* The entries in the allowlist of OTP-protected shared links.
|
|
247
|
+
*/
|
|
248
|
+
otpAccessEntries?: OtpAccessEntry[];
|
|
242
249
|
/**
|
|
243
250
|
* The number of entries on the link's allowlist, shown as the "+N ITEMS" badge.
|
|
251
|
+
*
|
|
252
|
+
* @deprecated Use `otpAccessEntries`, the count will be calculated automatically
|
|
244
253
|
*/
|
|
245
254
|
otpAllowlistItemCount?: number;
|
|
246
255
|
/**
|
|
@@ -280,6 +289,20 @@ export interface PermissionLevel {
|
|
|
280
289
|
*/
|
|
281
290
|
label?: string;
|
|
282
291
|
}
|
|
292
|
+
export interface OtpAccessEntry {
|
|
293
|
+
/**
|
|
294
|
+
* The created timestamp of the allowlist entry.
|
|
295
|
+
*/
|
|
296
|
+
createdAt: number;
|
|
297
|
+
/**
|
|
298
|
+
* The type of the allowlist entry.
|
|
299
|
+
*/
|
|
300
|
+
type: OtpAccessEntryType;
|
|
301
|
+
/**
|
|
302
|
+
* The value of the allowlist entry.
|
|
303
|
+
*/
|
|
304
|
+
value: string;
|
|
305
|
+
}
|
|
283
306
|
export interface Collaborator {
|
|
284
307
|
/**
|
|
285
308
|
* The URL to the profile picture of the collaborator.
|
|
@@ -514,6 +537,12 @@ export interface SharingService {
|
|
|
514
537
|
* Called when the user selects a permission level for the shared link.
|
|
515
538
|
*/
|
|
516
539
|
changeSharedLinkPermission?: (permission: PermissionLevelType) => Promise<SharingResponse | void>;
|
|
540
|
+
/**
|
|
541
|
+
* Function to update the allowlist for OTP-protected shared links.
|
|
542
|
+
*
|
|
543
|
+
* Called when the user saves changes to the "Manage Access List" modal.
|
|
544
|
+
*/
|
|
545
|
+
updateSharedLinkOtpAccess?: (entries: OtpAccessEntry[]) => Promise<SharingResponse | void>;
|
|
517
546
|
}
|
|
518
547
|
/**
|
|
519
548
|
* Supported notice types for custom notifications.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SuggestedCollaborator, UserContactType } 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
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const isVanityNameValid: (vanityName: string) => boolean;
|
|
2
|
+
export declare const isDomainValid: (domain: string) => boolean;
|
|
2
3
|
export declare const isEmailValid: (email: string) => boolean;
|
|
3
4
|
export declare const doesPasswordContainMinCharacters: (password: string) => boolean;
|
|
4
5
|
export declare const doesPasswordContainNumber: (password: string) => boolean;
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/unified-share-modal",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^18.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.12.
|
|
8
|
-
"@box/copy-input": "^2.3.
|
|
9
|
-
"@box/user-selector": "^3.1.
|
|
6
|
+
"@box/blueprint-web": "^18.3.0",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.12.2",
|
|
8
|
+
"@box/copy-input": "^2.3.19",
|
|
9
|
+
"@box/user-selector": "^3.1.19",
|
|
10
10
|
"lodash": "^4.17.15",
|
|
11
11
|
"react": "^18.0.0",
|
|
12
12
|
"react-dom": "^18.0.0",
|
|
13
13
|
"react-intl": "^6.4.2"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@box/blueprint-web": "^18.
|
|
17
|
-
"@box/blueprint-web-assets": "^5.12.
|
|
18
|
-
"@box/copy-input": "^2.3.
|
|
19
|
-
"@box/eslint-plugin-blueprint": "2.2.
|
|
20
|
-
"@box/storybook-utils": "1.4.
|
|
16
|
+
"@box/blueprint-web": "^18.3.0",
|
|
17
|
+
"@box/blueprint-web-assets": "^5.12.2",
|
|
18
|
+
"@box/copy-input": "^2.3.19",
|
|
19
|
+
"@box/eslint-plugin-blueprint": "2.2.29",
|
|
20
|
+
"@box/storybook-utils": "1.4.14",
|
|
21
21
|
"react-intl": "^6.4.2"
|
|
22
22
|
},
|
|
23
23
|
"publishConfig": {
|