@uploadcare/file-uploader 1.18.0 → 1.19.0-alpha.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/abstract/Block.d.ts +11 -2
- package/abstract/Block.d.ts.map +1 -1
- package/abstract/Block.js +29 -3
- package/abstract/CTX.d.ts +2 -2
- package/abstract/CTX.d.ts.map +1 -1
- package/abstract/CTX.js +1 -1
- package/abstract/SolutionBlock.d.ts +1 -1
- package/abstract/UploaderBlock.d.ts +3 -3
- package/abstract/UploaderBlock.d.ts.map +1 -1
- package/abstract/UploaderBlock.js +2 -3
- package/abstract/UploaderPublicApi.d.ts.map +1 -1
- package/abstract/UploaderPublicApi.js +0 -3
- 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} +3 -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} +5 -5
- package/abstract/managers/TelemetryManager.d.ts +65 -0
- package/abstract/managers/TelemetryManager.d.ts.map +1 -0
- package/abstract/managers/TelemetryManager.js +201 -0
- package/abstract/{ValidationManager.d.ts → managers/ValidationManager.d.ts} +7 -7
- package/abstract/{ValidationManager.d.ts.map → managers/ValidationManager.d.ts.map} +1 -1
- package/abstract/{ValidationManager.js → managers/ValidationManager.js} +14 -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 +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +8 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorFilterControl.js +7 -1
- 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 +8 -4
- package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/EditorToolbar.js +24 -4
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +1 -0
- package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
- package/blocks/CloudImageEditor/src/toolbar-constants.js +2 -0
- 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/initialConfig.js +2 -2
- package/blocks/Config/normalizeConfigValue.js +2 -2
- package/blocks/DropArea/DropArea.d.ts +1 -1
- package/blocks/ExternalSource/ExternalSource.d.ts +1 -7
- package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
- package/blocks/ExternalSource/ExternalSource.js +2 -24
- package/blocks/ExternalSource/MessageBridge.d.ts.map +1 -1
- package/blocks/ExternalSource/MessageBridge.js +1 -3
- package/blocks/ExternalSource/types.d.ts +0 -4
- package/blocks/ExternalSource/types.d.ts.map +1 -1
- package/blocks/ExternalSource/types.js +0 -4
- package/blocks/FileItem/FileItem.d.ts +1 -1
- package/blocks/FileItem/FileItem.d.ts.map +1 -1
- package/blocks/FileItem/FileItem.js +16 -0
- 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 +1 -1
- package/blocks/SourceBtn/SourceBtn.d.ts +1 -1
- package/blocks/Thumb/Thumb.d.ts +1 -1
- 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/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
- package/blocks/UploadCtxProvider/UploadCtxProvider.js +0 -1
- package/blocks/UploadList/UploadList.d.ts +1 -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 -1
- package/index.js +1 -1
- package/index.ssr.d.ts +4 -2
- package/index.ssr.d.ts.map +1 -1
- package/index.ssr.js +7 -7
- package/locales/file-uploader/ar.d.ts +0 -1
- package/locales/file-uploader/ar.js +0 -1
- package/locales/file-uploader/az.d.ts +0 -1
- package/locales/file-uploader/az.js +0 -1
- package/locales/file-uploader/ca.d.ts +0 -1
- package/locales/file-uploader/ca.js +0 -1
- package/locales/file-uploader/cs.d.ts +0 -1
- package/locales/file-uploader/cs.js +0 -1
- package/locales/file-uploader/da.d.ts +0 -1
- package/locales/file-uploader/da.js +0 -1
- package/locales/file-uploader/de.d.ts +0 -1
- package/locales/file-uploader/de.js +0 -1
- package/locales/file-uploader/el.d.ts +0 -1
- package/locales/file-uploader/el.js +0 -1
- package/locales/file-uploader/en.d.ts +0 -1
- package/locales/file-uploader/en.js +0 -1
- package/locales/file-uploader/es.d.ts +0 -1
- package/locales/file-uploader/es.js +0 -1
- package/locales/file-uploader/et.d.ts +0 -1
- package/locales/file-uploader/et.js +0 -1
- package/locales/file-uploader/fi.d.ts +0 -1
- package/locales/file-uploader/fi.js +0 -1
- package/locales/file-uploader/fr.d.ts +0 -1
- package/locales/file-uploader/fr.js +0 -1
- package/locales/file-uploader/he.d.ts +0 -1
- package/locales/file-uploader/he.js +0 -1
- package/locales/file-uploader/hy.d.ts +0 -1
- package/locales/file-uploader/hy.js +0 -1
- package/locales/file-uploader/is.d.ts +0 -1
- package/locales/file-uploader/is.js +0 -1
- package/locales/file-uploader/it.d.ts +0 -1
- package/locales/file-uploader/it.js +0 -1
- package/locales/file-uploader/ja.d.ts +0 -1
- package/locales/file-uploader/ja.js +0 -1
- package/locales/file-uploader/ka.d.ts +0 -1
- package/locales/file-uploader/ka.js +0 -1
- package/locales/file-uploader/kk.d.ts +0 -1
- package/locales/file-uploader/kk.js +0 -1
- package/locales/file-uploader/ko.d.ts +0 -1
- package/locales/file-uploader/ko.js +0 -1
- package/locales/file-uploader/lv.d.ts +0 -1
- package/locales/file-uploader/lv.js +0 -1
- package/locales/file-uploader/nb.d.ts +0 -1
- package/locales/file-uploader/nb.js +0 -1
- package/locales/file-uploader/nl.d.ts +0 -1
- package/locales/file-uploader/nl.js +0 -1
- package/locales/file-uploader/pl.d.ts +0 -1
- package/locales/file-uploader/pl.js +0 -1
- package/locales/file-uploader/pt.d.ts +0 -1
- package/locales/file-uploader/pt.js +0 -1
- package/locales/file-uploader/ro.d.ts +0 -1
- package/locales/file-uploader/ro.js +0 -1
- package/locales/file-uploader/ru.d.ts +0 -1
- package/locales/file-uploader/ru.js +0 -1
- package/locales/file-uploader/sk.d.ts +0 -1
- package/locales/file-uploader/sk.js +0 -1
- package/locales/file-uploader/sr.d.ts +0 -1
- package/locales/file-uploader/sr.js +0 -1
- package/locales/file-uploader/sv.d.ts +0 -1
- package/locales/file-uploader/sv.js +0 -1
- package/locales/file-uploader/tr.d.ts +0 -1
- package/locales/file-uploader/tr.js +0 -1
- package/locales/file-uploader/uk.d.ts +0 -1
- package/locales/file-uploader/uk.js +0 -1
- package/locales/file-uploader/vi.d.ts +0 -1
- package/locales/file-uploader/vi.js +0 -1
- package/locales/file-uploader/zh-TW.d.ts +0 -1
- package/locales/file-uploader/zh-TW.js +0 -1
- package/locales/file-uploader/zh.d.ts +0 -1
- package/locales/file-uploader/zh.js +0 -1
- package/package.json +5 -2
- package/solutions/cloud-image-editor/CloudImageEditor.d.ts +34 -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 +2 -1
- 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 +10 -9
- package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
- package/solutions/file-uploader/minimal/FileUploaderMinimal.js +7 -3
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +2 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
- package/solutions/file-uploader/regular/FileUploaderRegular.js +4 -0
- package/types/events.d.ts +1 -1
- package/types/exported.d.ts +54 -61
- 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 +4 -4
- package/web/file-uploader.min.js +4 -4
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-img.min.js +1 -1
- package/abstract/SecureUploadsManager.d.ts +0 -22
- package/abstract/a11y.d.ts.map +0 -1
- package/utils/get-top-level-origin.d.ts +0 -2
- package/utils/get-top-level-origin.d.ts.map +0 -1
- package/utils/get-top-level-origin.js +0 -11
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { TelemetryAPIService } from '@uploadcare/quality-insights';
|
|
2
|
+
|
|
3
|
+
import { Queue } from '@uploadcare/upload-client';
|
|
4
|
+
import { PACKAGE_VERSION, PACKAGE_NAME } from '../../env.js';
|
|
5
|
+
import { initialConfig } from '../../blocks/Config/initialConfig.js';
|
|
6
|
+
import { EventType } from '../../blocks/UploadCtxProvider/EventEmitter.js';
|
|
7
|
+
|
|
8
|
+
/** @typedef {import('@uploadcare/quality-insights').TelemetryRequest & { eventTimestamp: number }} TelemetryState */
|
|
9
|
+
|
|
10
|
+
export class TelemetryManager {
|
|
11
|
+
/** @type {ReturnType<Crypto['randomUUID']>} */
|
|
12
|
+
_sessionId = crypto.randomUUID();
|
|
13
|
+
|
|
14
|
+
/** @type {TelemetryAPIService | null} */
|
|
15
|
+
_telemetryInstance = null;
|
|
16
|
+
|
|
17
|
+
/** @type {import('../Block.js').Block | null} */
|
|
18
|
+
_block = null;
|
|
19
|
+
|
|
20
|
+
_config = initialConfig;
|
|
21
|
+
|
|
22
|
+
/** @type {boolean} */
|
|
23
|
+
_initialized = false;
|
|
24
|
+
|
|
25
|
+
/** @type {TelemetryState | null} */
|
|
26
|
+
_lastPayload = null;
|
|
27
|
+
|
|
28
|
+
/** @type {import('@uploadcare/upload-client').Queue | null} */
|
|
29
|
+
_queue = null;
|
|
30
|
+
|
|
31
|
+
/** @param {import('../Block.js').Block} block */
|
|
32
|
+
constructor(block) {
|
|
33
|
+
this._block = block;
|
|
34
|
+
|
|
35
|
+
this._telemetryInstance = new TelemetryAPIService();
|
|
36
|
+
|
|
37
|
+
this._queue = new Queue(10);
|
|
38
|
+
|
|
39
|
+
for (const key of /** @type {(keyof import('../../types/exported').ConfigType)[]} */ (Object.keys(initialConfig))) {
|
|
40
|
+
block.subConfigValue(key, (value) => {
|
|
41
|
+
if (this._initialized && this._config[key] !== value) {
|
|
42
|
+
this._block?.emit(EventType.CHANGE_CONFIG, undefined);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
this._setConfig(key, value);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
51
|
+
_init(type) {
|
|
52
|
+
if (type === EventType.INIT_SOLUTION && !this._initialized) {
|
|
53
|
+
this._initialized = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @template {keyof import('../../types').ConfigType} T
|
|
59
|
+
* @param {T} key
|
|
60
|
+
* @param {import('../../types').ConfigType[T]} value
|
|
61
|
+
*/
|
|
62
|
+
_setConfig(key, value) {
|
|
63
|
+
if (this._config[key] === value) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
this._config[key] = value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} body
|
|
72
|
+
* @returns {TelemetryState}
|
|
73
|
+
*/
|
|
74
|
+
_formattingPayload(body) {
|
|
75
|
+
const payload = body.payload ? { ...body.payload } : {};
|
|
76
|
+
if (payload.activity) payload.activity = undefined;
|
|
77
|
+
|
|
78
|
+
const result = { ...body };
|
|
79
|
+
if (body.eventType === EventType.INIT_SOLUTION || body.eventType === EventType.CHANGE_CONFIG) {
|
|
80
|
+
result.config = this._config;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
...result,
|
|
85
|
+
|
|
86
|
+
appVersion: PACKAGE_VERSION,
|
|
87
|
+
appName: PACKAGE_NAME,
|
|
88
|
+
sessionId: this._sessionId,
|
|
89
|
+
component: this._solution,
|
|
90
|
+
activity: this._activity,
|
|
91
|
+
projectPubkey: this._config?.pubkey,
|
|
92
|
+
userAgent: navigator.userAgent,
|
|
93
|
+
eventType: result.eventType ?? null,
|
|
94
|
+
eventTimestamp: this._timestamp,
|
|
95
|
+
|
|
96
|
+
payload: {
|
|
97
|
+
...payload,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @param {keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload | undefined} type */
|
|
103
|
+
_excludedEvents(type) {
|
|
104
|
+
if (
|
|
105
|
+
type &&
|
|
106
|
+
[
|
|
107
|
+
EventType.CHANGE,
|
|
108
|
+
EventType.COMMON_UPLOAD_PROGRESS,
|
|
109
|
+
EventType.FILE_ADDED,
|
|
110
|
+
EventType.FILE_REMOVED,
|
|
111
|
+
EventType.FILE_UPLOAD_START,
|
|
112
|
+
EventType.FILE_UPLOAD_PROGRESS,
|
|
113
|
+
EventType.FILE_UPLOAD_SUCCESS,
|
|
114
|
+
EventType.FILE_UPLOAD_FAILED,
|
|
115
|
+
EventType.FILE_URL_CHANGED,
|
|
116
|
+
EventType.GROUP_CREATED,
|
|
117
|
+
].includes(type)
|
|
118
|
+
) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {Partial<Pick<TelemetryState, 'eventType' | 'payload'>> & {
|
|
127
|
+
* modalId?: string;
|
|
128
|
+
* eventType?: keyof import('../../blocks/UploadCtxProvider/EventEmitter.js').EventPayload;
|
|
129
|
+
* }} body
|
|
130
|
+
*/
|
|
131
|
+
sendEvent(body) {
|
|
132
|
+
const payload = this._formattingPayload(
|
|
133
|
+
/** @type {Pick<TelemetryState, 'eventType' | 'payload' | 'config'>} */ (body),
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
this._init(body.eventType);
|
|
137
|
+
|
|
138
|
+
const hasExcludedEvents = this._excludedEvents(body.eventType);
|
|
139
|
+
if (hasExcludedEvents) return null;
|
|
140
|
+
|
|
141
|
+
const hasDataSame = this._lastPayload && this._checkObj(this._lastPayload, payload);
|
|
142
|
+
if (hasDataSame) return null;
|
|
143
|
+
|
|
144
|
+
this._queue?.add(async () => {
|
|
145
|
+
this._lastPayload = payload;
|
|
146
|
+
await this._telemetryInstance?.sendEvent(/** @type {TelemetryState} */ (payload));
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Method to send telemetry event for Cloud Image Editor.
|
|
152
|
+
*
|
|
153
|
+
* @param {MouseEvent} e
|
|
154
|
+
* @param {string} tabId
|
|
155
|
+
* @param {Record<string, unknown>} options
|
|
156
|
+
*/
|
|
157
|
+
sendEventCloudImageEditor(e, tabId, options = {}) {
|
|
158
|
+
this.sendEvent({
|
|
159
|
+
payload: {
|
|
160
|
+
metadata: {
|
|
161
|
+
tabId,
|
|
162
|
+
node: /** @type {HTMLElement} */ (e.currentTarget)?.tagName,
|
|
163
|
+
event: e.type,
|
|
164
|
+
...options,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Deeply compares two objects and returns true if they are equal, false otherwise.
|
|
172
|
+
*
|
|
173
|
+
* @param {any} last
|
|
174
|
+
* @param {any} current
|
|
175
|
+
*/
|
|
176
|
+
_checkObj(last, current) {
|
|
177
|
+
if (JSON.stringify(last) === JSON.stringify(current)) return true;
|
|
178
|
+
if (typeof last !== 'object' || typeof current !== 'object' || last == null || current == null) return false;
|
|
179
|
+
const lastKeys = Object.keys(last);
|
|
180
|
+
const currentKeys = Object.keys(current);
|
|
181
|
+
if (lastKeys.length !== currentKeys.length) return false;
|
|
182
|
+
for (const key of lastKeys) {
|
|
183
|
+
if (!Object.prototype.hasOwnProperty.call(current, key)) return false;
|
|
184
|
+
if (!this._checkObj(last[key], current[key])) return false;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
get _timestamp() {
|
|
191
|
+
return Date.now();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
get _solution() {
|
|
195
|
+
return this._block?.has('*solution') ? this._block?.$['*solution'].toLowerCase() : null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
get _activity() {
|
|
199
|
+
return this._block?.has('*currentActivity') ? this._block?.$['*currentActivity'] : null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidationManager.d.ts","sourceRoot":"","sources":["ValidationManager.js"],"names":[],"mappings":"AAkCA;IAaE,
|
|
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,gCAqCC;IAED;;;OAGG;IACH,mCAyBC;IAED;;;;OAIG;IACH,2BAJa,CAAC,cACH,CAAC,EAAE,GACD,CAAC,EAAE,CAUf;CACF;gCAtJY,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
|
|
|
@@ -106,7 +106,7 @@ export class ValidationManager {
|
|
|
106
106
|
this._blockInstance.emit(
|
|
107
107
|
EventType.COMMON_UPLOAD_FAILED,
|
|
108
108
|
() =>
|
|
109
|
-
/** @type {import('
|
|
109
|
+
/** @type {import('../../types/index.js').OutputCollectionState<'failed'>} */ (
|
|
110
110
|
this._blockInstance.api.getOutputCollectionState()
|
|
111
111
|
),
|
|
112
112
|
{ debounce: true },
|
|
@@ -116,7 +116,7 @@ export class ValidationManager {
|
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* @private
|
|
119
|
-
* @param {import('
|
|
119
|
+
* @param {import('../TypedData.js').TypedData<typeof import('../uploadEntrySchema.js').uploadEntrySchema>} entry
|
|
120
120
|
*/
|
|
121
121
|
_runFileValidatorsForEntry(entry) {
|
|
122
122
|
const outputEntry = this._blockInstance.api.getOutputItem(entry.uid);
|
|
@@ -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"}
|
|
@@ -68,7 +68,7 @@ export class CameraSource extends UploaderBlock {
|
|
|
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":"EditorCropButtonControl.d.ts","sourceRoot":"","sources":["EditorCropButtonControl.js"],"names":[],"mappings":"AAkBA;IASM,eAAe;IACf,mBAA2B;
|
|
1
|
+
{"version":3,"file":"EditorCropButtonControl.d.ts","sourceRoot":"","sources":["EditorCropButtonControl.js"],"names":[],"mappings":"AAkBA;IASM,eAAe;IACf,mBAA2B;CAsBhC;oCAlDmC,0BAA0B"}
|
|
@@ -35,9 +35,16 @@ export class EditorCropButtonControl extends EditorButtonControl {
|
|
|
35
35
|
);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
this.$['on.click'] = () => {
|
|
38
|
+
this.$['on.click'] = (e) => {
|
|
39
39
|
let prev = this.$['*cropperEl'].getValue(this._operation);
|
|
40
40
|
let next = nextValue(this._operation, prev);
|
|
41
|
+
|
|
42
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
43
|
+
operation: this._operation,
|
|
44
|
+
next,
|
|
45
|
+
prev,
|
|
46
|
+
});
|
|
47
|
+
|
|
41
48
|
this.$['*cropperEl'].setValue(this._operation, next);
|
|
42
49
|
};
|
|
43
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorFilterControl.d.ts","sourceRoot":"","sources":["EditorFilterControl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorFilterControl.d.ts","sourceRoot":"","sources":["EditorFilterControl.js"],"names":[],"mappings":"AAQA;IAeE,sBA2BC;IAED;;;OAGG;IACH,2BAHW,yBAAyB,EAAE,YAC3B,oBAAoB,iBAuB9B;IAfG,yCAA4B;IAyC1B,+BAA0B;IAC1B,4BAAqB;IAYzB,4CAEE;IAGF,kBAA+B;CAgDlC;;;;oCAvKmC,0BAA0B"}
|
|
@@ -4,6 +4,7 @@ import { EditorButtonControl } from './EditorButtonControl.js';
|
|
|
4
4
|
import { FAKE_ORIGINAL_FILTER } from './EditorSlider.js';
|
|
5
5
|
import { COMMON_OPERATIONS, transformationsToOperations } from './lib/transformationUtils.js';
|
|
6
6
|
import { preloadImage } from '../../utils/preloadImage.js';
|
|
7
|
+
import { parseFilterValue } from './utils/parseFilterValue.js';
|
|
7
8
|
|
|
8
9
|
export class EditorFilterControl extends EditorButtonControl {
|
|
9
10
|
constructor() {
|
|
@@ -79,7 +80,8 @@ export class EditorFilterControl extends EditorButtonControl {
|
|
|
79
80
|
initCallback() {
|
|
80
81
|
super.initCallback();
|
|
81
82
|
|
|
82
|
-
|
|
83
|
+
/** @param {MouseEvent} e */
|
|
84
|
+
this.$['on.click'] = (e) => {
|
|
83
85
|
if (!this.$.active) {
|
|
84
86
|
this.$['*sliderEl'].setOperation(this._operation, this._filter);
|
|
85
87
|
this.$['*sliderEl'].apply();
|
|
@@ -88,6 +90,10 @@ export class EditorFilterControl extends EditorButtonControl {
|
|
|
88
90
|
this.$['*showSlider'] = true;
|
|
89
91
|
}
|
|
90
92
|
|
|
93
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
94
|
+
operation: parseFilterValue(this.$['*operationTooltip']),
|
|
95
|
+
});
|
|
96
|
+
|
|
91
97
|
this.$['*currentFilter'] = this._filter;
|
|
92
98
|
};
|
|
93
99
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorOperationControl.d.ts","sourceRoot":"","sources":["EditorOperationControl.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorOperationControl.d.ts","sourceRoot":"","sources":["EditorOperationControl.js"],"names":[],"mappings":"AAKA;IACE;;;OAGG;IACH,mBAAgB;CAuCjB;oCAhDmC,0BAA0B"}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
+
//@ts-check
|
|
1
2
|
import { EditorButtonControl } from './EditorButtonControl.js';
|
|
2
3
|
import { COLOR_OPERATIONS_CONFIG } from './toolbar-constants.js';
|
|
4
|
+
import { parseFilterValue } from './utils/parseFilterValue.js';
|
|
3
5
|
|
|
4
6
|
export class EditorOperationControl extends EditorButtonControl {
|
|
5
7
|
/**
|
|
6
8
|
* @private
|
|
7
|
-
* @type {
|
|
9
|
+
* @type {import('./toolbar-constants.js').ColorOperation | ''}
|
|
8
10
|
*/
|
|
9
11
|
_operation = '';
|
|
10
12
|
|
|
11
13
|
initCallback() {
|
|
12
14
|
super.initCallback();
|
|
13
15
|
|
|
14
|
-
this.$['on.click'] = (e) => {
|
|
16
|
+
this.$['on.click'] = (/** @type {MouseEvent} */ e) => {
|
|
15
17
|
this.$['*sliderEl'].setOperation(this._operation);
|
|
16
18
|
this.$['*showSlider'] = true;
|
|
17
19
|
this.$['*currentOperation'] = this._operation;
|
|
20
|
+
|
|
21
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
22
|
+
operation: parseFilterValue(this.$['*operationTooltip']),
|
|
23
|
+
});
|
|
18
24
|
};
|
|
19
25
|
|
|
20
|
-
this.defineAccessor('operation', (operation) => {
|
|
26
|
+
this.defineAccessor('operation', (/** @type {import('./toolbar-constants.js').ColorOperation} */ operation) => {
|
|
21
27
|
if (operation) {
|
|
22
28
|
this._operation = operation;
|
|
23
29
|
this.$['icon'] = operation;
|
|
@@ -40,10 +40,14 @@ export class EditorToolbar extends Block {
|
|
|
40
40
|
hidden: string;
|
|
41
41
|
visible: string;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
'on.
|
|
45
|
-
|
|
46
|
-
'on.
|
|
43
|
+
/** @param {MouseEvent} e */
|
|
44
|
+
'on.cancel': (e: MouseEvent) => void;
|
|
45
|
+
/** @param {MouseEvent} e */
|
|
46
|
+
'on.apply': (e: MouseEvent) => void;
|
|
47
|
+
/** @param {MouseEvent} e */
|
|
48
|
+
'on.applySlider': (e: MouseEvent) => void;
|
|
49
|
+
/** @param {MouseEvent} e */
|
|
50
|
+
'on.cancelSlider': (e: MouseEvent) => void;
|
|
47
51
|
/** @param {MouseEvent} e */
|
|
48
52
|
'on.clickTab': (e: MouseEvent) => void;
|
|
49
53
|
tab_role: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorToolbar.d.ts","sourceRoot":"","sources":["EditorToolbar.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorToolbar.d.ts","sourceRoot":"","sources":["EditorToolbar.js"],"names":[],"mappings":"AA4DA;IAII;;QAGE,qDAAqD;8BAA1C,OAAO,YAAY,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAwCjD,4BAA4B;yBAAhB,UAAU;QAStB,4BAA4B;wBAAhB,UAAU;QAOtB,4BAA4B;8BAAhB,UAAU;QAStB,4BAA4B;+BAAhB,UAAU;QAQtB,4BAA4B;2BAAhB,UAAU;;;;;;;MAiBvB;IAED,eAAe;IAEf,6BAAsE;IAGxE,eAAe;IACf,uBAKC;IAED;;;OAGG;IACH,gCAKC;IAED;;;OAGG;IACH,6BAKC;IAED;;;OAGG;IACH,6BAKC;IAED;;;OAGG;IACH,4BAoCC;IAED;;;;OAIG;IACH,qBAyBC;IAED;;;OAGG;IACH,4BAKC;IAED,eAAe;IACf,0BAIC;IAED,eAAe;IACf,4BAWC;IALG,oBAGC;IAIL;;;OAGG;IACH,oBAEC;IAED;;MAwBM;CAqFP;;;;sBA1aqB,4BAA4B"}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
TabId,
|
|
16
16
|
} from './toolbar-constants.js';
|
|
17
17
|
import { viewerImageSrc } from './util.js';
|
|
18
|
+
import { parseFilterValue } from './utils/parseFilterValue.js';
|
|
18
19
|
|
|
19
20
|
/** @param {String} id */
|
|
20
21
|
function renderTabToggle(id) {
|
|
@@ -104,18 +105,36 @@ export class EditorToolbar extends Block {
|
|
|
104
105
|
hidden: 'uc-tab-toggles--hidden',
|
|
105
106
|
visible: 'uc-tab-toggles--visible',
|
|
106
107
|
},
|
|
107
|
-
|
|
108
|
+
/** @param {MouseEvent} e */
|
|
109
|
+
'on.cancel': (e) => {
|
|
110
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
111
|
+
action: 'cancel',
|
|
112
|
+
});
|
|
113
|
+
|
|
108
114
|
this._cancelPreload?.();
|
|
109
115
|
this.$['*on.cancel']();
|
|
110
116
|
},
|
|
111
|
-
|
|
117
|
+
/** @param {MouseEvent} e */
|
|
118
|
+
'on.apply': (e) => {
|
|
119
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
120
|
+
action: 'apply',
|
|
121
|
+
});
|
|
112
122
|
this.$['*on.apply'](this.$['*editorTransformations']);
|
|
113
123
|
},
|
|
114
|
-
|
|
124
|
+
/** @param {MouseEvent} e */
|
|
125
|
+
'on.applySlider': (e) => {
|
|
126
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
127
|
+
action: 'apply-slider',
|
|
128
|
+
operation: parseFilterValue(this.$['*operationTooltip']),
|
|
129
|
+
});
|
|
115
130
|
this.ref['slider-el'].apply();
|
|
116
131
|
this._onSliderClose();
|
|
117
132
|
},
|
|
118
|
-
|
|
133
|
+
/** @param {MouseEvent} e */
|
|
134
|
+
'on.cancelSlider': (e) => {
|
|
135
|
+
this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
|
|
136
|
+
action: 'cancel-slider',
|
|
137
|
+
});
|
|
119
138
|
this.ref['slider-el'].cancel();
|
|
120
139
|
this._onSliderClose();
|
|
121
140
|
},
|
|
@@ -123,6 +142,7 @@ export class EditorToolbar extends Block {
|
|
|
123
142
|
'on.clickTab': (e) => {
|
|
124
143
|
const id = /** @type {HTMLElement} */ (e.currentTarget).getAttribute('data-id');
|
|
125
144
|
if (id) {
|
|
145
|
+
this.telemetryManager.sendEventCloudImageEditor(e, id);
|
|
126
146
|
this._activateTab(id, { fromViewer: false });
|
|
127
147
|
}
|
|
128
148
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar-constants.d.ts","sourceRoot":"","sources":["toolbar-constants.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,yDAAkE;AAElE,4CASE;AAEF,mCAyCE;AAEF,2CAAgE;AAEhE,iGAAiG;AACjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG"}
|
|
1
|
+
{"version":3,"file":"toolbar-constants.d.ts","sourceRoot":"","sources":["toolbar-constants.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,yDAAkE;AAElE,4CASE;AAEF,mCAyCE;AAEF,2CAAgE;AAEhE,iGAAiG;AACjG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;6BAEW,MAAM,OAAO,uBAAuB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a string like "iothari 100" into an object { filter: "iothari", value: 100 }
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str
|
|
5
|
+
* @returns {{ filter: string; value: number } | null}
|
|
6
|
+
*/
|
|
7
|
+
export function parseFilterValue(str: string): {
|
|
8
|
+
filter: string;
|
|
9
|
+
value: number;
|
|
10
|
+
} | null;
|
|
11
|
+
//# sourceMappingURL=parseFilterValue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseFilterValue.d.ts","sourceRoot":"","sources":["parseFilterValue.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sCAHW,MAAM,GACJ;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAMpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a string like "iothari 100" into an object { filter: "iothari", value: 100 }
|
|
3
|
+
*
|
|
4
|
+
* @param {string} str
|
|
5
|
+
* @returns {{ filter: string; value: number } | null}
|
|
6
|
+
*/
|
|
7
|
+
export function parseFilterValue(str) {
|
|
8
|
+
const match = str.match(/^(\w+)\s+(\d+)$/);
|
|
9
|
+
if (!match) return null;
|
|
10
|
+
return { filter: match[1], value: Number(match[2]) };
|
|
11
|
+
}
|
|
@@ -23,7 +23,6 @@ export const initialConfig = {
|
|
|
23
23
|
cameraMirror: false,
|
|
24
24
|
cameraCapture: '',
|
|
25
25
|
sourceList: 'local, url, camera, dropbox, gdrive',
|
|
26
|
-
topLevelOrigin: '',
|
|
27
26
|
cloudImageEditorTabs: serializeCsv(ALL_TABS),
|
|
28
27
|
maxLocalFileSizeBytes: 0,
|
|
29
28
|
thumbSize: 76,
|
|
@@ -47,7 +46,6 @@ export const initialConfig = {
|
|
|
47
46
|
secureExpire: '',
|
|
48
47
|
secureDeliveryProxy: '',
|
|
49
48
|
retryThrottledRequestMaxTimes: 10,
|
|
50
|
-
retryNetworkErrorMaxTimes: 3,
|
|
51
49
|
multipartMinFileSize: 26214400,
|
|
52
50
|
multipartChunkSize: 5242880,
|
|
53
51
|
maxConcurrentRequests: 10,
|
|
@@ -84,4 +82,6 @@ export const initialConfig = {
|
|
|
84
82
|
cloudImageEditorMaskHref: null,
|
|
85
83
|
|
|
86
84
|
testMode: false,
|
|
85
|
+
|
|
86
|
+
qualityInsights: true,
|
|
87
87
|
};
|
|
@@ -38,7 +38,6 @@ const mapping = {
|
|
|
38
38
|
cameraMirror: asBoolean,
|
|
39
39
|
cameraCapture: asCameraCapture,
|
|
40
40
|
sourceList: asString,
|
|
41
|
-
topLevelOrigin: asString,
|
|
42
41
|
maxLocalFileSizeBytes: asNumber,
|
|
43
42
|
thumbSize: asNumber,
|
|
44
43
|
showEmptyList: asBoolean,
|
|
@@ -62,7 +61,6 @@ const mapping = {
|
|
|
62
61
|
secureExpire: asString,
|
|
63
62
|
secureDeliveryProxy: asString,
|
|
64
63
|
retryThrottledRequestMaxTimes: asNumber,
|
|
65
|
-
retryNetworkErrorMaxTimes: asNumber,
|
|
66
64
|
multipartMinFileSize: asNumber,
|
|
67
65
|
multipartChunkSize: asNumber,
|
|
68
66
|
maxConcurrentRequests: asNumber,
|
|
@@ -102,6 +100,8 @@ const mapping = {
|
|
|
102
100
|
cloudImageEditorMaskHref: asString,
|
|
103
101
|
|
|
104
102
|
testMode: asBoolean,
|
|
103
|
+
|
|
104
|
+
qualityInsights: asBoolean,
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|