@sparkvault/sdk-js 16.7.0 → 16.8.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/index.cjs +212 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +212 -116
- package/dist/index.mjs.map +1 -1
- package/dist/products/help-desk/form-attachments.d.ts +2 -0
- package/dist/products/help-desk/form-composer.d.ts +9 -5
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -14333,29 +14333,27 @@ Array.from({ length: 1 << BRAND_BITS.size }, (_, mask) =>
|
|
|
14333
14333
|
* theirs. Every timeline event type declares whether a customer may see it;
|
|
14334
14334
|
* a customer-facing projection keeps only `public` types (an allowlist, so a
|
|
14335
14335
|
* new type is hidden until it says otherwise). The portal's client name and
|
|
14336
|
-
* API prefix,
|
|
14336
|
+
* API prefix, queue mail aliases, the attachment ceremony's steps, the
|
|
14337
14337
|
* question a customer's new request asks before it is discarded, session,
|
|
14338
14338
|
* sign-in code (its length, lifetime, sender, resend wait, countdown and
|
|
14339
14339
|
* the code step's words), merge and pending-attachment timings, hold
|
|
14340
|
-
* presets,
|
|
14341
|
-
*
|
|
14340
|
+
* presets, size limits, the operator display and desk mode choices, the
|
|
14341
|
+
* operator queue's views and orders, the reply review list's views and
|
|
14342
14342
|
* states, the response-time histogram's bucket edges, the sections of a
|
|
14343
14343
|
* desk's settings an address names, and the messages the widget's native
|
|
14344
14344
|
* sign-in posts between the website and its first-party page live here for
|
|
14345
|
-
* the same reason. So
|
|
14346
|
-
*
|
|
14347
|
-
*
|
|
14348
|
-
*
|
|
14349
|
-
*
|
|
14350
|
-
* the portal, the SDK and the console's composer each send their messages
|
|
14351
|
-
* under, and the one rule that a message sent again is the same message
|
|
14345
|
+
* the same reason. So does the one rule a typed or pasted sign-in code is
|
|
14346
|
+
* read by (helpDeskPinDigits), which every sign-in form applies. So does the
|
|
14347
|
+
* one way a client names a message it sends (newMessageId), which the
|
|
14348
|
+
* portal, the SDK and the console's composer each send their messages under,
|
|
14349
|
+
* and the one rule that a message sent again is the same message
|
|
14352
14350
|
* (sameMessage), which keeps its name.
|
|
14353
14351
|
*
|
|
14354
14352
|
* BROWSER-SAFE: data and pure functions, and newMessageId's count of the ids
|
|
14355
|
-
* its page named; its imports are the
|
|
14356
|
-
*
|
|
14357
|
-
*
|
|
14358
|
-
*
|
|
14353
|
+
* its page named; its imports are the mail products whose fixed From local
|
|
14354
|
+
* parts no queue alias may take (./mail-products.js), the brand rule no queue
|
|
14355
|
+
* alias may read as (./organization-name.js) and the resource id rule a desk
|
|
14356
|
+
* id is read by (./ids.js).
|
|
14359
14357
|
*/
|
|
14360
14358
|
|
|
14361
14359
|
|
|
@@ -14387,10 +14385,10 @@ const HELP_DESK_WIDGET_IDENTITY_MESSAGES = Object.freeze({
|
|
|
14387
14385
|
});
|
|
14388
14386
|
|
|
14389
14387
|
/**
|
|
14390
|
-
* Mail local parts no
|
|
14388
|
+
* Mail local parts no queue may take as its alias: the role mailboxes RFC 2142
|
|
14391
14389
|
* names, the addresses mail systems and their operators keep for themselves,
|
|
14392
14390
|
* the platform's own host labels, and the fixed local part every other mail
|
|
14393
|
-
* product writes from (MAIL_PRODUCTS fromLocalPart), so no
|
|
14391
|
+
* product writes from (MAIL_PRODUCTS fromLocalPart), so no queue writes from
|
|
14394
14392
|
* the address Notify writes from on a domain both products use.
|
|
14395
14393
|
*/
|
|
14396
14394
|
Object.freeze([
|
|
@@ -14401,8 +14399,8 @@ Object.freeze([
|
|
|
14401
14399
|
...MAIL_PRODUCT_KEYS.map((key) => MAIL_PRODUCTS[key].fromLocalPart).filter((localPart) => localPart !== null)
|
|
14402
14400
|
]);
|
|
14403
14401
|
|
|
14404
|
-
/** The alias a
|
|
14405
|
-
const
|
|
14402
|
+
/** The alias a desk without a mailbox of its own receives and writes from, wherever a queue claims none. */
|
|
14403
|
+
const DEFAULT_QUEUE_ALIAS = 'support';
|
|
14406
14404
|
|
|
14407
14405
|
/**
|
|
14408
14406
|
* What a customer's new request asks before Cancel throws away what they
|
|
@@ -14455,14 +14453,14 @@ function helpDeskPinDigits(value) {
|
|
|
14455
14453
|
}
|
|
14456
14454
|
|
|
14457
14455
|
/**
|
|
14458
|
-
* The address a desk's emailed sign-in codes come from: its default
|
|
14456
|
+
* The address a desk's emailed sign-in codes come from: its default queue
|
|
14459
14457
|
* alias on the host the desk sends from (the desk lookup's `sending_host`).
|
|
14460
14458
|
*
|
|
14461
14459
|
* @param {string} sendingHost
|
|
14462
14460
|
* @returns {string}
|
|
14463
14461
|
*/
|
|
14464
14462
|
function helpDeskCodeSender(sendingHost) {
|
|
14465
|
-
return `${
|
|
14463
|
+
return `${DEFAULT_QUEUE_ALIAS}@${sendingHost}`;
|
|
14466
14464
|
}
|
|
14467
14465
|
|
|
14468
14466
|
/**
|
|
@@ -14538,7 +14536,7 @@ const HELP_DESK_ROLES = Object.freeze(['manager', 'agent', 'trainee']);
|
|
|
14538
14536
|
*
|
|
14539
14537
|
* see_desk list the desk, read its settings and queues
|
|
14540
14538
|
* view_tickets read every ticket of the desk, every queue and untriaged included
|
|
14541
|
-
* work_tickets notes, status, priority,
|
|
14539
|
+
* work_tickets notes, status, priority, assignment changes, attachments, merges
|
|
14542
14540
|
* reply send a customer reply directly (a Trainee's reply becomes a review instead)
|
|
14543
14541
|
* submit_reply_for_approval a customer reply is held for a Manager's approval
|
|
14544
14542
|
* open_request open a request for a customer with a first message
|
|
@@ -19237,6 +19235,7 @@ function createFormAttachments(client, prefix, context, onEntriesChange) {
|
|
|
19237
19235
|
get attachmentIds() { return entries.filter(entry => entry.state === 'complete' && entry.attachmentId).map(entry => entry.attachmentId); },
|
|
19238
19236
|
get unresolved() { return entries.some(entry => entry.state !== 'complete'); },
|
|
19239
19237
|
get hasEntries() { return entries.length > 0; },
|
|
19238
|
+
get names() { return entries.map(entry => entry.file.name); },
|
|
19240
19239
|
add,
|
|
19241
19240
|
async start() { await Promise.all(entries.map(entry => entry.operation ?? (entry.state === 'queued' ? run(entry) : Promise.resolve()))); },
|
|
19242
19241
|
lock(value) { locked = value; syncPicking(); entries.forEach(controls); },
|
|
@@ -19257,19 +19256,178 @@ function createFormAttachments(client, prefix, context, onEntriesChange) {
|
|
|
19257
19256
|
};
|
|
19258
19257
|
}
|
|
19259
19258
|
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19259
|
+
/**
|
|
19260
|
+
* Files brought to a message's composer by drag, drop and paste, handled
|
|
19261
|
+
* alike by every composer that takes them: the console's reply composer and
|
|
19262
|
+
* the SDK's support form. A composer says what a file brought now does
|
|
19263
|
+
* (attach, refuse in words, or nothing) and what attaching and refusing are;
|
|
19264
|
+
* this owns the rest of the policy.
|
|
19265
|
+
*
|
|
19266
|
+
* - A drag carries files only when its types name them; a drag or paste of
|
|
19267
|
+
* text is the browser's.
|
|
19268
|
+
* - A drag of files is never the browser's to open in place of the page:
|
|
19269
|
+
* dragenter and dragover are cancelled. A file the composer refuses keeps a
|
|
19270
|
+
* drop effect, so it is refused in words when it lands; one it takes
|
|
19271
|
+
* nothing from (a send under way) shows the cursor's refusal.
|
|
19272
|
+
* - The drop prompt shows while files the composer attaches are over its
|
|
19273
|
+
* frame, and goes when they leave the frame or land.
|
|
19274
|
+
* - A dropped folder arrives as a file that cannot be read, so a drop's files
|
|
19275
|
+
* leave the folders out and count them, for the composer to say so.
|
|
19276
|
+
* - A paste that carries files is those files, and the text beside them is
|
|
19277
|
+
* only their names (a file copied in the system's file manager). Office
|
|
19278
|
+
* apps are the exception: copied cells or paragraphs come as text and
|
|
19279
|
+
* formatted text, with a picture of them as a file, and that paste is the
|
|
19280
|
+
* text.
|
|
19281
|
+
* - A picture pasted from the clipboard is named "image.png" every time, so
|
|
19282
|
+
* it is numbered after the highest "Pasted image N" the composer holds
|
|
19283
|
+
* ("Pasted image 1.png"), which tells chips, and their Remove buttons,
|
|
19284
|
+
* apart, a restored draft's among them.
|
|
19285
|
+
*
|
|
19286
|
+
* BROWSER-SAFE: reads only the events it is handed and what the composer
|
|
19287
|
+
* says.
|
|
19288
|
+
*/
|
|
19289
|
+
|
|
19290
|
+
/** What a composer reads while files are dragged over it. */
|
|
19291
|
+
const DROP_FILES_COPY = 'Drop the files to attach them.';
|
|
19292
|
+
|
|
19293
|
+
/** What a person reads when a drop held a folder, which is never attached. */
|
|
19294
|
+
const FOLDER_REFUSAL_COPY = 'Folders can’t be attached. Add the files inside them instead.';
|
|
19295
|
+
|
|
19296
|
+
/** The name the clipboard gives every pasted picture, with its extension. */
|
|
19297
|
+
const CLIPBOARD_IMAGE_NAME = /^image\.(\w+)$/;
|
|
19298
|
+
|
|
19299
|
+
/** A pasted picture's name once numbered, its number captured. */
|
|
19300
|
+
const PASTED_IMAGE_NAME = /^Pasted image (\d+)\./;
|
|
19301
|
+
|
|
19302
|
+
/**
|
|
19303
|
+
* Whether a drag carries files.
|
|
19304
|
+
*
|
|
19305
|
+
* @param {DataTransfer|null|undefined} transfer - The drag event's dataTransfer
|
|
19306
|
+
* @returns {boolean}
|
|
19307
|
+
*/
|
|
19308
|
+
function carriesFiles(transfer) {
|
|
19309
|
+
return Array.from(transfer?.types ?? []).includes('Files');
|
|
19310
|
+
}
|
|
19311
|
+
|
|
19312
|
+
/**
|
|
19313
|
+
* The files a paste carries, or none when the paste is text: one with no
|
|
19314
|
+
* files, or an Office app's copy (formatted text and its text beside a
|
|
19315
|
+
* picture of them).
|
|
19316
|
+
*
|
|
19317
|
+
* @param {DataTransfer|null|undefined} clipboard - The paste event's clipboardData
|
|
19318
|
+
* @returns {File[]}
|
|
19319
|
+
*/
|
|
19320
|
+
function pastedFiles(clipboard) {
|
|
19321
|
+
if (!clipboard || clipboard.files.length === 0) return [];
|
|
19322
|
+
if (Array.from(clipboard.types).includes('text/html') && clipboard.getData('text/plain')) return [];
|
|
19323
|
+
return Array.from(clipboard.files);
|
|
19324
|
+
}
|
|
19325
|
+
|
|
19326
|
+
/**
|
|
19327
|
+
* The files a drop carries, its folders left out and counted.
|
|
19328
|
+
*
|
|
19329
|
+
* @param {DataTransfer} transfer - The drop event's dataTransfer
|
|
19330
|
+
* @returns {{ files: File[], folders: number }}
|
|
19331
|
+
*/
|
|
19332
|
+
function droppedFiles(transfer) {
|
|
19333
|
+
const files = [];
|
|
19334
|
+
let folders = 0;
|
|
19335
|
+
for (const item of Array.from(transfer.items)) {
|
|
19336
|
+
if (item.kind !== 'file') continue;
|
|
19337
|
+
if (item.webkitGetAsEntry()?.isDirectory) {
|
|
19338
|
+
folders += 1;
|
|
19339
|
+
continue;
|
|
19340
|
+
}
|
|
19341
|
+
const file = item.getAsFile();
|
|
19342
|
+
if (file) files.push(file);
|
|
19343
|
+
}
|
|
19344
|
+
return { files, folders };
|
|
19345
|
+
}
|
|
19346
|
+
|
|
19347
|
+
/**
|
|
19348
|
+
* Pasted files as they join a composer: each the clipboard named
|
|
19349
|
+
* "image.<ext>" comes back as "Pasted image N.<ext>", N counting on from the
|
|
19350
|
+
* highest the composer holds; any other comes back as it is.
|
|
19351
|
+
*
|
|
19352
|
+
* @param {File[]} files - The paste's files
|
|
19353
|
+
* @param {string[]} heldNames - The names of the files the composer holds
|
|
19354
|
+
* @returns {File[]}
|
|
19355
|
+
*/
|
|
19356
|
+
function namePasted(files, heldNames) {
|
|
19357
|
+
let number = heldNames.reduce((highest, name) => Math.max(highest, Number(PASTED_IMAGE_NAME.exec(name)?.[1] ?? 0)), 0);
|
|
19358
|
+
return files.map((file) => {
|
|
19359
|
+
const extension = CLIPBOARD_IMAGE_NAME.exec(file.name)?.[1];
|
|
19360
|
+
if (extension === undefined) return file;
|
|
19361
|
+
number += 1;
|
|
19362
|
+
return new File([file], `Pasted image ${number}.${extension}`, { type: file.type, lastModified: file.lastModified });
|
|
19363
|
+
});
|
|
19263
19364
|
}
|
|
19365
|
+
|
|
19366
|
+
/**
|
|
19367
|
+
* A composer's handlers for files brought to it, alike as DOM listeners and
|
|
19368
|
+
* as React's event props: `dragOver` answers dragenter and dragover, on the
|
|
19369
|
+
* element a file may be dropped anywhere over; `paste`, on each field a file
|
|
19370
|
+
* may be pasted into.
|
|
19371
|
+
*
|
|
19372
|
+
* @param {Object} composer
|
|
19373
|
+
* @param {() => ('attach'|'refuse'|'none')} composer.action - What a file brought now does
|
|
19374
|
+
* @param {(node: EventTarget|null) => boolean} composer.frameHolds - Whether a node lies in the frame, where the drop prompt shows
|
|
19375
|
+
* @param {() => string[]} composer.heldNames - The names of the files the composer holds
|
|
19376
|
+
* @param {(on: boolean) => void} composer.dragging - Shows or hides the drop prompt
|
|
19377
|
+
* @param {(files: File[], folders: number) => void} composer.attach - Attaches files; `folders` counts the folders a drop left out
|
|
19378
|
+
* @param {() => void} composer.refuse - Refuses the files in words
|
|
19379
|
+
* @returns {{ dragOver: (event: DragEvent) => void, dragLeave: (event: DragEvent) => void, drop: (event: DragEvent) => void, paste: (event: ClipboardEvent) => void }}
|
|
19380
|
+
*/
|
|
19381
|
+
function composerFileEvents({ action, frameHolds, heldNames, dragging, attach, refuse }) {
|
|
19382
|
+
return {
|
|
19383
|
+
dragOver(event) {
|
|
19384
|
+
if (!carriesFiles(event.dataTransfer)) return;
|
|
19385
|
+
event.preventDefault();
|
|
19386
|
+
const now = action();
|
|
19387
|
+
event.dataTransfer.dropEffect = now === 'none' ? 'none' : 'copy';
|
|
19388
|
+
dragging(now === 'attach' && frameHolds(event.target));
|
|
19389
|
+
},
|
|
19390
|
+
dragLeave(event) {
|
|
19391
|
+
if (!frameHolds(event.relatedTarget)) dragging(false);
|
|
19392
|
+
},
|
|
19393
|
+
drop(event) {
|
|
19394
|
+
if (!carriesFiles(event.dataTransfer)) return;
|
|
19395
|
+
event.preventDefault();
|
|
19396
|
+
dragging(false);
|
|
19397
|
+
const now = action();
|
|
19398
|
+
if (now === 'attach') {
|
|
19399
|
+
const { files, folders } = droppedFiles(event.dataTransfer);
|
|
19400
|
+
attach(files, folders);
|
|
19401
|
+
} else if (now === 'refuse') {
|
|
19402
|
+
refuse();
|
|
19403
|
+
}
|
|
19404
|
+
},
|
|
19405
|
+
// A paste of files lands none of its text (only their names) in the field.
|
|
19406
|
+
paste(event) {
|
|
19407
|
+
const files = pastedFiles(event.clipboardData);
|
|
19408
|
+
if (files.length === 0) return;
|
|
19409
|
+
const now = action();
|
|
19410
|
+
if (now === 'none') return;
|
|
19411
|
+
event.preventDefault();
|
|
19412
|
+
if (now === 'attach') attach(namePasted(files, heldNames()), 0);
|
|
19413
|
+
else refuse();
|
|
19414
|
+
}
|
|
19415
|
+
};
|
|
19416
|
+
}
|
|
19417
|
+
|
|
19264
19418
|
/**
|
|
19265
19419
|
* The details field as a composer. A file pasted into the summary or the
|
|
19266
19420
|
* details, or dropped anywhere on the request step, joins the form's one
|
|
19267
19421
|
* attachment pipeline (`attachments.add`), under the same limits and
|
|
19268
|
-
* refusals as a picked one; the drop target shows only over the composer.
|
|
19269
|
-
*
|
|
19270
|
-
*
|
|
19271
|
-
*
|
|
19272
|
-
*
|
|
19422
|
+
* refusals as a picked one; the drop target shows only over the composer.
|
|
19423
|
+
* How a drag, a drop and a paste are answered (which files they carry, the
|
|
19424
|
+
* folders a drop leaves out, the names of pasted pictures, when the drop
|
|
19425
|
+
* target shows) is @sparkvault/app-sdk/composer-files' to decide; this says
|
|
19426
|
+
* what a file brought now does. A paste or drag of text alone stays the
|
|
19427
|
+
* browser's. A file brought over the form is never the browser's to open in
|
|
19428
|
+
* place of the unsent request: on the sign-in step, or while the form takes
|
|
19429
|
+
* no files, it is refused outright, and a desk that takes no files says so
|
|
19430
|
+
* when the file is dropped.
|
|
19273
19431
|
*/
|
|
19274
19432
|
function createComposer(options) {
|
|
19275
19433
|
const { form, summary, textarea, attachments, deskRefusesFiles, onRequestStep } = options;
|
|
@@ -19278,14 +19436,13 @@ function createComposer(options) {
|
|
|
19278
19436
|
textarea.classList.add('svhd-composer-input');
|
|
19279
19437
|
const drop = document.createElement('p');
|
|
19280
19438
|
drop.className = 'svhd-composer-drop';
|
|
19281
|
-
drop.textContent =
|
|
19439
|
+
drop.textContent = DROP_FILES_COPY;
|
|
19282
19440
|
drop.hidden = true;
|
|
19283
19441
|
frame.append(textarea, drop);
|
|
19284
19442
|
if (attachments)
|
|
19285
19443
|
frame.append(attachments.toolbar, attachments.list);
|
|
19286
19444
|
const notice = attachments?.notice ?? createNotice();
|
|
19287
19445
|
const fields = [summary, textarea];
|
|
19288
|
-
let pastedImages = 0;
|
|
19289
19446
|
function fileAction() {
|
|
19290
19447
|
if (!onRequestStep())
|
|
19291
19448
|
return 'none';
|
|
@@ -19302,91 +19459,30 @@ function createComposer(options) {
|
|
|
19302
19459
|
return;
|
|
19303
19460
|
setNotice(notice, NO_CUSTOMER_FILES_COPY);
|
|
19304
19461
|
}
|
|
19305
|
-
// A dropped folder
|
|
19306
|
-
//
|
|
19307
|
-
function
|
|
19308
|
-
const files = [];
|
|
19309
|
-
let folders = 0;
|
|
19310
|
-
for (const item of Array.from(transfer.items)) {
|
|
19311
|
-
if (item.kind !== 'file')
|
|
19312
|
-
continue;
|
|
19313
|
-
if (item.webkitGetAsEntry()?.isDirectory) {
|
|
19314
|
-
folders += 1;
|
|
19315
|
-
continue;
|
|
19316
|
-
}
|
|
19317
|
-
const file = item.getAsFile();
|
|
19318
|
-
if (file)
|
|
19319
|
-
files.push(file);
|
|
19320
|
-
}
|
|
19462
|
+
// A dropped folder is left out, and said so beside any refusal the files
|
|
19463
|
+
// with it met.
|
|
19464
|
+
function attach(files, folders) {
|
|
19321
19465
|
if (files.length > 0)
|
|
19322
19466
|
attachments?.add(files);
|
|
19323
19467
|
if (folders > 0)
|
|
19324
|
-
setNotice(notice, files.length > 0 && !notice.hidden ? `${
|
|
19325
|
-
}
|
|
19326
|
-
|
|
19327
|
-
|
|
19328
|
-
|
|
19329
|
-
|
|
19330
|
-
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
}
|
|
19335
|
-
// Cancelling dragenter and dragover keeps the browser from opening the file
|
|
19336
|
-
// in place of the page. A drop effect of none cancels the drop itself, so a
|
|
19337
|
-
// file the desk refuses keeps one to be refused in words when it lands.
|
|
19338
|
-
const onDragOver = (event) => {
|
|
19339
|
-
if (!carriesFiles(event))
|
|
19340
|
-
return;
|
|
19341
|
-
event.preventDefault();
|
|
19342
|
-
const action = fileAction();
|
|
19343
|
-
if (event.dataTransfer)
|
|
19344
|
-
event.dataTransfer.dropEffect = action === 'none' ? 'none' : 'copy';
|
|
19345
|
-
dragging(action === 'attach' && event.target instanceof Node && frame.contains(event.target));
|
|
19346
|
-
};
|
|
19347
|
-
const onDragLeave = (event) => {
|
|
19348
|
-
if (!(event.relatedTarget instanceof Node) || !frame.contains(event.relatedTarget))
|
|
19349
|
-
dragging(false);
|
|
19350
|
-
};
|
|
19351
|
-
const onDrop = (event) => {
|
|
19352
|
-
if (!carriesFiles(event))
|
|
19353
|
-
return;
|
|
19354
|
-
event.preventDefault();
|
|
19355
|
-
dragging(false);
|
|
19356
|
-
const action = fileAction();
|
|
19357
|
-
if (action === 'attach' && event.dataTransfer)
|
|
19358
|
-
attachDropped(event.dataTransfer);
|
|
19359
|
-
else if (action === 'refuse')
|
|
19360
|
-
refuseFiles();
|
|
19361
|
-
};
|
|
19362
|
-
// A paste that carries files is those files, and the text beside them is
|
|
19363
|
-
// only their names (a file copied in the system's file manager), so none of
|
|
19364
|
-
// it lands in the field. Office apps are the exception: copied cells or
|
|
19365
|
-
// paragraphs come as text and formatted text, with a picture of them as a
|
|
19366
|
-
// file, and that paste is the text.
|
|
19367
|
-
const onPaste = (event) => {
|
|
19368
|
-
const clipboard = event.clipboardData;
|
|
19369
|
-
if (!clipboard || clipboard.files.length === 0)
|
|
19370
|
-
return;
|
|
19371
|
-
if (Array.from(clipboard.types).includes('text/html') && clipboard.getData('text/plain'))
|
|
19372
|
-
return;
|
|
19373
|
-
const action = fileAction();
|
|
19374
|
-
if (action === 'none')
|
|
19375
|
-
return;
|
|
19376
|
-
event.preventDefault();
|
|
19377
|
-
if (action === 'attach')
|
|
19378
|
-
attachments?.add(Array.from(clipboard.files, pastedName));
|
|
19379
|
-
else
|
|
19380
|
-
refuseFiles();
|
|
19381
|
-
};
|
|
19468
|
+
setNotice(notice, files.length > 0 && !notice.hidden ? `${FOLDER_REFUSAL_COPY} ${notice.textContent}` : FOLDER_REFUSAL_COPY);
|
|
19469
|
+
}
|
|
19470
|
+
const fileEvents = composerFileEvents({
|
|
19471
|
+
action: fileAction,
|
|
19472
|
+
frameHolds: (node) => node instanceof Node && frame.contains(node),
|
|
19473
|
+
heldNames: () => attachments?.names ?? [],
|
|
19474
|
+
dragging,
|
|
19475
|
+
attach,
|
|
19476
|
+
refuse: refuseFiles,
|
|
19477
|
+
});
|
|
19382
19478
|
const onInput = () => { if (!attachments)
|
|
19383
19479
|
setNotice(notice, null); };
|
|
19384
|
-
form.addEventListener('dragenter',
|
|
19385
|
-
form.addEventListener('dragover',
|
|
19386
|
-
form.addEventListener('dragleave',
|
|
19387
|
-
form.addEventListener('drop',
|
|
19480
|
+
form.addEventListener('dragenter', fileEvents.dragOver);
|
|
19481
|
+
form.addEventListener('dragover', fileEvents.dragOver);
|
|
19482
|
+
form.addEventListener('dragleave', fileEvents.dragLeave);
|
|
19483
|
+
form.addEventListener('drop', fileEvents.drop);
|
|
19388
19484
|
for (const field of fields) {
|
|
19389
|
-
field.addEventListener('paste',
|
|
19485
|
+
field.addEventListener('paste', fileEvents.paste);
|
|
19390
19486
|
field.addEventListener('input', onInput);
|
|
19391
19487
|
}
|
|
19392
19488
|
return {
|
|
@@ -19394,12 +19490,12 @@ function createComposer(options) {
|
|
|
19394
19490
|
notice,
|
|
19395
19491
|
clearNotice: () => setNotice(notice, null),
|
|
19396
19492
|
destroy() {
|
|
19397
|
-
form.removeEventListener('dragenter',
|
|
19398
|
-
form.removeEventListener('dragover',
|
|
19399
|
-
form.removeEventListener('dragleave',
|
|
19400
|
-
form.removeEventListener('drop',
|
|
19493
|
+
form.removeEventListener('dragenter', fileEvents.dragOver);
|
|
19494
|
+
form.removeEventListener('dragover', fileEvents.dragOver);
|
|
19495
|
+
form.removeEventListener('dragleave', fileEvents.dragLeave);
|
|
19496
|
+
form.removeEventListener('drop', fileEvents.drop);
|
|
19401
19497
|
for (const field of fields) {
|
|
19402
|
-
field.removeEventListener('paste',
|
|
19498
|
+
field.removeEventListener('paste', fileEvents.paste);
|
|
19403
19499
|
field.removeEventListener('input', onInput);
|
|
19404
19500
|
}
|
|
19405
19501
|
},
|
|
@@ -30444,7 +30540,7 @@ class SparkVault {
|
|
|
30444
30540
|
}
|
|
30445
30541
|
/** Get the SDK version */
|
|
30446
30542
|
static get version() {
|
|
30447
|
-
return '16.
|
|
30543
|
+
return '16.8.0';
|
|
30448
30544
|
}
|
|
30449
30545
|
}
|
|
30450
30546
|
if (typeof window !== 'undefined') {
|