@uploadcare/file-uploader 1.21.0-alpha.3 → 1.21.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/LICENSE +1 -1
- package/README.md +8 -2
- package/abstract/ActivityBlock.d.ts +0 -1
- package/abstract/ActivityBlock.d.ts.map +1 -1
- package/abstract/ActivityBlock.js +1 -1
- package/abstract/Block.d.ts +13 -2
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +35 -3
- package/abstract/CTX.d.ts +4 -4
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +2 -2
- package/abstract/SolutionBlock.d.ts +2 -2
- package/abstract/UploaderBlock.d.ts +9 -5
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +50 -13
- package/abstract/UploaderPublicApi.d.ts +2 -2
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +4 -4
- package/abstract/l10nProcessor.js +1 -1
- package/abstract/{LocaleManager.d.ts → managers/LocaleManager.d.ts} +8 -8
- package/abstract/{LocaleManager.d.ts.map → managers/LocaleManager.d.ts.map} +1 -1
- package/abstract/{LocaleManager.js → managers/LocaleManager.js} +8 -8
- package/abstract/{ModalManager.d.ts → managers/ModalManager.d.ts} +7 -7
- package/abstract/{ModalManager.d.ts.map → managers/ModalManager.d.ts.map} +1 -1
- package/abstract/{ModalManager.js → managers/ModalManager.js} +4 -3
- package/abstract/managers/SecureUploadsManager.d.ts +22 -0
- package/abstract/{SecureUploadsManager.d.ts.map → managers/SecureUploadsManager.d.ts.map} +1 -1
- package/abstract/{SecureUploadsManager.js → managers/SecureUploadsManager.js} +9 -5
- package/abstract/managers/TelemetryManager.d.ts +71 -0
- package/abstract/managers/TelemetryManager.d.ts.map +1 -0
- package/abstract/managers/TelemetryManager.js +218 -0
- package/abstract/{ValidationManager.d.ts → managers/ValidationManager.d.ts} +7 -7
- package/abstract/managers/ValidationManager.d.ts.map +1 -0
- package/abstract/{ValidationManager.js → managers/ValidationManager.js} +16 -14
- package/abstract/{a11y.d.ts → managers/a11y.d.ts} +2 -2
- package/abstract/managers/a11y.d.ts.map +1 -0
- package/abstract/{a11y.js → managers/a11y.js} +1 -1
- package/blocks/CameraSource/CameraSource.d.ts +2 -2
- package/blocks/CameraSource/CameraSource.d.ts.map +1 -1
- package/blocks/CameraSource/CameraSource.js +15 -3
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts +2 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/CloudImageEditorBlock.js +20 -5
- package/blocks/CloudImageEditor/src/CropFrame.js +3 -3
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts +11 -0
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/EditorAspectRatioButtonControl.js +130 -0
- package/blocks/CloudImageEditor/src/EditorButtonControl.js +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +9 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +7 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorImageCropper.js +3 -3
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +1 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorOperationControl.js +9 -3
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +19 -7
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +88 -21
- package/blocks/CloudImageEditor/src/css/common.css +39 -7
- package/blocks/CloudImageEditor/src/index.d.ts +1 -0
- package/blocks/CloudImageEditor/src/index.js +1 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts +2 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.js +74 -8
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts +2 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/lib/parseCropPreset.test.js +35 -0
- package/blocks/CloudImageEditor/src/state.d.ts +2 -2
- package/blocks/CloudImageEditor/src/state.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/state.js +2 -2
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts +1 -1
- package/blocks/CloudImageEditor/src/svg-sprite.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/svg-sprite.js +1 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +2 -2
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.js +3 -2
- package/blocks/CloudImageEditor/src/types.d.ts +2 -0
- package/blocks/CloudImageEditor/src/types.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/types.js +9 -1
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +11 -0
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +1 -0
- package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +11 -0
- package/blocks/Config/Config.d.ts.map +1 -1
- package/blocks/Config/Config.js +6 -1
- package/blocks/Config/initialConfig.d.ts +1 -0
- package/blocks/Config/initialConfig.d.ts.map +1 -1
- package/blocks/Config/initialConfig.js +6 -2
- package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
- package/blocks/Config/normalizeConfigValue.js +3 -0
- package/blocks/Config/side-effects.d.ts +8 -4
- package/blocks/Config/side-effects.d.ts.map +1 -1
- package/blocks/Config/side-effects.js +115 -21
- package/blocks/DropArea/DropArea.d.ts +2 -2
- package/blocks/ExternalSource/ExternalSource.d.ts +2 -2
- package/blocks/ExternalSource/types.d.ts +0 -3
- package/blocks/ExternalSource/types.d.ts.map +1 -1
- package/blocks/ExternalSource/types.js +0 -4
- package/blocks/FileItem/FileItem.d.ts +2 -3
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +20 -18
- package/blocks/FileItem/FileItemConfig.d.ts +1 -1
- package/blocks/FileItem/FileItemConfig.d.ts.map +1 -1
- package/blocks/FileItem/FileItemConfig.js +3 -3
- package/blocks/Modal/Modal.d.ts +6 -6
- package/blocks/Modal/Modal.d.ts.map +1 -1
- package/blocks/Modal/Modal.js +10 -12
- package/blocks/SimpleBtn/SimpleBtn.d.ts +2 -2
- package/blocks/SourceBtn/SourceBtn.d.ts +2 -2
- package/blocks/SourceBtn/SourceBtn.d.ts.map +1 -1
- package/blocks/SourceBtn/SourceBtn.js +0 -8
- package/blocks/Thumb/Thumb.d.ts +2 -2
- package/blocks/Thumb/Thumb.d.ts.map +1 -1
- package/blocks/Thumb/Thumb.js +2 -0
- package/blocks/UploadCtxProvider/EventEmitter.d.ts +17 -4
- package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
- package/blocks/UploadCtxProvider/EventEmitter.js +14 -2
- package/blocks/UploadList/UploadList.d.ts +2 -2
- package/blocks/UrlSource/UrlSource.js +3 -1
- package/blocks/themes/uc-basic/common.css +4 -0
- package/blocks/themes/uc-basic/index.css +0 -1
- package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
- package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
- package/blocks/themes/uc-basic/svg-sprite.js +1 -1
- package/env.d.ts +1 -1
- package/env.js +1 -1
- package/index.d.ts +1 -2
- package/index.js +1 -2
- package/index.ssr.d.ts +19 -69
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +44 -143
- package/locales/file-uploader/ar.d.ts +4 -0
- package/locales/file-uploader/ar.js +5 -0
- package/locales/file-uploader/az.d.ts +4 -0
- package/locales/file-uploader/az.js +5 -0
- package/locales/file-uploader/ca.d.ts +4 -0
- package/locales/file-uploader/ca.js +6 -0
- package/locales/file-uploader/cs.d.ts +4 -0
- package/locales/file-uploader/cs.js +6 -0
- package/locales/file-uploader/da.d.ts +4 -0
- package/locales/file-uploader/da.js +6 -0
- package/locales/file-uploader/de.d.ts +4 -0
- package/locales/file-uploader/de.js +6 -0
- package/locales/file-uploader/el.d.ts +4 -0
- package/locales/file-uploader/el.js +6 -0
- package/locales/file-uploader/en.d.ts +4 -3
- package/locales/file-uploader/en.js +5 -3
- package/locales/file-uploader/es.d.ts +4 -0
- package/locales/file-uploader/es.js +6 -0
- package/locales/file-uploader/et.d.ts +4 -0
- package/locales/file-uploader/et.js +6 -0
- package/locales/file-uploader/fi.d.ts +4 -0
- package/locales/file-uploader/fi.js +6 -0
- package/locales/file-uploader/fr.d.ts +4 -0
- package/locales/file-uploader/fr.js +6 -0
- package/locales/file-uploader/he.d.ts +4 -0
- package/locales/file-uploader/he.js +6 -0
- package/locales/file-uploader/hy.d.ts +4 -0
- package/locales/file-uploader/hy.js +5 -0
- package/locales/file-uploader/is.d.ts +4 -0
- package/locales/file-uploader/is.js +6 -0
- package/locales/file-uploader/it.d.ts +4 -0
- package/locales/file-uploader/it.js +6 -0
- package/locales/file-uploader/ja.d.ts +4 -0
- package/locales/file-uploader/ja.js +6 -0
- package/locales/file-uploader/ka.d.ts +4 -0
- package/locales/file-uploader/ka.js +6 -0
- package/locales/file-uploader/kk.d.ts +4 -0
- package/locales/file-uploader/kk.js +6 -0
- package/locales/file-uploader/ko.d.ts +4 -0
- package/locales/file-uploader/ko.js +6 -0
- package/locales/file-uploader/lv.d.ts +4 -0
- package/locales/file-uploader/lv.js +6 -0
- package/locales/file-uploader/nb.d.ts +4 -0
- package/locales/file-uploader/nb.js +6 -0
- package/locales/file-uploader/nl.d.ts +4 -0
- package/locales/file-uploader/nl.js +6 -0
- package/locales/file-uploader/pl.d.ts +4 -0
- package/locales/file-uploader/pl.js +6 -0
- package/locales/file-uploader/pt.d.ts +4 -0
- package/locales/file-uploader/pt.js +6 -0
- package/locales/file-uploader/ro.d.ts +4 -0
- package/locales/file-uploader/ro.js +6 -0
- package/locales/file-uploader/ru.d.ts +4 -0
- package/locales/file-uploader/ru.js +6 -0
- package/locales/file-uploader/sk.d.ts +4 -0
- package/locales/file-uploader/sk.js +6 -0
- package/locales/file-uploader/sr.d.ts +4 -0
- package/locales/file-uploader/sr.js +6 -0
- package/locales/file-uploader/sv.d.ts +4 -0
- package/locales/file-uploader/sv.js +6 -0
- package/locales/file-uploader/tr.d.ts +4 -0
- package/locales/file-uploader/tr.js +6 -0
- package/locales/file-uploader/uk.d.ts +4 -0
- package/locales/file-uploader/uk.js +6 -0
- package/locales/file-uploader/vi.d.ts +4 -0
- package/locales/file-uploader/vi.js +6 -0
- package/locales/file-uploader/zh-TW.d.ts +4 -0
- package/locales/file-uploader/zh-TW.js +6 -0
- package/locales/file-uploader/zh.d.ts +4 -0
- package/locales/file-uploader/zh.js +6 -0
- package/package.json +8 -8
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts +35 -0
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -1
- package/solutions/cloud-image-editor/CloudImageEditor.js +12 -0
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts +3 -2
- package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
- package/solutions/file-uploader/inline/FileUploaderInline.js +4 -0
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +11 -10
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +9 -9
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +3 -2
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +4 -4
- package/types/events.d.ts +1 -1
- package/types/exported.d.ts +59 -52
- package/types/jsx.d.ts +2 -0
- package/utils/isPromiseLike.d.ts +2 -0
- package/utils/isPromiseLike.d.ts.map +1 -0
- package/utils/isPromiseLike.js +12 -0
- package/utils/isPromiseLike.test.d.ts +2 -0
- package/utils/isPromiseLike.test.d.ts.map +1 -0
- package/utils/isPromiseLike.test.js +20 -0
- package/utils/parseCdnUrl.d.ts.map +1 -1
- package/utils/parseCdnUrl.js +4 -1
- package/utils/parseCdnUrl.test.js +13 -0
- package/utils/validators/collection/validateCollectionUploadError.d.ts +2 -2
- package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -1
- package/utils/validators/collection/validateCollectionUploadError.js +1 -1
- package/utils/validators/collection/validateMultiple.d.ts +2 -2
- package/utils/validators/collection/validateMultiple.d.ts.map +1 -1
- package/utils/validators/collection/validateMultiple.js +1 -1
- package/utils/validators/file/validateFileType.d.ts +2 -2
- package/utils/validators/file/validateFileType.d.ts.map +1 -1
- package/utils/validators/file/validateFileType.js +1 -1
- package/utils/validators/file/validateIsImage.d.ts +2 -2
- package/utils/validators/file/validateIsImage.d.ts.map +1 -1
- package/utils/validators/file/validateIsImage.js +1 -1
- package/utils/validators/file/validateMaxSizeLimit.d.ts +2 -2
- package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -1
- package/utils/validators/file/validateMaxSizeLimit.js +1 -1
- package/utils/validators/file/validateUploadError.d.ts +2 -2
- package/utils/validators/file/validateUploadError.d.ts.map +1 -1
- package/utils/validators/file/validateUploadError.js +1 -1
- package/web/file-uploader.iife.min.js +5 -5
- package/web/file-uploader.min.js +5 -5
- package/web/uc-basic.min.css +1 -1
- package/web/uc-cloud-image-editor.min.css +1 -1
- package/web/uc-cloud-image-editor.min.js +5 -5
- package/web/uc-file-uploader-inline.min.css +1 -1
- package/web/uc-file-uploader-inline.min.js +5 -5
- package/web/uc-file-uploader-minimal.min.css +1 -1
- package/web/uc-file-uploader-minimal.min.js +5 -5
- package/web/uc-file-uploader-regular.min.css +1 -1
- package/web/uc-file-uploader-regular.min.js +5 -5
- package/web/uc-img.min.js +2 -2
- package/abstract/SecureUploadsManager.d.ts +0 -22
- package/abstract/ValidationManager.d.ts.map +0 -1
- package/abstract/a11y.d.ts.map +0 -1
- package/blocks/AiGenerateSource/AIGenerateSource.d.ts +0 -47
- package/blocks/AiGenerateSource/AIGenerateSource.d.ts.map +0 -1
- package/blocks/AiGenerateSource/AIGenerateSource.js +0 -180
- package/blocks/AiGenerateSource/ai-generate-source.css +0 -58
|
@@ -9,9 +9,9 @@ export const ModalEvents = Object.freeze({
|
|
|
9
9
|
DESTROY: 'modal:destroy',
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
/** @typedef {import('../
|
|
12
|
+
/** @typedef {import('../ActivityBlock').ActivityType} ModalId */
|
|
13
13
|
|
|
14
|
-
/** @typedef {import('
|
|
14
|
+
/** @typedef {import('../../blocks/Modal/Modal.js').Modal} ModalNode */
|
|
15
15
|
|
|
16
16
|
/** @typedef {(data: { id: ModalId; modal: ModalNode }) => void} ModalCb */
|
|
17
17
|
|
|
@@ -36,7 +36,7 @@ export class ModalManager {
|
|
|
36
36
|
*/
|
|
37
37
|
_subscribers = new Map();
|
|
38
38
|
|
|
39
|
-
/** @param {import('
|
|
39
|
+
/** @param {import('../Block.js').Block} block */
|
|
40
40
|
constructor(block) {
|
|
41
41
|
this._block = block;
|
|
42
42
|
}
|
|
@@ -218,6 +218,7 @@ export class ModalManager {
|
|
|
218
218
|
*/ (data),
|
|
219
219
|
);
|
|
220
220
|
} catch (error) {
|
|
221
|
+
this._block.telemetryManager.sendEventError(error, 'modal subscriber');
|
|
221
222
|
this._debugPrint('Error in modal subscriber:', error);
|
|
222
223
|
}
|
|
223
224
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class SecureUploadsManager {
|
|
2
|
+
/** @param {import('../UploaderBlock.js').UploaderBlock} block */
|
|
3
|
+
constructor(block: import("../UploaderBlock.js").UploaderBlock);
|
|
4
|
+
/**
|
|
5
|
+
* @private
|
|
6
|
+
* @type {import('../UploaderBlock.js').UploaderBlock}
|
|
7
|
+
*/
|
|
8
|
+
private _block;
|
|
9
|
+
/**
|
|
10
|
+
* @private
|
|
11
|
+
* @type {import('../../types/index.js').SecureUploadsSignatureAndExpire | null}
|
|
12
|
+
*/
|
|
13
|
+
private _secureToken;
|
|
14
|
+
/**
|
|
15
|
+
* @private
|
|
16
|
+
* @param {unknown[]} args
|
|
17
|
+
*/
|
|
18
|
+
private _debugPrint;
|
|
19
|
+
/** @returns {Promise<import('../../types/index.js').SecureUploadsSignatureAndExpire | null>} */
|
|
20
|
+
getSecureToken(): Promise<import("../../types/index.js").SecureUploadsSignatureAndExpire | null>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=SecureUploadsManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecureUploadsManager.d.ts","sourceRoot":"","sources":["SecureUploadsManager.js"],"names":[],"mappings":"AAIA;IAYE,
|
|
1
|
+
{"version":3,"file":"SecureUploadsManager.d.ts","sourceRoot":"","sources":["SecureUploadsManager.js"],"names":[],"mappings":"AAIA;IAYE,iEAAiE;IACjE,mBADY,OAAO,qBAAqB,EAAE,aAAa,EAGtD;IAdD;;;OAGG;IACH,eAAO;IACP;;;OAGG;IACH,qBAAoB;IAOpB;;;OAGG;IACH,oBAEC;IAED,gGAAgG;IAChG,kBADc,OAAO,CAAC,OAAO,sBAAsB,EAAE,+BAA+B,GAAG,IAAI,CAAC,CA4D3F;CACF"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import { isSecureTokenExpired } from '
|
|
3
|
+
import { isSecureTokenExpired } from '../../utils/isSecureTokenExpired.js';
|
|
4
4
|
|
|
5
5
|
export class SecureUploadsManager {
|
|
6
6
|
/**
|
|
7
7
|
* @private
|
|
8
|
-
* @type {import('
|
|
8
|
+
* @type {import('../UploaderBlock.js').UploaderBlock}
|
|
9
9
|
*/
|
|
10
10
|
_block;
|
|
11
11
|
/**
|
|
12
12
|
* @private
|
|
13
|
-
* @type {import('
|
|
13
|
+
* @type {import('../../types/index.js').SecureUploadsSignatureAndExpire | null}
|
|
14
14
|
*/
|
|
15
15
|
_secureToken = null;
|
|
16
16
|
|
|
17
|
-
/** @param {import('
|
|
17
|
+
/** @param {import('../UploaderBlock.js').UploaderBlock} block */
|
|
18
18
|
constructor(block) {
|
|
19
19
|
this._block = block;
|
|
20
20
|
}
|
|
@@ -27,7 +27,7 @@ export class SecureUploadsManager {
|
|
|
27
27
|
this._block.debugPrint('[secure-uploads]', ...args);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
/** @returns {Promise<import('
|
|
30
|
+
/** @returns {Promise<import('../../types/index.js').SecureUploadsSignatureAndExpire | null>} */
|
|
31
31
|
async getSecureToken() {
|
|
32
32
|
const { secureSignature, secureExpire, secureUploadsSignatureResolver } = this._block.cfg;
|
|
33
33
|
|
|
@@ -64,6 +64,10 @@ export class SecureUploadsManager {
|
|
|
64
64
|
}
|
|
65
65
|
} catch (err) {
|
|
66
66
|
console.error('Secure signature resolving failed. Falling back to the previous one.', err);
|
|
67
|
+
this._block.telemetryManager.sendEventError(
|
|
68
|
+
err,
|
|
69
|
+
'secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.',
|
|
70
|
+
);
|
|
67
71
|
}
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/** @typedef {import('@uploadcare/quality-insights').TelemetryRequest & { eventTimestamp: number }} TelemetryState */
|
|
2
|
+
export class TelemetryManager {
|
|
3
|
+
/** @param {import('../Block.js').Block} block */
|
|
4
|
+
constructor(block: import("../Block.js").Block);
|
|
5
|
+
/** @type {ReturnType<Crypto['randomUUID']>} */
|
|
6
|
+
_sessionId: ReturnType<Crypto["randomUUID"]>;
|
|
7
|
+
/** @type {TelemetryAPIService | null} */
|
|
8
|
+
_telemetryInstance: TelemetryAPIService | null;
|
|
9
|
+
/** @type {import('../Block.js').Block | null} */
|
|
10
|
+
_block: import("../Block.js").Block | null;
|
|
11
|
+
_config: import("../../types").ConfigType;
|
|
12
|
+
/** @type {boolean} */
|
|
13
|
+
_initialized: boolean;
|
|
14
|
+
/** @type {TelemetryState | null} */
|
|
15
|
+
_lastPayload: TelemetryState | null;
|
|
16
|
+
/** @type {import('@uploadcare/upload-client').Queue | null} */
|
|
17
|
+
_queue: import("@uploadcare/upload-client").Queue | null;
|
|
18
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
19
|
+
_init(type: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload | undefined): void;
|
|
20
|
+
/**
|
|
21
|
+
* @template {keyof import('../../types').ConfigType} T
|
|
22
|
+
* @param {T} key
|
|
23
|
+
* @param {import('../../types').ConfigType[T]} value
|
|
24
|
+
*/
|
|
25
|
+
_setConfig<T extends keyof import("../../types").ConfigType>(key: T, value: import("../../types").ConfigType[T]): void;
|
|
26
|
+
/**
|
|
27
|
+
* @param {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} body
|
|
28
|
+
* @returns {TelemetryState}
|
|
29
|
+
*/
|
|
30
|
+
_formattingPayload(body: Pick<TelemetryState, "eventType" | "payload" | "config">): TelemetryState;
|
|
31
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
32
|
+
_excludedEvents(type: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload | undefined): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* @param {Partial<Pick<TelemetryState, 'eventType' | 'payload'>> & {
|
|
35
|
+
* modalId?: string;
|
|
36
|
+
* eventType?: keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload;
|
|
37
|
+
* }} body
|
|
38
|
+
*/
|
|
39
|
+
sendEvent(body: Partial<Pick<TelemetryState, "eventType" | "payload">> & {
|
|
40
|
+
modalId?: string;
|
|
41
|
+
eventType?: keyof import("../../blocks/UploadCtxProvider/EventEmitter.js").EventPayload;
|
|
42
|
+
}): null | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* @param {Error | unknown} error
|
|
45
|
+
* @param {string} context
|
|
46
|
+
*/
|
|
47
|
+
sendEventError(error: Error | unknown, context?: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* Method to send telemetry event for Cloud Image Editor.
|
|
50
|
+
*
|
|
51
|
+
* @param {MouseEvent} e
|
|
52
|
+
* @param {string} tabId
|
|
53
|
+
* @param {Record<string, unknown>} options
|
|
54
|
+
*/
|
|
55
|
+
sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
|
|
56
|
+
/**
|
|
57
|
+
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
58
|
+
*
|
|
59
|
+
* @param {any} last
|
|
60
|
+
* @param {any} current
|
|
61
|
+
*/
|
|
62
|
+
_checkObj(last: any, current: any): boolean;
|
|
63
|
+
get _timestamp(): number;
|
|
64
|
+
get _solution(): any;
|
|
65
|
+
get _activity(): any;
|
|
66
|
+
}
|
|
67
|
+
export type TelemetryState = import("@uploadcare/quality-insights").TelemetryRequest & {
|
|
68
|
+
eventTimestamp: number;
|
|
69
|
+
};
|
|
70
|
+
import { TelemetryAPIService } from '@uploadcare/quality-insights';
|
|
71
|
+
//# sourceMappingURL=TelemetryManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TelemetryManager.d.ts","sourceRoot":"","sources":["TelemetryManager.js"],"names":[],"mappings":"AAQA,qHAAqH;AAErH;IAqBE,iDAAiD;IACjD,mBADY,OAAO,aAAa,EAAE,KAAK,EAiBtC;IArCD,+CAA+C;IAC/C,YADW,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CACV;IAEjC,yCAAyC;IACzC,oBADW,mBAAmB,GAAG,IAAI,CACX;IAE1B,iDAAiD;IACjD,QADW,OAAO,aAAa,EAAE,KAAK,GAAG,IAAI,CAC/B;IAEd,0CAAyC;IAEzC,sBAAsB;IACtB,cADW,OAAO,CACG;IAErB,oCAAoC;IACpC,cADW,cAAc,GAAG,IAAI,CACZ;IAEpB,+DAA+D;IAC/D,QADW,OAAO,2BAA2B,EAAE,KAAK,GAAG,IAAI,CAC7C;IAqBd,4GAA4G;IAC5G,YADY,MAAM,OAAO,gDAAgD,EAAE,YAAY,GAAG,SAAS,QAKlG;IAED;;;;OAIG;IACH,WAJsD,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,OAC1C,CAAC,SACD,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,QAQ7C;IAED;;;OAGG;IACH,yBAHW,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC,GACtD,cAAc,CA4B1B;IAED,4GAA4G;IAC5G,sBADY,MAAM,OAAO,gDAAgD,EAAE,YAAY,GAAG,SAAS,WAqBlG;IAED;;;;;OAKG;IACH,gBALW,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC,GAAG;QAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,OAAO,gDAAgD,EAAE,YAAY,CAAC;KACzF,oBAmBH;IAED;;;OAGG;IACH,sBAHW,KAAK,GAAG,OAAO,YACf,MAAM,QAYhB;IAED;;;;;;OAMG;IACH,6BAJW,UAAU,SACV,MAAM,YACN,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAajC;IAED;;;;;OAKG;IACH,gBAHW,GAAG,WACH,GAAG,WAcb;IAED,yBAEC;IAED,qBAEC;IAED,qBAEC;CACF;6BAjNa,OAAO,8BAA8B,EAAE,gBAAgB,GAAG;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE;oCAP9D,8BAA8B"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { TelemetryAPIService } from '@uploadcare/quality-insights';
|
|
3
|
+
|
|
4
|
+
import { Queue } from '@uploadcare/upload-client';
|
|
5
|
+
import { PACKAGE_VERSION, PACKAGE_NAME } from '../../env.js';
|
|
6
|
+
import { initialConfig } from '../../blocks/Config/initialConfig.js';
|
|
7
|
+
import { EventType } from '../../blocks/UploadCtxProvider/EventEmitter.js';
|
|
8
|
+
|
|
9
|
+
/** @typedef {import('@uploadcare/quality-insights').TelemetryRequest & { eventTimestamp: number }} TelemetryState */
|
|
10
|
+
|
|
11
|
+
export class TelemetryManager {
|
|
12
|
+
/** @type {ReturnType<Crypto['randomUUID']>} */
|
|
13
|
+
_sessionId = crypto.randomUUID();
|
|
14
|
+
|
|
15
|
+
/** @type {TelemetryAPIService | null} */
|
|
16
|
+
_telemetryInstance = null;
|
|
17
|
+
|
|
18
|
+
/** @type {import('../Block.js').Block | null} */
|
|
19
|
+
_block = null;
|
|
20
|
+
|
|
21
|
+
_config = structuredClone(initialConfig);
|
|
22
|
+
|
|
23
|
+
/** @type {boolean} */
|
|
24
|
+
_initialized = false;
|
|
25
|
+
|
|
26
|
+
/** @type {TelemetryState | null} */
|
|
27
|
+
_lastPayload = null;
|
|
28
|
+
|
|
29
|
+
/** @type {import('@uploadcare/upload-client').Queue | null} */
|
|
30
|
+
_queue = null;
|
|
31
|
+
|
|
32
|
+
/** @param {import('../Block.js').Block} block */
|
|
33
|
+
constructor(block) {
|
|
34
|
+
this._block = block;
|
|
35
|
+
|
|
36
|
+
this._telemetryInstance = new TelemetryAPIService();
|
|
37
|
+
|
|
38
|
+
this._queue = new Queue(10);
|
|
39
|
+
|
|
40
|
+
for (const key of /** @type {(keyof import('../../types/exported').ConfigType)[]} */ (Object.keys(this._config))) {
|
|
41
|
+
this._block.subConfigValue(key, (value) => {
|
|
42
|
+
if (this._initialized && this._config[key] !== value) {
|
|
43
|
+
this._block?.emit(EventType.CHANGE_CONFIG, undefined);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
this._setConfig(key, value);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
52
|
+
_init(type) {
|
|
53
|
+
if (type === EventType.INIT_SOLUTION && !this._initialized) {
|
|
54
|
+
this._initialized = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @template {keyof import('../../types').ConfigType} T
|
|
60
|
+
* @param {T} key
|
|
61
|
+
* @param {import('../../types').ConfigType[T]} value
|
|
62
|
+
*/
|
|
63
|
+
_setConfig(key, value) {
|
|
64
|
+
if (this._config[key] === value) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this._config[key] = value;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @param {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} body
|
|
73
|
+
* @returns {TelemetryState}
|
|
74
|
+
*/
|
|
75
|
+
_formattingPayload(body) {
|
|
76
|
+
const payload = body.payload ? { ...body.payload } : {};
|
|
77
|
+
if (payload.activity) payload.activity = undefined;
|
|
78
|
+
|
|
79
|
+
const result = { ...body };
|
|
80
|
+
if (body.eventType === EventType.INIT_SOLUTION || body.eventType === EventType.CHANGE_CONFIG) {
|
|
81
|
+
result.config = this._config;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
...result,
|
|
86
|
+
|
|
87
|
+
appVersion: PACKAGE_VERSION,
|
|
88
|
+
appName: PACKAGE_NAME,
|
|
89
|
+
sessionId: this._sessionId,
|
|
90
|
+
component: this._solution,
|
|
91
|
+
activity: this._activity,
|
|
92
|
+
projectPubkey: this._config?.pubkey,
|
|
93
|
+
userAgent: navigator.userAgent,
|
|
94
|
+
eventType: result.eventType ?? '',
|
|
95
|
+
eventTimestamp: this._timestamp,
|
|
96
|
+
|
|
97
|
+
payload: {
|
|
98
|
+
...payload,
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
104
|
+
_excludedEvents(type) {
|
|
105
|
+
if (
|
|
106
|
+
type &&
|
|
107
|
+
[
|
|
108
|
+
EventType.CHANGE,
|
|
109
|
+
EventType.COMMON_UPLOAD_PROGRESS,
|
|
110
|
+
EventType.FILE_ADDED,
|
|
111
|
+
EventType.FILE_REMOVED,
|
|
112
|
+
EventType.FILE_UPLOAD_START,
|
|
113
|
+
EventType.FILE_UPLOAD_PROGRESS,
|
|
114
|
+
EventType.FILE_UPLOAD_SUCCESS,
|
|
115
|
+
EventType.FILE_UPLOAD_FAILED,
|
|
116
|
+
EventType.FILE_URL_CHANGED,
|
|
117
|
+
EventType.GROUP_CREATED,
|
|
118
|
+
].includes(type)
|
|
119
|
+
) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {Partial<Pick<TelemetryState, 'eventType' | 'payload'>> & {
|
|
128
|
+
* modalId?: string;
|
|
129
|
+
* eventType?: keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload;
|
|
130
|
+
* }} body
|
|
131
|
+
*/
|
|
132
|
+
sendEvent(body) {
|
|
133
|
+
const payload = this._formattingPayload(
|
|
134
|
+
/** @type {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} */ (body),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
this._init(body.eventType);
|
|
138
|
+
|
|
139
|
+
const hasExcludedEvents = this._excludedEvents(body.eventType);
|
|
140
|
+
if (hasExcludedEvents) return null;
|
|
141
|
+
|
|
142
|
+
const hasDataSame = this._lastPayload && this._checkObj(this._lastPayload, payload);
|
|
143
|
+
if (hasDataSame) return null;
|
|
144
|
+
|
|
145
|
+
this._queue?.add(async () => {
|
|
146
|
+
this._lastPayload = payload;
|
|
147
|
+
await this._telemetryInstance?.sendEvent(/** @type {TelemetryState} */ (payload));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {Error | unknown} error
|
|
153
|
+
* @param {string} context
|
|
154
|
+
*/
|
|
155
|
+
sendEventError(error, context = 'unknown') {
|
|
156
|
+
this.sendEvent({
|
|
157
|
+
payload: {
|
|
158
|
+
metadata: {
|
|
159
|
+
event: 'error',
|
|
160
|
+
text: `Error in ${context}`,
|
|
161
|
+
error: /** @type {Error} */ (error).message,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Method to send telemetry event for Cloud Image Editor.
|
|
169
|
+
*
|
|
170
|
+
* @param {MouseEvent} e
|
|
171
|
+
* @param {string} tabId
|
|
172
|
+
* @param {Record<string, unknown>} options
|
|
173
|
+
*/
|
|
174
|
+
sendEventCloudImageEditor(e, tabId, options = {}) {
|
|
175
|
+
this.sendEvent({
|
|
176
|
+
payload: {
|
|
177
|
+
metadata: {
|
|
178
|
+
tabId,
|
|
179
|
+
node: /** @type {HTMLElement} */ (e.currentTarget)?.tagName,
|
|
180
|
+
event: e.type,
|
|
181
|
+
...options,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
189
|
+
*
|
|
190
|
+
* @param {any} last
|
|
191
|
+
* @param {any} current
|
|
192
|
+
*/
|
|
193
|
+
_checkObj(last, current) {
|
|
194
|
+
if (JSON.stringify(last) === JSON.stringify(current)) return true;
|
|
195
|
+
if (typeof last !== 'object' || typeof current !== 'object' || last == null || current == null) return false;
|
|
196
|
+
const lastKeys = Object.keys(last);
|
|
197
|
+
const currentKeys = Object.keys(current);
|
|
198
|
+
if (lastKeys.length !== currentKeys.length) return false;
|
|
199
|
+
for (const key of lastKeys) {
|
|
200
|
+
if (!Object.prototype.hasOwnProperty.call(current, key)) return false;
|
|
201
|
+
if (!this._checkObj(last[key], current[key])) return false;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
get _timestamp() {
|
|
208
|
+
return Date.now();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
get _solution() {
|
|
212
|
+
return this._block?.has('*solution') ? this._block?.$['*solution'].toLowerCase() : null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
get _activity() {
|
|
216
|
+
return this._block?.has('*currentActivity') ? this._block?.$['*currentActivity'] : null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export class ValidationManager {
|
|
2
|
-
/** @param {import('
|
|
3
|
-
constructor(blockInstance: import("
|
|
2
|
+
/** @param {import('../UploaderBlock.js').UploaderBlock} blockInstance */
|
|
3
|
+
constructor(blockInstance: import("../UploaderBlock.js").UploaderBlock);
|
|
4
4
|
/**
|
|
5
5
|
* @private
|
|
6
|
-
* @type {import('
|
|
6
|
+
* @type {import('../UploaderBlock.js').UploaderBlock}
|
|
7
7
|
*/
|
|
8
8
|
private _blockInstance;
|
|
9
9
|
/** @type {FuncFileValidator[]} */
|
|
10
10
|
_fileValidators: FuncFileValidator[];
|
|
11
11
|
/** @type {FuncCollectionValidator[]} */
|
|
12
12
|
_collectionValidators: FuncCollectionValidator[];
|
|
13
|
-
_uploadCollection: import("
|
|
13
|
+
_uploadCollection: import("../TypedCollection.js").TypedCollection<Readonly<{
|
|
14
14
|
file: Readonly<{
|
|
15
15
|
type: {
|
|
16
16
|
new (fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File;
|
|
@@ -135,7 +135,7 @@ export class ValidationManager {
|
|
|
135
135
|
runCollectionValidators(): void;
|
|
136
136
|
/**
|
|
137
137
|
* @private
|
|
138
|
-
* @param {import('
|
|
138
|
+
* @param {import('../TypedData.js').TypedData<typeof import('../uploadEntrySchema.js').uploadEntrySchema>} entry
|
|
139
139
|
*/
|
|
140
140
|
private _runFileValidatorsForEntry;
|
|
141
141
|
/**
|
|
@@ -145,6 +145,6 @@ export class ValidationManager {
|
|
|
145
145
|
*/
|
|
146
146
|
_addCustomTypeToValidators<T>(validators: T[]): T[];
|
|
147
147
|
}
|
|
148
|
-
export type FuncFileValidator = (outputEntry: import("
|
|
149
|
-
export type FuncCollectionValidator = (collection: ReturnType<typeof import("
|
|
148
|
+
export type FuncFileValidator = (outputEntry: import("../../types/index.js").OutputFileEntry, api: import("../UploaderPublicApi.js").UploaderPublicApi) => undefined | import("../../types/index.js").OutputErrorFile;
|
|
149
|
+
export type FuncCollectionValidator = (collection: ReturnType<typeof import("../buildOutputCollectionState.js").buildOutputCollectionState<import("../../types/index.js").OutputCollectionStatus>>, api: import("../UploaderPublicApi.js").UploaderPublicApi) => undefined | import("../../types/index.js").OutputErrorCollection;
|
|
150
150
|
//# sourceMappingURL=ValidationManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValidationManager.d.ts","sourceRoot":"","sources":["ValidationManager.js"],"names":[],"mappings":"AAkCA;IAaE,yEAAyE;IACzE,2BADY,OAAO,qBAAqB,EAAE,aAAa,EAiBtD;IA7BD;;;OAGG;IACH,uBAAe;IAEf,kCAAkC;IAClC,iBADW,iBAAiB,EAAE,CACmE;IAEjG,wCAAwC;IACxC,uBADW,uBAAuB,EAAE,CACsC;IAMxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAA6D;IAe/D,mCAAmC;IACnC,6BADY,MAAM,EAAE,QASnB;IAED,gCAsCC;IAED;;;OAGG;IACH,mCA0BC;IAED;;;;OAIG;IACH,2BAJa,CAAC,cACH,CAAC,EAAE,GACD,CAAC,EAAE,CAUf;CACF;gCAxJY,CACR,WAAW,EAAE,OAAO,sBAAsB,EAAE,eAAe,EAC3D,GAAG,EAAE,OAAO,yBAAyB,EAAE,iBAAiB,KACrD,SAAS,GAAG,OAAO,sBAAsB,EAAE,eAAe;sCAIrD,CACR,UAAU,EAAE,UAAU,CAC1B,cAAoB,kCAAkC,EAAE,0BAA0B,CAClF,OAAe,sBAAsB,EAAE,sBAAsB,CACtD,CACF,EACD,GAAG,EAAE,OAAO,yBAAyB,EAAE,iBAAiB,KACrD,SAAS,GAAG,OAAO,sBAAsB,EAAE,qBAAqB"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { EventType } from '
|
|
2
|
+
import { EventType } from '../../blocks/UploadCtxProvider/EventEmitter.js';
|
|
3
3
|
import {
|
|
4
4
|
validateIsImage,
|
|
5
5
|
validateFileType,
|
|
6
6
|
validateMaxSizeLimit,
|
|
7
7
|
validateUploadError,
|
|
8
|
-
} from '
|
|
9
|
-
import { validateMultiple, validateCollectionUploadError } from '
|
|
8
|
+
} from '../../utils/validators/file/index.js';
|
|
9
|
+
import { validateMultiple, validateCollectionUploadError } from '../../utils/validators/collection/index.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {(
|
|
13
|
-
* outputEntry: import('
|
|
14
|
-
* api: import('
|
|
15
|
-
* ) => undefined | import('
|
|
13
|
+
* outputEntry: import('../../types/index.js').OutputFileEntry,
|
|
14
|
+
* api: import('../UploaderPublicApi.js').UploaderPublicApi,
|
|
15
|
+
* ) => undefined | import('../../types/index.js').OutputErrorFile} FuncFileValidator
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @typedef {(
|
|
20
20
|
* collection: ReturnType<
|
|
21
|
-
* typeof import('
|
|
22
|
-
* import('
|
|
21
|
+
* typeof import('../buildOutputCollectionState.js').buildOutputCollectionState<
|
|
22
|
+
* import('../../types/index.js').OutputCollectionStatus
|
|
23
23
|
* >
|
|
24
24
|
* >,
|
|
25
|
-
* api: import('
|
|
26
|
-
* ) => undefined | import('
|
|
25
|
+
* api: import('../UploaderPublicApi.js').UploaderPublicApi,
|
|
26
|
+
* ) => undefined | import('../../types/index.js').OutputErrorCollection} FuncCollectionValidator
|
|
27
27
|
*/
|
|
28
28
|
|
|
29
29
|
const LOGGER = {
|
|
@@ -35,7 +35,7 @@ const LOGGER = {
|
|
|
35
35
|
export class ValidationManager {
|
|
36
36
|
/**
|
|
37
37
|
* @private
|
|
38
|
-
* @type {import('
|
|
38
|
+
* @type {import('../UploaderBlock.js').UploaderBlock}
|
|
39
39
|
*/
|
|
40
40
|
_blockInstance;
|
|
41
41
|
|
|
@@ -45,7 +45,7 @@ export class ValidationManager {
|
|
|
45
45
|
/** @type {FuncCollectionValidator[]} */
|
|
46
46
|
_collectionValidators = [validateMultiple, validateCollectionUploadError];
|
|
47
47
|
|
|
48
|
-
/** @param {import('
|
|
48
|
+
/** @param {import('../UploaderBlock.js').UploaderBlock} blockInstance */
|
|
49
49
|
constructor(blockInstance) {
|
|
50
50
|
this._blockInstance = blockInstance;
|
|
51
51
|
|
|
@@ -97,6 +97,7 @@ export class ValidationManager {
|
|
|
97
97
|
}
|
|
98
98
|
} catch (error) {
|
|
99
99
|
console.warn(LOGGER.collection, error);
|
|
100
|
+
this._blockInstance.telemetryManager.sendEventError(error, `collection validator. ${LOGGER.collection}`);
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
|
|
@@ -106,7 +107,7 @@ export class ValidationManager {
|
|
|
106
107
|
this._blockInstance.emit(
|
|
107
108
|
EventType.COMMON_UPLOAD_FAILED,
|
|
108
109
|
() =>
|
|
109
|
-
/** @type {import('
|
|
110
|
+
/** @type {import('../../types/index.js').OutputCollectionState<'failed'>} */ (
|
|
110
111
|
this._blockInstance.api.getOutputCollectionState()
|
|
111
112
|
),
|
|
112
113
|
{ debounce: true },
|
|
@@ -116,7 +117,7 @@ export class ValidationManager {
|
|
|
116
117
|
|
|
117
118
|
/**
|
|
118
119
|
* @private
|
|
119
|
-
* @param {import('
|
|
120
|
+
* @param {import('../TypedData.js').TypedData<typeof import('../uploadEntrySchema.js').uploadEntrySchema>} entry
|
|
120
121
|
*/
|
|
121
122
|
_runFileValidatorsForEntry(entry) {
|
|
122
123
|
const outputEntry = this._blockInstance.api.getOutputItem(entry.uid);
|
|
@@ -140,6 +141,7 @@ export class ValidationManager {
|
|
|
140
141
|
}
|
|
141
142
|
} catch (error) {
|
|
142
143
|
console.warn(LOGGER.file, error);
|
|
144
|
+
this._blockInstance.telemetryManager.sendEventError(error, `file validator. ${LOGGER.file}`);
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
entry.setValue('errors', errors);
|
|
@@ -9,8 +9,8 @@ export class A11y {
|
|
|
9
9
|
* @type {ScopedMinimalWindow}
|
|
10
10
|
*/
|
|
11
11
|
private _scopedWindow;
|
|
12
|
-
/** @param {import('
|
|
13
|
-
registerBlock(scope: import("
|
|
12
|
+
/** @param {import('../Block.js').Block} scope */
|
|
13
|
+
registerBlock(scope: import("../Block.js").Block): void;
|
|
14
14
|
destroy(): void;
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["a11y.js"],"names":[],"mappings":"AAqFA;IACE;;;OAGG;IACH,sBAAc;IAEd;;;OAGG;IACH,sBAAc;IAYd,iDAAiD;IACjD,qBADY,OAAO,aAAa,EAAE,KAAK,QAGtC;IAED,gBAGC;CACF;;;;4BA/GY,UAAU,CAAC,OAAO,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -64,11 +64,11 @@ export class CameraSource extends UploaderBlock {
|
|
|
64
64
|
'*commonProgress': number;
|
|
65
65
|
'*uploadList': never[];
|
|
66
66
|
'*uploadQueue': import("@uploadcare/upload-client").Queue;
|
|
67
|
-
'*collectionErrors':
|
|
67
|
+
'*collectionErrors': import("../../index.js").OutputErrorCollection[];
|
|
68
68
|
'*collectionState': import("../../index.js").OutputCollectionState | null;
|
|
69
69
|
'*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
|
|
70
70
|
'*uploadTrigger': Set<string>;
|
|
71
|
-
'*secureUploadsManager': import("../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
|
|
71
|
+
'*secureUploadsManager': import("../../abstract/managers/SecureUploadsManager.js").SecureUploadsManager | null;
|
|
72
72
|
'*currentActivity': null;
|
|
73
73
|
'*currentActivityParams': {};
|
|
74
74
|
'*history': never[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CameraSource.d.ts","sourceRoot":"","sources":["CameraSource.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CameraSource.d.ts","sourceRoot":"","sources":["CameraSource.js"],"names":[],"mappings":"AAyCA,8CAA8C;AAE9C,kGAAkG;AAElG;IAEE,uBAA+C;IAE/C,eAAe;IACf,0BAAyB;IAEzB,yBAAyB;IACzB,SADW,QAAQ,EAAE,CACR;IAEb,mCAAmC;IACnC,gBADW,aAAa,GAAG,IAAI,CACT;IAEtB,iCAAiC;IACjC,SADW,WAAW,GAAG,IAAI,CACd;IAEf,4BAA4B;IAC5B,kBADW,MAAM,GAAG,IAAI,CACA;IAExB,4BAA4B;IAC5B,mBADW,MAAM,GAAG,IAAI,CACC;IAKvB;;;;;;;;;;;;;;;;;;;;;;;;QAiCE,qBAAqB;;QAErB,qBAAqB;;;;QAMrB,uBAAuB;kCAAX,KAAK;QAMjB,uBAAuB;iCAAX,KAAK;;;;QAcjB,iDAAiD;;;;;;;;QAejD,4BAA4B;wBAAhB,UAAU;;;;;;;;;;;;;;MAKvB;IAGH,oCAaE;IAEF,yBAkBE;IADA,sCAAiE;IAGnE,wBAKE;IAEF,uBAEE;IAEF,2BAOE;IAEF,0BAEE;IAEF,4BAkCE;IA/BE;;;;;kBAEC;IA+BL,eAAe;IACf,uBAWE;IAEF,2DAA2D;IAC3D,6BAQE;IAEF,+BAOE;IAEF;;;;OAIG;IACH,sBA8BE;IAEF,oBAUE;IAEF,oBAoBE;IAEF,mCAAmC;IACnC,eAAgB,QADJ,YACU,UAoBpB;IAEF,mCAAmC;IACnC,eAAgB,QADJ,YACU,UAuCpB;IAEF;;;OAGG;IACH,wBAmBE;IAEF,eAAe;IACf,cAoBC;IAjBC,uCAA+C;IAC/C,kDAAyC;IAkB3C;;;OAGG;IACH,yBAwBE;IADA,mCAAuB;IAGzB;;;;;OAKG;IACH,cAAe,MALJ,QAAQ,GAAG,OAKH,EAAE,KAJV,MAAM,GAAG,MAII,EAAE,cAAM,EAAE,MAFvB,IAE2B,UAUpC;IAEF,uCAAuC;IACvC,4BADY,SAAS,SAAS,OAmC7B;IAED;;;;OAIG;IACH,UAAW,MAFA,IAEI,UAMb;IAEF,eAAe;IACf,2BAEC;IAED;;;OAGG;IACH,6BA+CQ;IAER,6CAQE;IAEF,yBAWE;IAFE,gCAAuB;IAI3B,8BA0CE;IAEF,qCAEE;IAEF,uCAaE;IAEF,2BAA0B;IAE1B,0CAUE;IAEF,iCAuCE;IAnCE;;;oBAKK;IAEL;;;oBAOO;IAuBX,iCAME;IAEF,mCAYE;IAEF,wCAAwC;IACxC,qBAAsB,aADV,UAAU,EACW,UAQ/B;IAyBF,iBAMC;IAED,iCAIC;CACF;;;;yBAxxBa,OAAO,GAAG,OAAO;2BAEjB,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ;8BAzCnD,iCAAiC"}
|
|
@@ -9,9 +9,15 @@ import { UploadSource } from '../utils/UploadSource.js';
|
|
|
9
9
|
import { CameraSourceEvents, CameraSourceTypes } from './constants.js';
|
|
10
10
|
|
|
11
11
|
const DEFAULT_VIDEO_CONFIG = {
|
|
12
|
-
width: {
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
width: {
|
|
13
|
+
ideal: 1920,
|
|
14
|
+
},
|
|
15
|
+
height: {
|
|
16
|
+
ideal: 1080,
|
|
17
|
+
},
|
|
18
|
+
frameRate: {
|
|
19
|
+
ideal: 30,
|
|
20
|
+
},
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
const DEFAULT_PERMISSIONS = ['camera', 'microphone'];
|
|
@@ -237,6 +243,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
237
243
|
}
|
|
238
244
|
} catch (error) {
|
|
239
245
|
console.error('Failed to start recording', error);
|
|
246
|
+
this.telemetryManager.sendEventError(error, 'camera recording. Failed to start recording');
|
|
240
247
|
}
|
|
241
248
|
};
|
|
242
249
|
|
|
@@ -307,6 +314,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
307
314
|
});
|
|
308
315
|
} catch (error) {
|
|
309
316
|
console.error('Failed to preview video', error);
|
|
317
|
+
this.telemetryManager.sendEventError(error, 'camera previewing. Failed to preview video');
|
|
310
318
|
}
|
|
311
319
|
};
|
|
312
320
|
|
|
@@ -676,6 +684,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
676
684
|
} catch (error) {
|
|
677
685
|
this._setPermissionsState('denied');
|
|
678
686
|
console.log('Failed to capture camera', error);
|
|
687
|
+
this.telemetryManager.sendEventError(error, 'camera capturing. Failed to capture camera');
|
|
679
688
|
}
|
|
680
689
|
};
|
|
681
690
|
|
|
@@ -693,6 +702,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
693
702
|
}
|
|
694
703
|
} catch (error) {
|
|
695
704
|
console.log('Failed to use permissions API. Fallback to manual request mode.', error);
|
|
705
|
+
this.telemetryManager.sendEventError(error, 'camera permissions. Failed to use permissions API');
|
|
696
706
|
this._capture();
|
|
697
707
|
}
|
|
698
708
|
};
|
|
@@ -706,6 +716,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
706
716
|
|
|
707
717
|
navigator.mediaDevices.addEventListener('devicechange', this._getDevices);
|
|
708
718
|
} catch (error) {
|
|
719
|
+
this.telemetryManager.sendEventError(error, 'camera devices. Failed to get user media');
|
|
709
720
|
console.log('Failed to get user media', error);
|
|
710
721
|
}
|
|
711
722
|
};
|
|
@@ -746,6 +757,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
746
757
|
}
|
|
747
758
|
this._selectedAudioId = this._audioDevices[0]?.value;
|
|
748
759
|
} catch (error) {
|
|
760
|
+
this.telemetryManager.sendEventError(error, 'camera devices. Failed to get devices');
|
|
749
761
|
console.log('Failed to get devices', error);
|
|
750
762
|
}
|
|
751
763
|
};
|
|
@@ -9,7 +9,8 @@ export class CloudImageEditorBlock extends Block {
|
|
|
9
9
|
'*imageSize': null;
|
|
10
10
|
'*editorTransformations': import("./types.js").Transformations;
|
|
11
11
|
'*cropPresetList': import("./types.js").CropPresetList;
|
|
12
|
-
'*
|
|
12
|
+
'*currentAspectRatio': null;
|
|
13
|
+
'*tabList': ("crop" | "tuning" | "filters")[];
|
|
13
14
|
'*tabId': "crop";
|
|
14
15
|
entry: null;
|
|
15
16
|
extension: null;
|