@pushwoosh/smart-components-kit 1.3.6 → 1.3.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MMS_ALLOWED_EXTENSIONS, MMS_MAX_ATTACHMENTS,
|
|
1
|
+
export { MMS_ALLOWED_EXTENSIONS, MMS_MAX_ATTACHMENTS, MMS_MAX_FILE_SIZE_BYTES, MMS_SUBJECT_MAX_ASCII_LENGTH, MMS_SUBJECT_MAX_UNICODE_LENGTH, getMmsSubjectLength, getMmsSubjectMaxLength, isMmsAttachmentOversized, isMmsAttachmentUrl, isMmsMessageAtValid, isMmsSubjectTooLong, } from './rules';
|
package/mmsAttachments/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { MMS_ALLOWED_EXTENSIONS, MMS_MAX_ATTACHMENTS,
|
|
1
|
+
export { MMS_ALLOWED_EXTENSIONS, MMS_MAX_ATTACHMENTS, MMS_MAX_FILE_SIZE_BYTES, MMS_SUBJECT_MAX_ASCII_LENGTH, MMS_SUBJECT_MAX_UNICODE_LENGTH, getMmsSubjectLength, getMmsSubjectMaxLength, isMmsAttachmentOversized, isMmsAttachmentUrl, isMmsMessageAtValid, isMmsSubjectTooLong } from './rules';
|
|
@@ -8,20 +8,20 @@ export declare const MMS_SUBJECT_MAX_ASCII_LENGTH = 40;
|
|
|
8
8
|
export declare const MMS_SUBJECT_MAX_UNICODE_LENGTH = 13;
|
|
9
9
|
export declare const MMS_ALLOWED_EXTENSIONS: string[];
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* The provider rejects anything heavier, so an oversized attachment fails the whole send.
|
|
12
|
+
* Media-library sizes are not always known, so the forms warn on it instead of blocking.
|
|
13
13
|
*/
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const MMS_MAX_FILE_SIZE_BYTES: number;
|
|
15
15
|
/**
|
|
16
16
|
* The provider downloads the attachment itself, so it has to be a public https url whose
|
|
17
17
|
* *path* ends with a supported image extension. Checking the path (not the whole url) matches
|
|
18
18
|
* the backend and keeps query strings — signatures, cache busters — from passing as extensions.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* PNG, JPEG, WebP and the legacy media-library files stored without an extension drop out
|
|
21
|
+
* here: all of them are fetchable, none is decoded by the provider.
|
|
22
22
|
*/
|
|
23
23
|
export declare const isMmsAttachmentUrl: (url: string) => boolean;
|
|
24
|
-
/** Whether the file is
|
|
24
|
+
/** Whether the file is over the provider's size limit and will be rejected on send. */
|
|
25
25
|
export declare const isMmsAttachmentOversized: (file: MediaFile) => boolean;
|
|
26
26
|
/**
|
|
27
27
|
* Subject length budget: the provider counts non-ASCII subjects against a much shorter
|
package/mmsAttachments/rules.js
CHANGED
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
export const MMS_MAX_ATTACHMENTS = 3;
|
|
6
6
|
export const MMS_SUBJECT_MAX_ASCII_LENGTH = 40;
|
|
7
7
|
export const MMS_SUBJECT_MAX_UNICODE_LENGTH = 13;
|
|
8
|
-
export const MMS_ALLOWED_EXTENSIONS = ['.jpg', '.
|
|
8
|
+
export const MMS_ALLOWED_EXTENSIONS = ['.jpg', '.gif'];
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* The provider rejects anything heavier, so an oversized attachment fails the whole send.
|
|
11
|
+
* Media-library sizes are not always known, so the forms warn on it instead of blocking.
|
|
12
12
|
*/
|
|
13
|
-
export const
|
|
13
|
+
export const MMS_MAX_FILE_SIZE_BYTES = 200 * 1024;
|
|
14
14
|
/**
|
|
15
15
|
* The provider downloads the attachment itself, so it has to be a public https url whose
|
|
16
16
|
* *path* ends with a supported image extension. Checking the path (not the whole url) matches
|
|
17
17
|
* the backend and keeps query strings — signatures, cache busters — from passing as extensions.
|
|
18
18
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* PNG, JPEG, WebP and the legacy media-library files stored without an extension drop out
|
|
20
|
+
* here: all of them are fetchable, none is decoded by the provider.
|
|
21
21
|
*/
|
|
22
22
|
export const isMmsAttachmentUrl = url => {
|
|
23
23
|
let parsed;
|
|
@@ -30,8 +30,8 @@ export const isMmsAttachmentUrl = url => {
|
|
|
30
30
|
const path = parsed.pathname.toLowerCase();
|
|
31
31
|
return MMS_ALLOWED_EXTENSIONS.some(extension => path.endsWith(extension));
|
|
32
32
|
};
|
|
33
|
-
/** Whether the file is
|
|
34
|
-
export const isMmsAttachmentOversized = file => file.fileSize >
|
|
33
|
+
/** Whether the file is over the provider's size limit and will be rejected on send. */
|
|
34
|
+
export const isMmsAttachmentOversized = file => file.fileSize > MMS_MAX_FILE_SIZE_BYTES;
|
|
35
35
|
/**
|
|
36
36
|
* Subject length budget: the provider counts non-ASCII subjects against a much shorter
|
|
37
37
|
* limit, so a single non-ASCII character drops the whole subject to 13.
|
package/package.json
CHANGED