mirror of
https://github.com/nextcloud/server.git
synced 2024-12-27 15:38:19 +00:00
475c691cfd
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2 lines
45 KiB
JavaScript
2 lines
45 KiB
JavaScript
"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[6244],{27718:(t,e,i)=>{i.d(e,{A:()=>l});var a=i(71354),n=i.n(a),s=i(76314),r=i.n(s)()(n());r.push([t.id,".file-request-dialog{--margin: 18px}.file-request-dialog__header{margin:0 var(--margin)}.file-request-dialog__form{position:relative;overflow:auto;padding:var(--margin) var(--margin);margin-top:calc(-1*var(--margin))}.file-request-dialog fieldset{display:flex;flex-direction:column;width:100%;margin-top:var(--margin)}.file-request-dialog fieldset legend{display:flex;align-items:center;width:100%}.file-request-dialog__info{color:var(--color-text-maxcontrast);padding-block:4px;display:flex;align-items:center}.file-request-dialog__info .file-request-dialog__info-icon{margin-inline-end:8px}.file-request-dialog .dialog__actions{width:auto;margin-inline:12px}.file-request-dialog .dialog__actions span.dialog__actions-separator{margin-inline-start:auto}.file-request-dialog .input-field__helper-text-message{color:var(--color-text-maxcontrast)}","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog.vue"],names:[],mappings:"AACA,qBACC,cAAA,CAEA,6BACC,sBAAA,CAGD,2BACC,iBAAA,CACA,aAAA,CACA,mCAAA,CAEA,iCAAA,CAGD,8BACC,YAAA,CACA,qBAAA,CACA,UAAA,CACA,wBAAA,CAEA,qCACC,YAAA,CACA,kBAAA,CACA,UAAA,CAMF,2BACC,mCAAA,CACA,iBAAA,CACA,YAAA,CACA,kBAAA,CACA,2DACC,qBAAA,CAIF,sCACC,UAAA,CACA,kBAAA,CACA,qEACC,wBAAA,CAIF,uDAEC,mCAAA",sourceRoot:""}]);const l=r},36225:(t,e,i)=>{i.d(e,{A:()=>l});var a=i(71354),n=i.n(a),s=i(76314),r=i.n(s)()(n());r.push([t.id,".file-request-dialog__password-field[data-v-7ee0b01a]{display:flex;align-items:flex-start;gap:8px;margin-top:12px}.file-request-dialog__password-field>div[data-v-7ee0b01a]{margin:0}","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogDatePassword.vue"],names:[],mappings:"AACA,sDACC,YAAA,CACA,sBAAA,CACA,OAAA,CAEA,eAAA,CACA,0DAEC,QAAA",sourceRoot:""}]);const l=r},39226:(t,e,i)=>{i.d(e,{A:()=>l});var a=i(71354),n=i.n(a),s=i(76314),r=i.n(s)()(n());r.push([t.id,"\n.input-field[data-v-09e7c1ac],\n.file-request-dialog__emails[data-v-09e7c1ac] {\n\tmargin-top: var(--margin);\n}\n.file-request-dialog__emails[data-v-09e7c1ac] {\n\tdisplay: flex;\n\tgap: var(--default-grid-baseline);\n\tflex-wrap: wrap;\n}\n","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogFinish.vue"],names:[],mappings:";AAiOA;;CAEA,yBAAA;AACA;AAEA;CACA,aAAA;CACA,iCAAA;CACA,eAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n<template>\n\t<div>\n\t\t\x3c!-- Request note --\x3e\n\t\t<NcNoteCard type=\"success\">\n\t\t\t{{ t('files_sharing', 'You can now share the link below to allow people to upload files to your directory.') }}\n\t\t</NcNoteCard>\n\n\t\t\x3c!-- Copy share link --\x3e\n\t\t<NcInputField ref=\"clipboard\"\n\t\t\t:value=\"shareLink\"\n\t\t\t:label=\"t('files_sharing', 'Share link')\"\n\t\t\t:readonly=\"true\"\n\t\t\t:show-trailing-button=\"true\"\n\t\t\t:trailing-button-label=\"t('files_sharing', 'Copy to clipboard')\"\n\t\t\tdata-cy-file-request-dialog-fieldset=\"link\"\n\t\t\t@click=\"copyShareLink\"\n\t\t\t@trailing-button-click=\"copyShareLink\">\n\t\t\t<template #trailing-button-icon>\n\t\t\t\t<IconCheck v-if=\"isCopied\" :size=\"20\" />\n\t\t\t\t<IconClipboard v-else :size=\"20\" />\n\t\t\t</template>\n\t\t</NcInputField>\n\n\t\t<template v-if=\"isShareByMailEnabled\">\n\t\t\t\x3c!-- Email share--\x3e\n\t\t\t<NcTextField :value.sync=\"email\"\n\t\t\t\t:label=\"t('files_sharing', 'Send link via email')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Enter an email address or paste a list')\"\n\t\t\t\tdata-cy-file-request-dialog-fieldset=\"email\"\n\t\t\t\ttype=\"email\"\n\t\t\t\t@keypress.enter.stop=\"addNewEmail\"\n\t\t\t\t@paste.stop.prevent=\"onPasteEmails\"\n\t\t\t\t@focusout.native=\"addNewEmail\" />\n\n\t\t\t\x3c!-- Email list --\x3e\n\t\t\t<div v-if=\"emails.length > 0\" class=\"file-request-dialog__emails\">\n\t\t\t\t<NcChip v-for=\"mail in emails\"\n\t\t\t\t\t:key=\"mail\"\n\t\t\t\t\t:aria-label-close=\"t('files_sharing', 'Remove email')\"\n\t\t\t\t\t:text=\"mail\"\n\t\t\t\t\t@close=\"$emit('remove-email', mail)\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<NcAvatar :disable-menu=\"true\"\n\t\t\t\t\t\t\t:disable-tooltip=\"true\"\n\t\t\t\t\t\t\t:display-name=\"mail\"\n\t\t\t\t\t\t\t:is-no-user=\"true\"\n\t\t\t\t\t\t\t:show-user-status=\"false\"\n\t\t\t\t\t\t\t:size=\"24\" />\n\t\t\t\t\t</template>\n\t\t\t\t</NcChip>\n\t\t\t</div>\n\t\t</template>\n\t</div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport Share from '../../models/Share.ts'\n\nimport { defineComponent } from 'vue'\nimport { generateUrl, getBaseUrl } from '@nextcloud/router'\nimport { showError, showSuccess } from '@nextcloud/dialogs'\nimport { n, t } from '@nextcloud/l10n'\n\nimport NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'\nimport NcInputField from '@nextcloud/vue/dist/Components/NcInputField.js'\nimport NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'\nimport NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'\nimport NcChip from '@nextcloud/vue/dist/Components/NcChip.js'\n\nimport IconCheck from 'vue-material-design-icons/Check.vue'\nimport IconClipboard from 'vue-material-design-icons/ClipboardText.vue'\n\nexport default defineComponent({\n\tname: 'NewFileRequestDialogFinish',\n\n\tcomponents: {\n\t\tIconCheck,\n\t\tIconClipboard,\n\t\tNcAvatar,\n\t\tNcInputField,\n\t\tNcNoteCard,\n\t\tNcTextField,\n\t\tNcChip,\n\t},\n\n\tprops: {\n\t\tshare: {\n\t\t\ttype: Object as PropType<Share>,\n\t\t\trequired: true,\n\t\t},\n\t\temails: {\n\t\t\ttype: Array as PropType<string[]>,\n\t\t\trequired: true,\n\t\t},\n\t\tisShareByMailEnabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\temits: ['add-email', 'remove-email'],\n\n\tsetup() {\n\t\treturn {\n\t\t\tn, t,\n\t\t}\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\tisCopied: false,\n\t\t\temail: '',\n\t\t}\n\t},\n\n\tcomputed: {\n\t\tshareLink() {\n\t\t\treturn generateUrl('/s/{token}', { token: this.share.token }, { baseURL: getBaseUrl() })\n\t\t},\n\t},\n\n\tmethods: {\n\t\tasync copyShareLink(event: MouseEvent) {\n\t\t\tif (this.isCopied) {\n\t\t\t\tthis.isCopied = false\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (!navigator.clipboard) {\n\t\t\t\t// Clipboard API not available\n\t\t\t\twindow.prompt(t('files_sharing', 'Automatically copying failed, please copy the share link manually'), this.shareLink)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tawait navigator.clipboard.writeText(this.shareLink)\n\n\t\t\tshowSuccess(t('files_sharing', 'Link copied to clipboard'))\n\t\t\tthis.isCopied = true\n\t\t\tevent.target?.select?.()\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.isCopied = false\n\t\t\t}, 3000)\n\t\t},\n\n\t\taddNewEmail(e: KeyboardEvent) {\n\t\t\tif (this.email.trim() === '') {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (e.target instanceof HTMLInputElement) {\n\t\t\t\t// Reset the custom validity\n\t\t\t\te.target.setCustomValidity('')\n\n\t\t\t\t// Check if the field is valid\n\t\t\t\tif (e.target.checkValidity() === false) {\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// The email is already in the list\n\t\t\t\tif (this.emails.includes(this.email.trim())) {\n\t\t\t\t\te.target.setCustomValidity(t('files_sharing', 'Email already added'))\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Check if the email is valid\n\t\t\t\tif (!this.isValidEmail(this.email.trim())) {\n\t\t\t\t\te.target.setCustomValidity(t('files_sharing', 'Invalid email address'))\n\t\t\t\t\te.target.reportValidity()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tthis.$emit('add-email', this.email.trim())\n\t\t\t\tthis.email = ''\n\t\t\t}\n\t\t},\n\n\t\t// Handle dumping a list of emails\n\t\tonPasteEmails(e: ClipboardEvent) {\n\t\t\tconst clipboardData = e.clipboardData\n\t\t\tif (!clipboardData) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst pastedText = clipboardData.getData('text')\n\t\t\tconst emails = pastedText.split(/[\\s,;]+/).filter(Boolean).map((email) => email.trim())\n\n\t\t\tconst duplicateEmails = emails.filter((email) => this.emails.includes(email))\n\t\t\tconst validEmails = emails.filter((email) => this.isValidEmail(email) && !duplicateEmails.includes(email))\n\t\t\tconst invalidEmails = emails.filter((email) => !this.isValidEmail(email))\n\t\t\tvalidEmails.forEach((email) => this.$emit('add-email', email))\n\n\t\t\t// Warn about invalid emails\n\t\t\tif (invalidEmails.length > 0) {\n\t\t\t\tshowError(n('files_sharing', 'The following email address is not valid: {emails}', 'The following email addresses are not valid: {emails}', invalidEmails.length, { emails: invalidEmails.join(', ') }))\n\t\t\t}\n\n\t\t\t// Warn about duplicate emails\n\t\t\tif (duplicateEmails.length > 0) {\n\t\t\t\tshowError(n('files_sharing', '{count} email address already added', '{count} email addresses already added', duplicateEmails.length, { count: duplicateEmails.length }))\n\t\t\t}\n\n\t\t\tif (validEmails.length > 0) {\n\t\t\t\tshowSuccess(n('files_sharing', '{count} email address added', '{count} email addresses added', validEmails.length, { count: validEmails.length }))\n\t\t\t}\n\n\t\t\tthis.email = ''\n\t\t},\n\n\t\t// No need to have a fancy regex, just check for an @\n\t\tisValidEmail(email: string): boolean {\n\t\t\treturn email.includes('@')\n\t\t},\n\t},\n})\n<\/script>\n<style scoped>\n.input-field,\n.file-request-dialog__emails {\n\tmargin-top: var(--margin);\n}\n\n.file-request-dialog__emails {\n\tdisplay: flex;\n\tgap: var(--default-grid-baseline);\n\tflex-wrap: wrap;\n}\n</style>\n"],sourceRoot:""}]);const l=r},44197:(t,e,i)=>{i.d(e,{A:()=>l});var a=i(71354),n=i.n(a),s=i(76314),r=i.n(s)()(n());r.push([t.id,"\n.file-request-dialog__note[data-v-0778d7a9] textarea {\n\twidth: 100% !important;\n\tmin-height: 80px;\n}\n","",{version:3,sources:["webpack://./apps/files_sharing/src/components/NewFileRequestDialog/NewFileRequestDialogIntro.vue"],names:[],mappings:";AAiKA;CACA,sBAAA;CACA,gBAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n<template>\n\t<div>\n\t\t\x3c!-- Request label --\x3e\n\t\t<fieldset class=\"file-request-dialog__label\" data-cy-file-request-dialog-fieldset=\"label\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'What are you requesting?') }}\n\t\t\t</legend>\n\t\t\t<NcTextField :value=\"label\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:label=\"t('files_sharing', 'Request subject')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Birthday party photos, History assignment…')\"\n\t\t\t\t:required=\"false\"\n\t\t\t\tname=\"label\"\n\t\t\t\t@update:value=\"$emit('update:label', $event)\" />\n\t\t</fieldset>\n\n\t\t\x3c!-- Request destination --\x3e\n\t\t<fieldset class=\"file-request-dialog__destination\" data-cy-file-request-dialog-fieldset=\"destination\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'Where should these files go?') }}\n\t\t\t</legend>\n\t\t\t<NcTextField :value=\"destination\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:label=\"t('files_sharing', 'Upload destination')\"\n\t\t\t\t:minlength=\"2/* cannot share root */\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Select a destination')\"\n\t\t\t\t:readonly=\"false /* cannot validate a readonly input */\"\n\t\t\t\t:required=\"true /* cannot be empty */\"\n\t\t\t\t:show-trailing-button=\"destination !== context.path\"\n\t\t\t\t:trailing-button-icon=\"'undo'\"\n\t\t\t\t:trailing-button-label=\"t('files_sharing', 'Revert to default')\"\n\t\t\t\tname=\"destination\"\n\t\t\t\t@click=\"onPickDestination\"\n\t\t\t\t@keypress.prevent.stop=\"/* prevent typing in the input, we use the picker */\"\n\t\t\t\t@paste.prevent.stop=\"/* prevent pasting in the input, we use the picker */\"\n\t\t\t\t@trailing-button-click=\"$emit('update:destination', '')\">\n\t\t\t\t<IconFolder :size=\"18\" />\n\t\t\t</NcTextField>\n\n\t\t\t<p class=\"file-request-dialog__info\">\n\t\t\t\t<IconLock :size=\"18\" class=\"file-request-dialog__info-icon\" />\n\t\t\t\t{{ t('files_sharing', 'The uploaded files are visible only to you unless you choose to share them.') }}\n\t\t\t</p>\n\t\t</fieldset>\n\n\t\t\x3c!-- Request note --\x3e\n\t\t<fieldset class=\"file-request-dialog__note\" data-cy-file-request-dialog-fieldset=\"note\">\n\t\t\t<legend>\n\t\t\t\t{{ t('files_sharing', 'Add a note') }}\n\t\t\t</legend>\n\t\t\t<NcTextArea :value=\"note\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:label=\"t('files_sharing', 'Note for recipient')\"\n\t\t\t\t:placeholder=\"t('files_sharing', 'Add a note to help people understand what you are requesting.')\"\n\t\t\t\t:required=\"false\"\n\t\t\t\tname=\"note\"\n\t\t\t\t@update:value=\"$emit('update:note', $event)\" />\n\n\t\t\t<p class=\"file-request-dialog__info\">\n\t\t\t\t<IconInfo :size=\"18\" class=\"file-request-dialog__info-icon\" />\n\t\t\t\t{{ t('files_sharing', 'You can add links, date or any other information that will help the recipient understand what you are requesting.') }}\n\t\t\t</p>\n\t\t</fieldset>\n\t</div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { Folder, Node } from '@nextcloud/files'\n\nimport { defineComponent } from 'vue'\nimport { getFilePickerBuilder } from '@nextcloud/dialogs'\nimport { t } from '@nextcloud/l10n'\n\nimport IconFolder from 'vue-material-design-icons/Folder.vue'\nimport IconInfo from 'vue-material-design-icons/Information.vue'\nimport IconLock from 'vue-material-design-icons/Lock.vue'\nimport NcTextArea from '@nextcloud/vue/dist/Components/NcTextArea.js'\nimport NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'\n\nexport default defineComponent({\n\tname: 'NewFileRequestDialogIntro',\n\n\tcomponents: {\n\t\tIconFolder,\n\t\tIconInfo,\n\t\tIconLock,\n\t\tNcTextArea,\n\t\tNcTextField,\n\t},\n\n\tprops: {\n\t\tdisabled: {\n\t\t\ttype: Boolean,\n\t\t\trequired: false,\n\t\t\tdefault: false,\n\t\t},\n\t\tcontext: {\n\t\t\ttype: Object as PropType<Folder>,\n\t\t\trequired: true,\n\t\t},\n\t\tlabel: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tdestination: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t\tnote: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\t},\n\n\temits: [\n\t\t'update:destination',\n\t\t'update:label',\n\t\t'update:note',\n\t],\n\n\tsetup() {\n\t\treturn {\n\t\t\tt,\n\t\t}\n\t},\n\n\tmethods: {\n\t\tonPickDestination() {\n\t\t\tconst filepicker = getFilePickerBuilder(t('files_sharing', 'Select a destination'))\n\t\t\t\t.addMimeTypeFilter('httpd/unix-directory')\n\t\t\t\t.allowDirectories(true)\n\t\t\t\t.addButton({\n\t\t\t\t\tlabel: t('files_sharing', 'Select'),\n\t\t\t\t\tcallback: this.onPickedDestination,\n\t\t\t\t})\n\t\t\t\t.setFilter(node => node.path !== '/')\n\t\t\t\t.startAt(this.destination)\n\t\t\t\t.build()\n\t\t\ttry {\n\t\t\t\tfilepicker.pick()\n\t\t\t} catch (e) {\n\t\t\t\t// ignore cancel\n\t\t\t}\n\t\t},\n\n\t\tonPickedDestination(nodes: Node[]) {\n\t\t\tconst node = nodes[0]\n\t\t\tif (node) {\n\t\t\t\tthis.$emit('update:destination', node.path)\n\t\t\t}\n\t\t},\n\t},\n})\n<\/script>\n<style scoped>\n.file-request-dialog__note :deep(textarea) {\n\twidth: 100% !important;\n\tmin-height: 80px;\n}\n</style>\n"],sourceRoot:""}]);const l=r},66244:(t,e,i)=>{i.r(e),i.d(e,{default:()=>gt});var a=i(85471),n=i(61338),s=i(63814),r=i(35810),l=i(77905),o=i(85168),d=i(53334),c=i(65043),u=i(70995),h=i(94219),p=i(59892),m=i(40083),f=i(54373),g=i(33691),_=i(7145),A=i(32073),y=i(15828),v=i(16044);const w={name:"InformationIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var b=i(14486);const C=(0,b.A)(w,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon information-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,x={name:"AutoFixIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},k=(0,b.A)(x,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon auto-fix-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M7.5,5.6L5,7L6.4,4.5L5,2L7.5,3.4L10,2L8.6,4.5L10,7L7.5,5.6M19.5,15.4L22,14L20.6,16.5L22,19L19.5,17.6L17,19L18.4,16.5L17,14L19.5,15.4M22,2L20.6,4.5L22,7L19.5,5.6L17,7L18.4,4.5L17,2L19.5,3.4L22,2M13.34,12.78L15.78,10.34L13.66,8.22L11.22,10.66L13.34,12.78M14.37,7.29L16.71,9.63C17.1,10 17.1,10.65 16.71,11.04L5.04,22.71C4.65,23.1 4,23.1 3.63,22.71L1.29,20.37C0.9,20 0.9,19.35 1.29,18.96L12.96,7.29C13.35,6.9 14,6.9 14.37,7.29Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,E=new _.A,S=new _.A,q=(0,a.pM)({name:"NewFileRequestDialogDatePassword",components:{IconInfo:C,IconPasswordGen:k,NcButton:u.A,NcCheckboxRadioSwitch:A.A,NcDateTimePickerNative:y.A,NcNoteCard:m.A,NcPasswordField:v.A},props:{disabled:{type:Boolean,required:!1,default:!1},expirationDate:{type:Date,required:!1,default:null},password:{type:String,required:!1,default:null}},emits:["update:expirationDate","update:password"],setup:()=>({t:d.t,defaultExpireDate:S.defaultExpireDate,defaultExpireDateEnabled:S.isDefaultExpireDateEnabled,defaultExpireDateEnforced:S.isDefaultExpireDateEnforced,enableLinkPasswordByDefault:S.enableLinkPasswordByDefault,enforcePasswordForPublicLink:S.enforcePasswordForPublicLink}),data:()=>({maxDate:null,minDate:new Date((new Date).setDate((new Date).getDate()+1))}),computed:{passwordAndExpirationSummary(){return this.expirationDate&&this.password?(0,d.t)("files_sharing","The request will expire on {date} at midnight and will be password protected.",{date:this.expirationDate.toLocaleDateString()}):this.expirationDate?(0,d.t)("files_sharing","The request will expire on {date} at midnight.",{date:this.expirationDate.toLocaleDateString()}):this.password?(0,d.t)("files_sharing","The request will be password protected."):""}},mounted(){this.defaultExpireDate&&this.$emit("update:expirationDate",S.defaultExpirationDate),this.defaultExpireDateEnforced&&(this.maxDate=S.defaultExpirationDate),this.enableLinkPasswordByDefault&&this.generatePassword()},methods:{onToggleDeadline(t){this.$emit("update:expirationDate",t?this.maxDate||this.minDate:null)},async onTogglePassword(t){t?this.generatePassword():this.$emit("update:password",null)},async onGeneratePassword(){await this.generatePassword(),this.showPassword()},async generatePassword(){await async function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(E.passwordPolicy.api&&E.passwordPolicy.api.generate)try{const e=await c.Ay.get(E.passwordPolicy.api.generate);if(e.data.ocs.data.password)return t&&(0,o.Te)((0,d.Tl)("files_sharing","Password created successfully")),e.data.ocs.data.password}catch(e){console.info("Error generating password from password_policy",e),t&&(0,o.Qg)((0,d.Tl)("files_sharing","Error generating password from password policy"))}const e=new Uint8Array(10),i=52/255;self.crypto.getRandomValues(e);let a="";for(let t=0;t<e.length;t++)a+="abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789".charAt(e[t]*i);return a}().then((t=>{this.$emit("update:password",t)}))},showPassword(){this.$refs.passwordField.isPasswordHidden=!1}}});var N=i(85072),D=i.n(N),P=i(97825),T=i.n(P),I=i(77659),F=i.n(I),L=i(55056),R=i.n(L),B=i(10540),M=i.n(B),V=i(41113),$=i.n(V),O=i(36225),z={};z.styleTagTransform=$(),z.setAttributes=R(),z.insert=F().bind(null,"head"),z.domAPI=T(),z.insertStyleElement=M(),D()(O.A,z),O.A&&O.A.locals&&O.A.locals;const H=(0,b.A)(q,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[t.passwordAndExpirationSummary?e("NcNoteCard",{attrs:{type:"success"}},[t._v("\n\t\t"+t._s(t.passwordAndExpirationSummary)+"\n\t")]):t._e(),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__expiration",attrs:{"data-cy-file-request-dialog-fieldset":"expiration"}},[e("legend",[t._v(t._s(t.t("files_sharing","When should the request expire?")))]),t._v(" "),e("NcCheckboxRadioSwitch",{directives:[{name:"show",rawName:"v-show",value:!t.defaultExpireDateEnforced,expression:"!defaultExpireDateEnforced"}],attrs:{checked:t.defaultExpireDateEnforced||null!==t.expirationDate,disabled:t.disabled||t.defaultExpireDateEnforced},on:{"update:checked":t.onToggleDeadline}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Set a submission expiration date"))+"\n\t\t")]),t._v(" "),null!==t.expirationDate?e("NcDateTimePickerNative",{attrs:{id:"file-request-dialog-expirationDate",disabled:t.disabled,"hide-label":!0,label:t.t("files_sharing","Expiration date"),max:t.maxDate,min:t.minDate,placeholder:t.t("files_sharing","Select a date"),required:t.defaultExpireDateEnforced,value:t.expirationDate,name:"expirationDate",type:"date"},on:{input:function(e){return t.$emit("update:expirationDate",e)}}}):t._e(),t._v(" "),t.defaultExpireDateEnforced?e("p",{staticClass:"file-request-dialog__info"},[e("IconInfo",{staticClass:"file-request-dialog__info-icon",attrs:{size:18}}),t._v("\n\t\t\t"+t._s(t.t("files_sharing","Your administrator has enforced a {count} days expiration policy.",{count:t.defaultExpireDate}))+"\n\t\t")],1):t._e()],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__password",attrs:{"data-cy-file-request-dialog-fieldset":"password"}},[e("legend",[t._v(t._s(t.t("files_sharing","What password should be used for the request?")))]),t._v(" "),e("NcCheckboxRadioSwitch",{directives:[{name:"show",rawName:"v-show",value:!t.enforcePasswordForPublicLink,expression:"!enforcePasswordForPublicLink"}],attrs:{checked:t.enforcePasswordForPublicLink||null!==t.password,disabled:t.disabled||t.enforcePasswordForPublicLink},on:{"update:checked":t.onTogglePassword}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Set a password"))+"\n\t\t")]),t._v(" "),null!==t.password?e("div",{staticClass:"file-request-dialog__password-field"},[e("NcPasswordField",{ref:"passwordField",attrs:{"check-password-strength":!0,disabled:t.disabled,label:t.t("files_sharing","Password"),placeholder:t.t("files_sharing","Enter a valid password"),required:!1,value:t.password,name:"password"},on:{"update:value":function(e){return t.$emit("update:password",e)}}}),t._v(" "),e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Generate a new password"),title:t.t("files_sharing","Generate a new password"),type:"tertiary-no-background"},on:{click:t.onGeneratePassword},scopedSlots:t._u([{key:"icon",fn:function(){return[e("IconPasswordGen",{attrs:{size:20}})]},proxy:!0}],null,!1,1334968784)})],1):t._e(),t._v(" "),t.enforcePasswordForPublicLink?e("p",{staticClass:"file-request-dialog__info"},[e("IconInfo",{staticClass:"file-request-dialog__info-icon",attrs:{size:18}}),t._v("\n\t\t\t"+t._s(t.t("files_sharing","Your administrator has enforced a password protection."))+"\n\t\t")],1):t._e()],1)],1)}),[],!1,null,"7ee0b01a",null).exports;var j=i(18709);class W{constructor(t){if(e=this,a=void 0,(i=function(t){var e=function(t){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:e+""}(i="_share"))in e?Object.defineProperty(e,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[i]=a,t.ocs&&t.ocs.data&&t.ocs.data[0]&&(t=t.ocs.data[0]),t.hide_download=!!t.hide_download,t.mail_send=!!t.mail_send,t.attributes&&"string"==typeof t.attributes)try{t.attributes=JSON.parse(t.attributes)}catch(e){console.warn("Could not parse share attributes returned by server",t.attributes)}var e,i,a;t.attributes=t.attributes??[],this._share=t}get state(){return this._share}get id(){return this._share.id}get type(){return this._share.share_type}get permissions(){return this._share.permissions}get attributes(){return this._share.attributes}set permissions(t){this._share.permissions=t}get owner(){return this._share.uid_owner}get ownerDisplayName(){return this._share.displayname_owner}get shareWith(){return this._share.share_with}get shareWithDisplayName(){return this._share.share_with_displayname||this._share.share_with}get shareWithDisplayNameUnique(){return this._share.share_with_displayname_unique||this._share.share_with}get shareWithLink(){return this._share.share_with_link}get shareWithAvatar(){return this._share.share_with_avatar}get uidFileOwner(){return this._share.uid_file_owner}get displaynameFileOwner(){return this._share.displayname_file_owner||this._share.uid_file_owner}get createdTime(){return this._share.stime}get expireDate(){return this._share.expiration}set expireDate(t){this._share.expiration=t}get token(){return this._share.token}get note(){return this._share.note}set note(t){this._share.note=t}get label(){return this._share.label??""}set label(t){this._share.label=t}get mailSend(){return!0===this._share.mail_send}get hideDownload(){return!0===this._share.hide_download}set hideDownload(t){this._share.hide_download=!0===t}get password(){return this._share.password}set password(t){this._share.password=t}get passwordExpirationTime(){return this._share.password_expiration_time}set passwordExpirationTime(t){this._share.password_expiration_time=t}get sendPasswordByTalk(){return this._share.send_password_by_talk}set sendPasswordByTalk(t){this._share.send_password_by_talk=t}get path(){return this._share.path}get itemType(){return this._share.item_type}get mimetype(){return this._share.mimetype}get fileSource(){return this._share.file_source}get fileTarget(){return this._share.file_target}get fileParent(){return this._share.file_parent}get hasReadPermission(){return!!(this.permissions&window.OC.PERMISSION_READ)}get hasCreatePermission(){return!!(this.permissions&window.OC.PERMISSION_CREATE)}get hasDeletePermission(){return!!(this.permissions&window.OC.PERMISSION_DELETE)}get hasUpdatePermission(){return!!(this.permissions&window.OC.PERMISSION_UPDATE)}get hasSharePermission(){return!!(this.permissions&window.OC.PERMISSION_SHARE)}get hasDownloadPermission(){return this.attributes.some((t=>"permissions"===t.scope&&"download"===t.key&&!1===t.value))}get isFileRequest(){return(0,j.C)(JSON.stringify(this.attributes))}set hasDownloadPermission(t){this.setAttribute("permissions","download",!!t)}setAttribute(t,e,i){const a={scope:t,key:e,value:i};for(const t in this._share.attributes){const e=this._share.attributes[t];if(e.scope===a.scope&&e.key===a.key)return void this._share.attributes.splice(t,1,a)}this._share.attributes.push(a)}get canEdit(){return!0===this._share.can_edit}get canDelete(){return!0===this._share.can_delete}get viaFileid(){return this._share.via_fileid}get viaPath(){return this._share.via_path}get parent(){return this._share.parent}get storageId(){return this._share.storage_id}get storage(){return this._share.storage}get itemSource(){return this._share.item_source}get status(){return this._share.status}}var U=i(41944),G=i(16879),Y=i(82182),Q=i(89918);const J={name:"ClipboardTextIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},K=(0,b.A)(J,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon clipboard-text-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M17,9H7V7H17M17,13H7V11H17M14,17H7V15H14M12,3A1,1 0 0,1 13,4A1,1 0 0,1 12,5A1,1 0 0,1 11,4A1,1 0 0,1 12,3M19,3H14.82C14.4,1.84 13.3,1 12,1C10.7,1 9.6,1.84 9.18,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports,X=(0,a.pM)({name:"NewFileRequestDialogFinish",components:{IconCheck:f.A,IconClipboard:K,NcAvatar:U.A,NcInputField:G.A,NcNoteCard:m.A,NcTextField:Y.A,NcChip:Q.A},props:{share:{type:Object,required:!0},emails:{type:Array,required:!0},isShareByMailEnabled:{type:Boolean,required:!0}},emits:["add-email","remove-email"],setup:()=>({n:d.n,t:d.t}),data:()=>({isCopied:!1,email:""}),computed:{shareLink(){return(0,s.Jv)("/s/{token}",{token:this.share.token},{baseURL:(0,s.$_)()})}},methods:{async copyShareLink(t){this.isCopied?this.isCopied=!1:navigator.clipboard?(await navigator.clipboard.writeText(this.shareLink),(0,o.Te)((0,d.t)("files_sharing","Link copied to clipboard")),this.isCopied=!0,t.target?.select?.(),setTimeout((()=>{this.isCopied=!1}),3e3)):window.prompt((0,d.t)("files_sharing","Automatically copying failed, please copy the share link manually"),this.shareLink)},addNewEmail(t){if(""!==this.email.trim()&&t.target instanceof HTMLInputElement){if(t.target.setCustomValidity(""),!1===t.target.checkValidity())return void t.target.reportValidity();if(this.emails.includes(this.email.trim()))return t.target.setCustomValidity((0,d.t)("files_sharing","Email already added")),void t.target.reportValidity();if(!this.isValidEmail(this.email.trim()))return t.target.setCustomValidity((0,d.t)("files_sharing","Invalid email address")),void t.target.reportValidity();this.$emit("add-email",this.email.trim()),this.email=""}},onPasteEmails(t){const e=t.clipboardData;if(!e)return;const i=e.getData("text").split(/[\s,;]+/).filter(Boolean).map((t=>t.trim())),a=i.filter((t=>this.emails.includes(t))),n=i.filter((t=>this.isValidEmail(t)&&!a.includes(t))),s=i.filter((t=>!this.isValidEmail(t)));n.forEach((t=>this.$emit("add-email",t))),s.length>0&&(0,o.Qg)((0,d.n)("files_sharing","The following email address is not valid: {emails}","The following email addresses are not valid: {emails}",s.length,{emails:s.join(", ")})),a.length>0&&(0,o.Qg)((0,d.n)("files_sharing","{count} email address already added","{count} email addresses already added",a.length,{count:a.length})),n.length>0&&(0,o.Te)((0,d.n)("files_sharing","{count} email address added","{count} email addresses added",n.length,{count:n.length})),this.email=""},isValidEmail:t=>t.includes("@")}});var Z=i(39226),tt={};tt.styleTagTransform=$(),tt.setAttributes=R(),tt.insert=F().bind(null,"head"),tt.domAPI=T(),tt.insertStyleElement=M(),D()(Z.A,tt),Z.A&&Z.A.locals&&Z.A.locals;const et=(0,b.A)(X,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[e("NcNoteCard",{attrs:{type:"success"}},[t._v("\n\t\t"+t._s(t.t("files_sharing","You can now share the link below to allow people to upload files to your directory."))+"\n\t")]),t._v(" "),e("NcInputField",{ref:"clipboard",attrs:{value:t.shareLink,label:t.t("files_sharing","Share link"),readonly:!0,"show-trailing-button":!0,"trailing-button-label":t.t("files_sharing","Copy to clipboard"),"data-cy-file-request-dialog-fieldset":"link"},on:{click:t.copyShareLink,"trailing-button-click":t.copyShareLink},scopedSlots:t._u([{key:"trailing-button-icon",fn:function(){return[t.isCopied?e("IconCheck",{attrs:{size:20}}):e("IconClipboard",{attrs:{size:20}})]},proxy:!0}])}),t._v(" "),t.isShareByMailEnabled?[e("NcTextField",{attrs:{value:t.email,label:t.t("files_sharing","Send link via email"),placeholder:t.t("files_sharing","Enter an email address or paste a list"),"data-cy-file-request-dialog-fieldset":"email",type:"email"},on:{"update:value":function(e){t.email=e},keypress:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:(e.stopPropagation(),t.addNewEmail.apply(null,arguments))},paste:function(e){return e.stopPropagation(),e.preventDefault(),t.onPasteEmails.apply(null,arguments)}},nativeOn:{focusout:function(e){return t.addNewEmail.apply(null,arguments)}}}),t._v(" "),t.emails.length>0?e("div",{staticClass:"file-request-dialog__emails"},t._l(t.emails,(function(i){return e("NcChip",{key:i,attrs:{"aria-label-close":t.t("files_sharing","Remove email"),text:i},on:{close:function(e){return t.$emit("remove-email",i)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("NcAvatar",{attrs:{"disable-menu":!0,"disable-tooltip":!0,"display-name":i,"is-no-user":!0,"show-user-status":!1,size:24}})]},proxy:!0}],null,!0)})})),1):t._e()]:t._e()],2)}),[],!1,null,"09e7c1ac",null).exports;var it=i(25866);const at={name:"LockIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},nt=(0,b.A)(at,(function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon lock-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])}),[],!1,null,null,null).exports;var st=i(177);const rt=(0,a.pM)({name:"NewFileRequestDialogIntro",components:{IconFolder:it.A,IconInfo:C,IconLock:nt,NcTextArea:st.A,NcTextField:Y.A},props:{disabled:{type:Boolean,required:!1,default:!1},context:{type:Object,required:!0},label:{type:String,required:!0},destination:{type:String,required:!0},note:{type:String,required:!0}},emits:["update:destination","update:label","update:note"],setup:()=>({t:d.t}),methods:{onPickDestination(){const t=(0,o.a1)((0,d.t)("files_sharing","Select a destination")).addMimeTypeFilter("httpd/unix-directory").allowDirectories(!0).addButton({label:(0,d.t)("files_sharing","Select"),callback:this.onPickedDestination}).setFilter((t=>"/"!==t.path)).startAt(this.destination).build();try{t.pick()}catch(t){}},onPickedDestination(t){const e=t[0];e&&this.$emit("update:destination",e.path)}}});var lt=i(44197),ot={};ot.styleTagTransform=$(),ot.setAttributes=R(),ot.insert=F().bind(null,"head"),ot.domAPI=T(),ot.insertStyleElement=M(),D()(lt.A,ot),lt.A&<.A.locals&<.A.locals;const dt=(0,b.A)(rt,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("div",[e("fieldset",{staticClass:"file-request-dialog__label",attrs:{"data-cy-file-request-dialog-fieldset":"label"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","What are you requesting?"))+"\n\t\t")]),t._v(" "),e("NcTextField",{attrs:{value:t.label,disabled:t.disabled,label:t.t("files_sharing","Request subject"),placeholder:t.t("files_sharing","Birthday party photos, History assignment…"),required:!1,name:"label"},on:{"update:value":function(e){return t.$emit("update:label",e)}}})],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__destination",attrs:{"data-cy-file-request-dialog-fieldset":"destination"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Where should these files go?"))+"\n\t\t")]),t._v(" "),e("NcTextField",{attrs:{value:t.destination,disabled:t.disabled,label:t.t("files_sharing","Upload destination"),minlength:2,placeholder:t.t("files_sharing","Select a destination"),readonly:!1,required:!0,"show-trailing-button":t.destination!==t.context.path,"trailing-button-icon":"undo","trailing-button-label":t.t("files_sharing","Revert to default"),name:"destination"},on:{click:t.onPickDestination,keypress:function(t){t.preventDefault(),t.stopPropagation()},paste:function(t){t.preventDefault(),t.stopPropagation()},"trailing-button-click":function(e){return t.$emit("update:destination","")}}},[e("IconFolder",{attrs:{size:18}})],1),t._v(" "),e("p",{staticClass:"file-request-dialog__info"},[e("IconLock",{staticClass:"file-request-dialog__info-icon",attrs:{size:18}}),t._v("\n\t\t\t"+t._s(t.t("files_sharing","The uploaded files are visible only to you unless you choose to share them."))+"\n\t\t")],1)],1),t._v(" "),e("fieldset",{staticClass:"file-request-dialog__note",attrs:{"data-cy-file-request-dialog-fieldset":"note"}},[e("legend",[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Add a note"))+"\n\t\t")]),t._v(" "),e("NcTextArea",{attrs:{value:t.note,disabled:t.disabled,label:t.t("files_sharing","Note for recipient"),placeholder:t.t("files_sharing","Add a note to help people understand what you are requesting."),required:!1,name:"note"},on:{"update:value":function(e){return t.$emit("update:note",e)}}}),t._v(" "),e("p",{staticClass:"file-request-dialog__info"},[e("IconInfo",{staticClass:"file-request-dialog__info-icon",attrs:{size:18}}),t._v("\n\t\t\t"+t._s(t.t("files_sharing","You can add links, date or any other information that will help the recipient understand what you are requesting."))+"\n\t\t")],1)],1)])}),[],!1,null,"0778d7a9",null).exports;var ct,ut=i(62746);!function(t){t[t.FIRST=0]="FIRST",t[t.SECOND=1]="SECOND",t[t.LAST=2]="LAST"}(ct||(ct={}));const ht=new _.A,pt=(0,a.pM)({name:"NewFileRequestDialog",components:{FileRequestDatePassword:H,FileRequestFinish:et,FileRequestIntro:dt,IconCheck:f.A,IconNext:g.A,NcButton:u.A,NcDialog:h.A,NcLoadingIcon:p.A,NcNoteCard:m.A},props:{context:{type:Object,required:!0},content:{type:Array,required:!0}},setup:()=>({STEP:ct,n:d.n,t:d.t,isShareByMailEnabled:ht.isMailShareAllowed}),data(){return{currentStep:ct.FIRST,loading:!1,destination:this.context.path||"/",label:"",note:"",expirationDate:null,password:null,share:null,emails:[]}},computed:{finishButtonLabel(){return 0===this.emails.length?(0,d.t)("files_sharing","Close"):(0,d.n)("files_sharing","Send email and close","Send {count} emails and close",this.emails.length,{count:this.emails.length})}},methods:{onPageNext(){const t=this.$refs.form;if(t.checkValidity()){if("/"===this.destination||""===this.destination){const e=t.querySelector('input[name="destination"]');return e?.setCustomValidity((0,d.t)("files_sharing","Please select a folder, you cannot share the root directory.")),void t.reportValidity()}this.currentStep!==ct.FIRST?this.createShare():this.currentStep=ct.SECOND}else t.reportValidity()},onRemoveEmail(t){const e=this.emails.indexOf(t);this.emails.splice(e,1)},onCancel(){this.$emit("close")},async onFinish(){if(0===this.emails.length||!1===this.isShareByMailEnabled)return(0,o.Te)((0,d.t)("files_sharing","File request created")),void this.$emit("close");ht.isMailShareAllowed&&this.emails.length>0?(await this.setShareEmails(),await this.sendEmails(),(0,o.Te)((0,d.n)("files_sharing","File request created and email sent","File request created and {count} emails sent",this.emails.length,{count:this.emails.length}))):(0,o.Te)((0,d.t)("files_sharing","File request created")),this.$emit("close")},async createShare(){this.loading=!0;let t="";this.expirationDate&&(t=`${this.expirationDate.getFullYear()}-${(this.expirationDate.getMonth()+1).toString().padStart(2,"0")}-${this.expirationDate.getDate().toString().padStart(2,"0")}`);const e=(0,s.KT)("apps/files_sharing/api/v1/shares");try{const i=await c.Ay.post(e,{shareType:ht.isMailShareAllowed?l.I.Email:l.I.Link,permissions:r.aX.CREATE,label:this.label,path:this.destination,note:this.note,password:this.password||void 0,expireDate:t||void 0,shareWith:"",attributes:JSON.stringify([{value:!0,key:"enabled",scope:"fileRequest"}])});if(!i?.data?.ocs)throw i;const a=new W(i.data.ocs.data);this.share=a,ut.A.info("New file request created",{share:a}),(0,n.Ic)("files_sharing:share:created",{share:a}),this.currentStep=ct.LAST}catch(t){const e=t?.response?.data?.ocs?.meta?.message;throw(0,o.Qg)(e?(0,d.t)("files_sharing","Error creating the share: {errorMessage}",{errorMessage:e}):(0,d.t)("files_sharing","Error creating the share")),ut.A.error("Error while creating share",{error:t,errorMessage:e}),t}finally{this.loading=!1}},async setShareEmails(){if(this.loading=!0,!this.share||!this.share?.id)throw new Error("Share ID is missing");const t=(0,s.KT)("apps/files_sharing/api/v1/shares/{id}",{id:this.share.id});try{const e=await c.Ay.put(t,{attributes:JSON.stringify([{value:this.emails,key:"emails",scope:"shareWith"},{value:!0,key:"enabled",scope:"fileRequest"}])});if(!e?.data?.ocs)throw e}catch(t){throw this.onEmailSendError(t),t}finally{this.loading=!1}},async sendEmails(){if(this.loading=!0,!this.share||!this.share?.id)throw new Error("Share ID is missing");const t=(0,s.KT)("apps/files_sharing/api/v1/shares/{id}/send-email",{id:this.share.id});try{const e=await c.Ay.post(t,{password:this.password||void 0});if(!e?.data?.ocs)throw e}catch(t){throw this.onEmailSendError(t),t}finally{this.loading=!1}},onEmailSendError(t){const e=t.response?.data?.ocs?.meta?.message;(0,o.Qg)(e?(0,d.t)("files_sharing","Error sending emails: {errorMessage}",{errorMessage:e}):(0,d.t)("files_sharing","Error sending emails")),ut.A.error("Error while sending emails",{error:t,errorMessage:e})}}});var mt=i(27718),ft={};ft.styleTagTransform=$(),ft.setAttributes=R(),ft.insert=F().bind(null,"head"),ft.domAPI=T(),ft.insertStyleElement=M(),D()(mt.A,ft),mt.A&&mt.A.locals&&mt.A.locals;const gt=(0,b.A)(pt,(function(){var t=this,e=t._self._c;return t._self._setupProxy,e("NcDialog",{staticClass:"file-request-dialog",attrs:{"can-close":"","data-cy-file-request-dialog":"","close-on-click-outside":!1,name:t.currentStep!==t.STEP.LAST?t.t("files_sharing","Create a file request"):t.t("files_sharing","File request created"),size:"normal"},on:{closing:t.onCancel},scopedSlots:t._u([{key:"actions",fn:function(){return[e("NcButton",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.SECOND,expression:"currentStep === STEP.SECOND"}],attrs:{"aria-label":t.t("files_sharing","Previous step"),disabled:t.loading,"data-cy-file-request-dialog-controls":"back",type:"tertiary"},on:{click:function(e){t.currentStep=t.STEP.FIRST}}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Previous step"))+"\n\t\t")]),t._v(" "),e("span",{staticClass:"dialog__actions-separator"}),t._v(" "),t.currentStep!==t.STEP.LAST?e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Cancel"),disabled:t.loading,title:t.t("files_sharing","Cancel the file request creation"),"data-cy-file-request-dialog-controls":"cancel",type:"tertiary"},on:{click:t.onCancel}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Cancel"))+"\n\t\t")]):0!==t.emails.length?e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Close without sending emails"),disabled:t.loading,title:t.t("files_sharing","Close without sending emails"),"data-cy-file-request-dialog-controls":"cancel",type:"tertiary"},on:{click:t.onCancel}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Close"))+"\n\t\t")]):t._e(),t._v(" "),t.currentStep!==t.STEP.LAST?e("NcButton",{attrs:{"aria-label":t.t("files_sharing","Continue"),disabled:t.loading,"data-cy-file-request-dialog-controls":"next"},on:{click:t.onPageNext},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("NcLoadingIcon"):e("IconNext",{attrs:{size:20}})]},proxy:!0}],null,!1,3563923451)},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Continue"))+"\n\t\t")]):e("NcButton",{attrs:{"aria-label":t.finishButtonLabel,disabled:t.loading,"data-cy-file-request-dialog-controls":"finish",type:"primary"},on:{click:t.onFinish},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("NcLoadingIcon"):e("IconCheck",{attrs:{size:20}})]},proxy:!0}])},[t._v("\n\t\t\t"+t._s(t.finishButtonLabel)+"\n\t\t")])]},proxy:!0}])},[e("NcNoteCard",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.FIRST,expression:"currentStep === STEP.FIRST"}],staticClass:"file-request-dialog__header",attrs:{type:"info"}},[e("p",{staticClass:"file-request-dialog__description",attrs:{id:"file-request-dialog-description"}},[t._v("\n\t\t\t"+t._s(t.t("files_sharing","Collect files from others even if they do not have an account."))+"\n\t\t\t"+t._s(t.t("files_sharing","To ensure you can receive files, verify you have enough storage available."))+"\n\t\t")])]),t._v(" "),e("form",{ref:"form",staticClass:"file-request-dialog__form",attrs:{"aria-describedby":"file-request-dialog-description","aria-label":t.t("files_sharing","File request"),"aria-live":"polite","data-cy-file-request-dialog-form":""},on:{submit:function(t){t.preventDefault(),t.stopPropagation()}}},[e("FileRequestIntro",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.FIRST,expression:"currentStep === STEP.FIRST"}],attrs:{context:t.context,destination:t.destination,disabled:t.loading,label:t.label,note:t.note},on:{"update:destination":function(e){t.destination=e},"update:label":function(e){t.label=e},"update:note":function(e){t.note=e}}}),t._v(" "),e("FileRequestDatePassword",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.SECOND,expression:"currentStep === STEP.SECOND"}],attrs:{disabled:t.loading,"expiration-date":t.expirationDate,password:t.password},on:{"update:expirationDate":function(e){t.expirationDate=e},"update:expiration-date":function(e){t.expirationDate=e},"update:password":function(e){t.password=e}}}),t._v(" "),t.share?e("FileRequestFinish",{directives:[{name:"show",rawName:"v-show",value:t.currentStep===t.STEP.LAST,expression:"currentStep === STEP.LAST"}],attrs:{emails:t.emails,"is-share-by-mail-enabled":t.isShareByMailEnabled,share:t.share},on:{"add-email":e=>t.emails.push(e),"remove-email":t.onRemoveEmail}}):t._e()],1)],1)}),[],!1,null,null,null).exports}}]);
|
|
//# sourceMappingURL=6244-6244.js.map?v=d3c677a8ea990de009dc
|