@uploadcare/file-uploader 1.19.0-alpha.0 → 1.19.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.
Files changed (213) hide show
  1. package/abstract/Block.d.ts +2 -11
  2. package/abstract/Block.d.ts.map +1 -1
  3. package/abstract/Block.js +3 -29
  4. package/abstract/CTX.d.ts +2 -2
  5. package/abstract/CTX.d.ts.map +1 -1
  6. package/abstract/CTX.js +1 -1
  7. package/abstract/{managers/LocaleManager.d.ts → LocaleManager.d.ts} +8 -8
  8. package/abstract/{managers/LocaleManager.d.ts.map → LocaleManager.d.ts.map} +1 -1
  9. package/abstract/{managers/LocaleManager.js → LocaleManager.js} +8 -8
  10. package/abstract/{managers/ModalManager.d.ts → ModalManager.d.ts} +7 -7
  11. package/abstract/{managers/ModalManager.d.ts.map → ModalManager.d.ts.map} +1 -1
  12. package/abstract/{managers/ModalManager.js → ModalManager.js} +3 -3
  13. package/abstract/SecureUploadsManager.d.ts +22 -0
  14. package/abstract/{managers/SecureUploadsManager.d.ts.map → SecureUploadsManager.d.ts.map} +1 -1
  15. package/abstract/{managers/SecureUploadsManager.js → SecureUploadsManager.js} +5 -5
  16. package/abstract/SolutionBlock.d.ts +1 -1
  17. package/abstract/UploaderBlock.d.ts +3 -3
  18. package/abstract/UploaderBlock.d.ts.map +1 -1
  19. package/abstract/UploaderBlock.js +3 -2
  20. package/abstract/UploaderPublicApi.d.ts.map +1 -1
  21. package/abstract/UploaderPublicApi.js +3 -0
  22. package/abstract/{managers/ValidationManager.d.ts → ValidationManager.d.ts} +7 -7
  23. package/abstract/{managers/ValidationManager.d.ts.map → ValidationManager.d.ts.map} +1 -1
  24. package/abstract/{managers/ValidationManager.js → ValidationManager.js} +14 -14
  25. package/abstract/{managers/a11y.d.ts → a11y.d.ts} +2 -2
  26. package/abstract/a11y.d.ts.map +1 -0
  27. package/abstract/{managers/a11y.js → a11y.js} +1 -1
  28. package/abstract/l10nProcessor.js +1 -1
  29. package/blocks/CameraSource/CameraSource.d.ts +1 -1
  30. package/blocks/CloudImageEditor/src/EditorCropButtonControl.d.ts.map +1 -1
  31. package/blocks/CloudImageEditor/src/EditorCropButtonControl.js +1 -8
  32. package/blocks/CloudImageEditor/src/EditorFilterControl.d.ts.map +1 -1
  33. package/blocks/CloudImageEditor/src/EditorFilterControl.js +1 -7
  34. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts +1 -1
  35. package/blocks/CloudImageEditor/src/EditorOperationControl.d.ts.map +1 -1
  36. package/blocks/CloudImageEditor/src/EditorOperationControl.js +3 -9
  37. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts +4 -8
  38. package/blocks/CloudImageEditor/src/EditorToolbar.d.ts.map +1 -1
  39. package/blocks/CloudImageEditor/src/EditorToolbar.js +4 -24
  40. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts +0 -1
  41. package/blocks/CloudImageEditor/src/toolbar-constants.d.ts.map +1 -1
  42. package/blocks/CloudImageEditor/src/toolbar-constants.js +0 -2
  43. package/blocks/Config/Config.d.ts.map +1 -1
  44. package/blocks/Config/Config.js +6 -1
  45. package/blocks/Config/initialConfig.d.ts +1 -0
  46. package/blocks/Config/initialConfig.d.ts.map +1 -1
  47. package/blocks/Config/initialConfig.js +4 -2
  48. package/blocks/Config/normalizeConfigValue.d.ts.map +1 -1
  49. package/blocks/Config/normalizeConfigValue.js +3 -2
  50. package/blocks/Config/side-effects.d.ts +8 -4
  51. package/blocks/Config/side-effects.d.ts.map +1 -1
  52. package/blocks/Config/side-effects.js +113 -21
  53. package/blocks/DropArea/DropArea.d.ts +1 -1
  54. package/blocks/ExternalSource/ExternalSource.d.ts +7 -1
  55. package/blocks/ExternalSource/ExternalSource.d.ts.map +1 -1
  56. package/blocks/ExternalSource/ExternalSource.js +24 -2
  57. package/blocks/ExternalSource/MessageBridge.d.ts.map +1 -1
  58. package/blocks/ExternalSource/MessageBridge.js +3 -1
  59. package/blocks/ExternalSource/types.d.ts +4 -0
  60. package/blocks/ExternalSource/types.d.ts.map +1 -1
  61. package/blocks/ExternalSource/types.js +4 -0
  62. package/blocks/FileItem/FileItem.d.ts +1 -1
  63. package/blocks/FileItem/FileItem.d.ts.map +1 -1
  64. package/blocks/FileItem/FileItem.js +0 -16
  65. package/blocks/Modal/Modal.d.ts +6 -6
  66. package/blocks/Modal/Modal.d.ts.map +1 -1
  67. package/blocks/Modal/Modal.js +12 -10
  68. package/blocks/SimpleBtn/SimpleBtn.d.ts +1 -1
  69. package/blocks/SourceBtn/SourceBtn.d.ts +1 -1
  70. package/blocks/Thumb/Thumb.d.ts +1 -1
  71. package/blocks/UploadCtxProvider/EventEmitter.d.ts +4 -17
  72. package/blocks/UploadCtxProvider/EventEmitter.d.ts.map +1 -1
  73. package/blocks/UploadCtxProvider/EventEmitter.js +2 -14
  74. package/blocks/UploadCtxProvider/UploadCtxProvider.d.ts.map +1 -1
  75. package/blocks/UploadCtxProvider/UploadCtxProvider.js +1 -0
  76. package/blocks/UploadList/UploadList.d.ts +1 -1
  77. package/blocks/UrlSource/UrlSource.js +3 -1
  78. package/blocks/themes/uc-basic/common.css +4 -0
  79. package/blocks/themes/uc-basic/svg-sprite.d.ts +1 -1
  80. package/blocks/themes/uc-basic/svg-sprite.d.ts.map +1 -1
  81. package/blocks/themes/uc-basic/svg-sprite.js +1 -1
  82. package/env.d.ts +1 -1
  83. package/env.js +1 -1
  84. package/index.d.ts +1 -1
  85. package/index.js +1 -1
  86. package/index.ssr.d.ts +2 -4
  87. package/index.ssr.d.ts.map +1 -1
  88. package/index.ssr.js +12 -8
  89. package/locales/file-uploader/ar.d.ts +1 -0
  90. package/locales/file-uploader/ar.js +1 -0
  91. package/locales/file-uploader/az.d.ts +1 -0
  92. package/locales/file-uploader/az.js +1 -0
  93. package/locales/file-uploader/ca.d.ts +1 -0
  94. package/locales/file-uploader/ca.js +1 -0
  95. package/locales/file-uploader/cs.d.ts +1 -0
  96. package/locales/file-uploader/cs.js +1 -0
  97. package/locales/file-uploader/da.d.ts +1 -0
  98. package/locales/file-uploader/da.js +1 -0
  99. package/locales/file-uploader/de.d.ts +1 -0
  100. package/locales/file-uploader/de.js +1 -0
  101. package/locales/file-uploader/el.d.ts +1 -0
  102. package/locales/file-uploader/el.js +1 -0
  103. package/locales/file-uploader/en.d.ts +1 -0
  104. package/locales/file-uploader/en.js +1 -0
  105. package/locales/file-uploader/es.d.ts +1 -0
  106. package/locales/file-uploader/es.js +1 -0
  107. package/locales/file-uploader/et.d.ts +1 -0
  108. package/locales/file-uploader/et.js +1 -0
  109. package/locales/file-uploader/fi.d.ts +1 -0
  110. package/locales/file-uploader/fi.js +1 -0
  111. package/locales/file-uploader/fr.d.ts +1 -0
  112. package/locales/file-uploader/fr.js +1 -0
  113. package/locales/file-uploader/he.d.ts +1 -0
  114. package/locales/file-uploader/he.js +1 -0
  115. package/locales/file-uploader/hy.d.ts +1 -0
  116. package/locales/file-uploader/hy.js +1 -0
  117. package/locales/file-uploader/is.d.ts +1 -0
  118. package/locales/file-uploader/is.js +1 -0
  119. package/locales/file-uploader/it.d.ts +1 -0
  120. package/locales/file-uploader/it.js +1 -0
  121. package/locales/file-uploader/ja.d.ts +1 -0
  122. package/locales/file-uploader/ja.js +1 -0
  123. package/locales/file-uploader/ka.d.ts +1 -0
  124. package/locales/file-uploader/ka.js +1 -0
  125. package/locales/file-uploader/kk.d.ts +1 -0
  126. package/locales/file-uploader/kk.js +1 -0
  127. package/locales/file-uploader/ko.d.ts +1 -0
  128. package/locales/file-uploader/ko.js +1 -0
  129. package/locales/file-uploader/lv.d.ts +1 -0
  130. package/locales/file-uploader/lv.js +1 -0
  131. package/locales/file-uploader/nb.d.ts +1 -0
  132. package/locales/file-uploader/nb.js +1 -0
  133. package/locales/file-uploader/nl.d.ts +1 -0
  134. package/locales/file-uploader/nl.js +1 -0
  135. package/locales/file-uploader/pl.d.ts +1 -0
  136. package/locales/file-uploader/pl.js +1 -0
  137. package/locales/file-uploader/pt.d.ts +1 -0
  138. package/locales/file-uploader/pt.js +1 -0
  139. package/locales/file-uploader/ro.d.ts +1 -0
  140. package/locales/file-uploader/ro.js +1 -0
  141. package/locales/file-uploader/ru.d.ts +1 -0
  142. package/locales/file-uploader/ru.js +1 -0
  143. package/locales/file-uploader/sk.d.ts +1 -0
  144. package/locales/file-uploader/sk.js +1 -0
  145. package/locales/file-uploader/sr.d.ts +1 -0
  146. package/locales/file-uploader/sr.js +1 -0
  147. package/locales/file-uploader/sv.d.ts +1 -0
  148. package/locales/file-uploader/sv.js +1 -0
  149. package/locales/file-uploader/tr.d.ts +1 -0
  150. package/locales/file-uploader/tr.js +1 -0
  151. package/locales/file-uploader/uk.d.ts +1 -0
  152. package/locales/file-uploader/uk.js +1 -0
  153. package/locales/file-uploader/vi.d.ts +1 -0
  154. package/locales/file-uploader/vi.js +1 -0
  155. package/locales/file-uploader/zh-TW.d.ts +1 -0
  156. package/locales/file-uploader/zh-TW.js +1 -0
  157. package/locales/file-uploader/zh.d.ts +1 -0
  158. package/locales/file-uploader/zh.js +1 -0
  159. package/package.json +6 -8
  160. package/solutions/cloud-image-editor/CloudImageEditor.d.ts +0 -34
  161. package/solutions/cloud-image-editor/CloudImageEditor.d.ts.map +1 -1
  162. package/solutions/cloud-image-editor/CloudImageEditor.js +0 -12
  163. package/solutions/file-uploader/inline/FileUploaderInline.d.ts +1 -2
  164. package/solutions/file-uploader/inline/FileUploaderInline.d.ts.map +1 -1
  165. package/solutions/file-uploader/inline/FileUploaderInline.js +0 -4
  166. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts +9 -10
  167. package/solutions/file-uploader/minimal/FileUploaderMinimal.d.ts.map +1 -1
  168. package/solutions/file-uploader/minimal/FileUploaderMinimal.js +3 -7
  169. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts +1 -2
  170. package/solutions/file-uploader/regular/FileUploaderRegular.d.ts.map +1 -1
  171. package/solutions/file-uploader/regular/FileUploaderRegular.js +0 -4
  172. package/types/events.d.ts +1 -1
  173. package/types/exported.d.ts +66 -54
  174. package/utils/get-top-level-origin.d.ts +2 -0
  175. package/utils/get-top-level-origin.d.ts.map +1 -0
  176. package/utils/get-top-level-origin.js +11 -0
  177. package/utils/validators/collection/validateCollectionUploadError.d.ts +2 -2
  178. package/utils/validators/collection/validateCollectionUploadError.d.ts.map +1 -1
  179. package/utils/validators/collection/validateCollectionUploadError.js +1 -1
  180. package/utils/validators/collection/validateMultiple.d.ts +2 -2
  181. package/utils/validators/collection/validateMultiple.d.ts.map +1 -1
  182. package/utils/validators/collection/validateMultiple.js +1 -1
  183. package/utils/validators/file/validateFileType.d.ts +2 -2
  184. package/utils/validators/file/validateFileType.d.ts.map +1 -1
  185. package/utils/validators/file/validateFileType.js +1 -1
  186. package/utils/validators/file/validateIsImage.d.ts +2 -2
  187. package/utils/validators/file/validateIsImage.d.ts.map +1 -1
  188. package/utils/validators/file/validateIsImage.js +1 -1
  189. package/utils/validators/file/validateMaxSizeLimit.d.ts +2 -2
  190. package/utils/validators/file/validateMaxSizeLimit.d.ts.map +1 -1
  191. package/utils/validators/file/validateMaxSizeLimit.js +1 -1
  192. package/utils/validators/file/validateUploadError.d.ts +2 -2
  193. package/utils/validators/file/validateUploadError.d.ts.map +1 -1
  194. package/utils/validators/file/validateUploadError.js +1 -1
  195. package/web/file-uploader.iife.min.js +4 -4
  196. package/web/file-uploader.min.js +4 -4
  197. package/web/uc-basic.min.css +1 -1
  198. package/web/uc-cloud-image-editor.min.js +4 -4
  199. package/web/uc-file-uploader-inline.min.css +1 -1
  200. package/web/uc-file-uploader-inline.min.js +4 -4
  201. package/web/uc-file-uploader-minimal.min.css +1 -1
  202. package/web/uc-file-uploader-minimal.min.js +4 -4
  203. package/web/uc-file-uploader-regular.min.css +1 -1
  204. package/web/uc-file-uploader-regular.min.js +4 -4
  205. package/web/uc-img.min.js +1 -1
  206. package/abstract/managers/SecureUploadsManager.d.ts +0 -22
  207. package/abstract/managers/TelemetryManager.d.ts +0 -65
  208. package/abstract/managers/TelemetryManager.d.ts.map +0 -1
  209. package/abstract/managers/TelemetryManager.js +0 -201
  210. package/abstract/managers/a11y.d.ts.map +0 -1
  211. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts +0 -11
  212. package/blocks/CloudImageEditor/src/utils/parseFilterValue.d.ts.map +0 -1
  213. package/blocks/CloudImageEditor/src/utils/parseFilterValue.js +0 -11
@@ -35,16 +35,9 @@ export class EditorCropButtonControl extends EditorButtonControl {
35
35
  );
36
36
  });
37
37
 
38
- this.$['on.click'] = (e) => {
38
+ this.$['on.click'] = () => {
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
-
48
41
  this.$['*cropperEl'].setValue(this._operation, next);
49
42
  };
50
43
  }
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"EditorFilterControl.d.ts","sourceRoot":"","sources":["EditorFilterControl.js"],"names":[],"mappings":"AAOA;IAeE,sBA2BC;IAED;;;OAGG;IACH,2BAHW,yBAAyB,EAAE,YAC3B,oBAAoB,iBAuB9B;IAfG,yCAA4B;IAoC1B,+BAA0B;IAC1B,4BAAqB;IAYzB,4CAEE;IAGF,kBAA+B;CAgDlC;;;;oCAjKmC,0BAA0B"}
@@ -4,7 +4,6 @@ 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';
8
7
 
9
8
  export class EditorFilterControl extends EditorButtonControl {
10
9
  constructor() {
@@ -80,8 +79,7 @@ export class EditorFilterControl extends EditorButtonControl {
80
79
  initCallback() {
81
80
  super.initCallback();
82
81
 
83
- /** @param {MouseEvent} e */
84
- this.$['on.click'] = (e) => {
82
+ this.$['on.click'] = () => {
85
83
  if (!this.$.active) {
86
84
  this.$['*sliderEl'].setOperation(this._operation, this._filter);
87
85
  this.$['*sliderEl'].apply();
@@ -90,10 +88,6 @@ export class EditorFilterControl extends EditorButtonControl {
90
88
  this.$['*showSlider'] = true;
91
89
  }
92
90
 
93
- this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
94
- operation: parseFilterValue(this.$['*operationTooltip']),
95
- });
96
-
97
91
  this.$['*currentFilter'] = this._filter;
98
92
  };
99
93
 
@@ -1,7 +1,7 @@
1
1
  export class EditorOperationControl extends EditorButtonControl {
2
2
  /**
3
3
  * @private
4
- * @type {import('./toolbar-constants.js').ColorOperation | ''}
4
+ * @type {String}
5
5
  */
6
6
  private _operation;
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"EditorOperationControl.d.ts","sourceRoot":"","sources":["EditorOperationControl.js"],"names":[],"mappings":"AAKA;IACE;;;OAGG;IACH,mBAAgB;CAuCjB;oCAhDmC,0BAA0B"}
1
+ {"version":3,"file":"EditorOperationControl.d.ts","sourceRoot":"","sources":["EditorOperationControl.js"],"names":[],"mappings":"AAGA;IACE;;;OAGG;IACH,mBAAgB;CAmCjB;oCA3CmC,0BAA0B"}
@@ -1,29 +1,23 @@
1
- //@ts-check
2
1
  import { EditorButtonControl } from './EditorButtonControl.js';
3
2
  import { COLOR_OPERATIONS_CONFIG } from './toolbar-constants.js';
4
- import { parseFilterValue } from './utils/parseFilterValue.js';
5
3
 
6
4
  export class EditorOperationControl extends EditorButtonControl {
7
5
  /**
8
6
  * @private
9
- * @type {import('./toolbar-constants.js').ColorOperation | ''}
7
+ * @type {String}
10
8
  */
11
9
  _operation = '';
12
10
 
13
11
  initCallback() {
14
12
  super.initCallback();
15
13
 
16
- this.$['on.click'] = (/** @type {MouseEvent} */ e) => {
14
+ this.$['on.click'] = (e) => {
17
15
  this.$['*sliderEl'].setOperation(this._operation);
18
16
  this.$['*showSlider'] = true;
19
17
  this.$['*currentOperation'] = this._operation;
20
-
21
- this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
22
- operation: parseFilterValue(this.$['*operationTooltip']),
23
- });
24
18
  };
25
19
 
26
- this.defineAccessor('operation', (/** @type {import('./toolbar-constants.js').ColorOperation} */ operation) => {
20
+ this.defineAccessor('operation', (operation) => {
27
21
  if (operation) {
28
22
  this._operation = operation;
29
23
  this.$['icon'] = operation;
@@ -40,14 +40,10 @@ export class EditorToolbar extends Block {
40
40
  hidden: string;
41
41
  visible: string;
42
42
  };
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;
43
+ 'on.cancel': () => void;
44
+ 'on.apply': () => void;
45
+ 'on.applySlider': () => void;
46
+ 'on.cancelSlider': () => void;
51
47
  /** @param {MouseEvent} e */
52
48
  'on.clickTab': (e: MouseEvent) => void;
53
49
  tab_role: string;
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"EditorToolbar.d.ts","sourceRoot":"","sources":["EditorToolbar.js"],"names":[],"mappings":"AA2DA;IAII;;QAGE,qDAAqD;8BAA1C,OAAO,YAAY,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuDjD,4BAA4B;2BAAhB,UAAU;;;;;;;MAgBvB;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;;;;sBAtZqB,4BAA4B"}
@@ -15,7 +15,6 @@ import {
15
15
  TabId,
16
16
  } from './toolbar-constants.js';
17
17
  import { viewerImageSrc } from './util.js';
18
- import { parseFilterValue } from './utils/parseFilterValue.js';
19
18
 
20
19
  /** @param {String} id */
21
20
  function renderTabToggle(id) {
@@ -105,36 +104,18 @@ export class EditorToolbar extends Block {
105
104
  hidden: 'uc-tab-toggles--hidden',
106
105
  visible: 'uc-tab-toggles--visible',
107
106
  },
108
- /** @param {MouseEvent} e */
109
- 'on.cancel': (e) => {
110
- this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
111
- action: 'cancel',
112
- });
113
-
107
+ 'on.cancel': () => {
114
108
  this._cancelPreload?.();
115
109
  this.$['*on.cancel']();
116
110
  },
117
- /** @param {MouseEvent} e */
118
- 'on.apply': (e) => {
119
- this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
120
- action: 'apply',
121
- });
111
+ 'on.apply': () => {
122
112
  this.$['*on.apply'](this.$['*editorTransformations']);
123
113
  },
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
- });
114
+ 'on.applySlider': () => {
130
115
  this.ref['slider-el'].apply();
131
116
  this._onSliderClose();
132
117
  },
133
- /** @param {MouseEvent} e */
134
- 'on.cancelSlider': (e) => {
135
- this.telemetryManager.sendEventCloudImageEditor(e, this.$['*tabId'], {
136
- action: 'cancel-slider',
137
- });
118
+ 'on.cancelSlider': () => {
138
119
  this.ref['slider-el'].cancel();
139
120
  this._onSliderClose();
140
121
  },
@@ -142,7 +123,6 @@ export class EditorToolbar extends Block {
142
123
  'on.clickTab': (e) => {
143
124
  const id = /** @type {HTMLElement} */ (e.currentTarget).getAttribute('data-id');
144
125
  if (id) {
145
- this.telemetryManager.sendEventCloudImageEditor(e, id);
146
126
  this._activateTab(id, { fromViewer: false });
147
127
  }
148
128
  },
@@ -55,5 +55,4 @@ export const COLOR_OPERATIONS_CONFIG: Readonly<{
55
55
  keypointsNumber: number;
56
56
  };
57
57
  }>;
58
- export type ColorOperation = keyof typeof COLOR_OPERATIONS_CONFIG;
59
58
  //# sourceMappingURL=toolbar-constants.d.ts.map
@@ -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;6BAEW,MAAM,OAAO,uBAAuB"}
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"}
@@ -112,5 +112,3 @@ export const COLOR_OPERATIONS_CONFIG = Object.freeze({
112
112
  keypointsNumber: 1,
113
113
  },
114
114
  });
115
-
116
- /** @typedef {keyof typeof COLOR_OPERATIONS_CONFIG} ColorOperation */
@@ -1 +1 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["Config.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,gCAXU,CACT,UAAc,EACd,0BAA8B,EAC9B,gCAAoC,EACpC,gCAAoC,EACpC,kBAAsB,EACtB,gBAAoB,EACpB,sBAA0B,EAC1B,sBAA0B,CACvB,CAWF;qBAyNY,OAAO,2BAA2B,EAAE,UAAU,CAAC,OAAO,WAAW,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC;AAAlH,6HAA6H;AAG7H,qBAAiC,MAAM,CAA4C;AA/LnF;IAkBE;;;;OAIG;IACH,+BAYC;IAED;;;;OAIG;IACH,2BAQC;IAED;;;;OAIG;IACH,kBAyBC;IAED;;;OAGG;IACH,kBAIC;IAED;;;;OAIG;IACH,wCAJW,MAAM,iBACN,OAAO,aACP,OAAO,QAoBjB;IA0CD;;;;OAIG;IACH,+BAJW,MAAM,OAAO,gBAAgB,UAC7B,MAAM,UACN,MAAM,QAahB;CACF;sBAjPqB,yBAAyB;AAwD/C,0CAA0C;AAC1C,gCAAoC,MAAM,CAAC,MAAM,OAAO,aAAa,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAGjG"}
1
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["Config.js"],"names":[],"mappings":"AAcA;;;;;;;;;;;;;GAaG;AACH,gCAXU,CACT,UAAc,EACd,0BAA8B,EAC9B,gCAAoC,EACpC,gCAAoC,EACpC,kBAAsB,EACtB,gBAAoB,EACpB,sBAA0B,EAC1B,sBAA0B,CACvB,CAWF;qBA8NY,OAAO,2BAA2B,EAAE,UAAU,CAAC,OAAO,WAAW,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC;AAAlH,6HAA6H;AAG7H,qBAAiC,MAAM,CAA4C;AApMnF;IAkBE;;;;OAIG;IACH,+BAYC;IAED;;;;OAIG;IACH,2BAQC;IAED;;;;OAIG;IACH,kBAwBC;IAED;;;OAGG;IACH,kBAIC;IAED;;;;OAIG;IACH,wCAJW,MAAM,iBACN,OAAO,aACP,OAAO,QAoBjB;IAgDD;;;;OAIG;IACH,+BAJW,MAAM,OAAO,gBAAgB,UAC7B,MAAM,UACN,MAAM,QAahB;CACF;sBAtPqB,yBAAyB;AAwD/C,0CAA0C;AAC1C,gCAAoC,MAAM,CAAC,MAAM,OAAO,aAAa,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAGjG"}
@@ -142,7 +142,6 @@ class ConfigClass extends Block {
142
142
  runAssertions(this.cfg);
143
143
  runSideEffects({
144
144
  key,
145
- value: normalizedValue ?? null,
146
145
  setValue: this._setValue.bind(this),
147
146
  getValue: this._getValue.bind(this),
148
147
  });
@@ -220,6 +219,12 @@ class ConfigClass extends Block {
220
219
  return this._getValue(key);
221
220
  },
222
221
  });
222
+
223
+ runSideEffects({
224
+ key,
225
+ setValue: this._setValue.bind(this),
226
+ getValue: this._getValue.bind(this),
227
+ });
223
228
  }
224
229
  }
225
230
 
@@ -1,6 +1,7 @@
1
1
  export const DEFAULT_CDN_CNAME: "https://ucarecdn.com";
2
2
  export const DEFAULT_BASE_URL: "https://upload.uploadcare.com";
3
3
  export const DEFAULT_SOCIAL_BASE_URL: "https://social.uploadcare.com";
4
+ export const DEFAULT_PREFIXED_CDN_BASE_DOMAIN: "https://ucarecd.net";
4
5
  /** @type {import('../../types/exported').ConfigType} */
5
6
  export const initialConfig: import("../../types/exported").ConfigType;
6
7
  //# sourceMappingURL=initialConfig.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,gCAAiC,sBAAsB,CAAC;AACxD,+BAAgC,+BAA+B,CAAC;AAChE,sCAAuC,+BAA+B,CAAC;AAEvE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CA6ElD"}
1
+ {"version":3,"file":"initialConfig.d.ts","sourceRoot":"","sources":["initialConfig.js"],"names":[],"mappings":"AAKA,gCAAiC,sBAAsB,CAAC;AACxD,+BAAgC,+BAA+B,CAAC;AAChE,sCAAuC,+BAA+B,CAAC;AACvE,+CAAgD,qBAAqB,CAAC;AAEtE,wDAAwD;AACxD,4BADW,OAAO,sBAAsB,EAAE,UAAU,CA8ElD"}
@@ -6,6 +6,7 @@ import { serializeCsv } from '../utils/comma-separated.js';
6
6
  export const DEFAULT_CDN_CNAME = 'https://ucarecdn.com';
7
7
  export const DEFAULT_BASE_URL = 'https://upload.uploadcare.com';
8
8
  export const DEFAULT_SOCIAL_BASE_URL = 'https://social.uploadcare.com';
9
+ export const DEFAULT_PREFIXED_CDN_BASE_DOMAIN = 'https://ucarecd.net';
9
10
 
10
11
  /** @type {import('../../types/exported').ConfigType} */
11
12
  export const initialConfig = {
@@ -23,6 +24,7 @@ export const initialConfig = {
23
24
  cameraMirror: false,
24
25
  cameraCapture: '',
25
26
  sourceList: 'local, url, camera, dropbox, gdrive',
27
+ topLevelOrigin: '',
26
28
  cloudImageEditorTabs: serializeCsv(ALL_TABS),
27
29
  maxLocalFileSizeBytes: 0,
28
30
  thumbSize: 76,
@@ -40,12 +42,14 @@ export const initialConfig = {
40
42
 
41
43
  remoteTabSessionKey: '',
42
44
  cdnCname: DEFAULT_CDN_CNAME,
45
+ cdnCnamePrefixed: DEFAULT_PREFIXED_CDN_BASE_DOMAIN,
43
46
  baseUrl: DEFAULT_BASE_URL,
44
47
  socialBaseUrl: DEFAULT_SOCIAL_BASE_URL,
45
48
  secureSignature: '',
46
49
  secureExpire: '',
47
50
  secureDeliveryProxy: '',
48
51
  retryThrottledRequestMaxTimes: 10,
52
+ retryNetworkErrorMaxTimes: 3,
49
53
  multipartMinFileSize: 26214400,
50
54
  multipartChunkSize: 5242880,
51
55
  maxConcurrentRequests: 10,
@@ -82,6 +86,4 @@ export const initialConfig = {
82
86
  cloudImageEditorMaskHref: null,
83
87
 
84
88
  testMode: false,
85
-
86
- qualityInsights: true,
87
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAgHO,qCAL+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,OAC1C,CAAC,SACD,OAAO,GACL,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAa3D"}
1
+ {"version":3,"file":"normalizeConfigValue.d.ts","sourceRoot":"","sources":["normalizeConfigValue.js"],"names":[],"mappings":"AAiHO,qCAL+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,OAC1C,CAAC,SACD,OAAO,GACL,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAa3D"}
@@ -38,6 +38,7 @@ const mapping = {
38
38
  cameraMirror: asBoolean,
39
39
  cameraCapture: asCameraCapture,
40
40
  sourceList: asString,
41
+ topLevelOrigin: asString,
41
42
  maxLocalFileSizeBytes: asNumber,
42
43
  thumbSize: asNumber,
43
44
  showEmptyList: asBoolean,
@@ -55,12 +56,14 @@ const mapping = {
55
56
 
56
57
  remoteTabSessionKey: asString,
57
58
  cdnCname: asString,
59
+ cdnCnamePrefixed: asString,
58
60
  baseUrl: asString,
59
61
  socialBaseUrl: asString,
60
62
  secureSignature: asString,
61
63
  secureExpire: asString,
62
64
  secureDeliveryProxy: asString,
63
65
  retryThrottledRequestMaxTimes: asNumber,
66
+ retryNetworkErrorMaxTimes: asNumber,
64
67
  multipartMinFileSize: asNumber,
65
68
  multipartChunkSize: asNumber,
66
69
  maxConcurrentRequests: asNumber,
@@ -100,8 +103,6 @@ const mapping = {
100
103
  cloudImageEditorMaskHref: asString,
101
104
 
102
105
  testMode: asBoolean,
103
-
104
- qualityInsights: asBoolean,
105
106
  };
106
107
 
107
108
  /**
@@ -1,7 +1,11 @@
1
- export function runSideEffects<T extends keyof import("../../types").ConfigType>({ key, value, setValue, getValue }: {
1
+ export function runSideEffects<T extends keyof import("../../types").ConfigType>({ key, setValue, getValue }: {
2
2
  key: T;
3
- value: import("../../types").ConfigType[T];
4
- setValue: (key: T, value: import("../../types").ConfigType[T]) => void;
5
- getValue: (key: T) => import("../../types").ConfigType[T];
3
+ setValue: <TSetValue extends keyof import("../../types").ConfigType>(key: TSetValue, value: import("../../types").ConfigType[TSetValue]) => void;
4
+ getValue: <TGetValue extends keyof import("../../types").ConfigType>(key: TGetValue) => import("../../types").ConfigType[TGetValue];
6
5
  }): void;
6
+ export type ComputedPropertyDeclaration<TKey extends keyof import("../../types").ConfigType, TDeps extends Exclude<keyof import("../../types").ConfigType, TKey>[]> = {
7
+ key: TKey;
8
+ deps: TDeps;
9
+ fn: (args: Record<TKey, import("../../types").ConfigType[TKey]> & { [K in TDeps[number]]: import("../../types").ConfigType[K]; }) => import("../../types").ConfigType[TKey] | Promise<import("../../types").ConfigType[TKey]>;
10
+ };
7
11
  //# sourceMappingURL=side-effects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AAWO,+BAR+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,sCAC1C;IACN,GAAG,EAAE,CAAC,CAAC;IACP,KAAK,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACvE,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CAC3D,QAsBH"}
1
+ {"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AAwFO,+BAZ+C,CAAC,SAA1C,MAAO,OAAO,aAAa,EAAE,UAAW,+BAC1C;IACN,GAAG,EAAE,CAAC,CAAC;IACP,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,KAC/C,IAAI,CAAC;IACV,QAAQ,EAAE,CAAC,SAAS,SAAS,MAAM,OAAO,aAAa,EAAE,UAAU,EACjE,GAAG,EAAE,SAAS,KACX,OAAO,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;CAClD,QAqCH;wCAlHqD,IAAI,SAA7C,MAAO,OAAO,aAAa,EAAE,UAAW,EACkB,KAAK,SAA9D,OAAO,CAAC,MAAM,OAAO,aAAa,EAAE,UAAU,EAAE,IAAI,CAAC,EAAG;SAExD,IAAI;UACJ,KAAK;QACL,CACT,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,GAC1D,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,GAC1D,KACE,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,aAAa,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC"}
@@ -1,32 +1,124 @@
1
+ // @ts-check
2
+
3
+ // TODO: Here is troubles with tsd: it can't resolve types from `@uploadcare/cname-prefix/async` due to unsupported bundler moduleResolution.
4
+ // @ts-ignore
5
+ import { getPrefixedCdnBaseAsync } from '@uploadcare/cname-prefix/async';
1
6
  import { deserializeCsv, serializeCsv } from '../utils/comma-separated.js';
7
+ import { DEFAULT_CDN_CNAME } from './initialConfig.js';
8
+
9
+ /**
10
+ * @template {keyof import('../../types').ConfigType} TKey
11
+ * @template {Exclude<keyof import('../../types').ConfigType, TKey>[]} TDeps
12
+ * @typedef {Object} ComputedPropertyDeclaration
13
+ * @property {TKey} key
14
+ * @property {TDeps} deps
15
+ * @property {(
16
+ * args: Record<TKey, import('../../types').ConfigType[TKey]> & {
17
+ * [K in TDeps[number]]: import('../../types').ConfigType[K];
18
+ * },
19
+ * ) => import('../../types').ConfigType[TKey] | Promise<import('../../types').ConfigType[TKey]>} fn
20
+ */
21
+
22
+ /**
23
+ * @template {keyof import('../../types').ConfigType} TKey
24
+ * @template {Exclude<keyof import('../../types').ConfigType, TKey>[]} TDeps
25
+ * @param {ComputedPropertyDeclaration<TKey, TDeps>} declaration
26
+ */
27
+ function defineComputedProperty(declaration) {
28
+ return declaration;
29
+ }
30
+
31
+ const COMPUTED_PROPERTIES = [
32
+ defineComputedProperty({
33
+ key: 'cameraModes',
34
+ deps: ['enableVideoRecording'],
35
+ fn: ({ cameraModes, enableVideoRecording }) => {
36
+ if (enableVideoRecording === null) {
37
+ return cameraModes;
38
+ }
39
+ let cameraModesCsv = deserializeCsv(cameraModes);
40
+ if (enableVideoRecording && !cameraModesCsv.includes('video')) {
41
+ cameraModesCsv = cameraModesCsv.concat('video');
42
+ } else if (!enableVideoRecording) {
43
+ cameraModesCsv = cameraModesCsv.filter((mode) => mode !== 'video');
44
+ }
45
+ return serializeCsv(cameraModesCsv);
46
+ },
47
+ }),
48
+ defineComputedProperty({
49
+ key: 'cameraModes',
50
+ deps: ['defaultCameraMode'],
51
+ fn: ({ cameraModes, defaultCameraMode }) => {
52
+ if (defaultCameraMode === null) {
53
+ return cameraModes;
54
+ }
55
+ let cameraModesCsv = deserializeCsv(cameraModes);
56
+ cameraModesCsv = cameraModesCsv.sort((a, b) => {
57
+ if (a === defaultCameraMode) return -1;
58
+ if (b === defaultCameraMode) return 1;
59
+ return 0;
60
+ });
61
+ return serializeCsv(cameraModesCsv);
62
+ },
63
+ }),
64
+ defineComputedProperty({
65
+ key: 'cdnCname',
66
+ deps: ['pubkey', 'cdnCnamePrefixed'],
67
+ fn: ({ pubkey, cdnCname, cdnCnamePrefixed }) => {
68
+ if (cdnCname !== DEFAULT_CDN_CNAME) {
69
+ return cdnCname;
70
+ }
71
+ return getPrefixedCdnBaseAsync(pubkey, cdnCnamePrefixed);
72
+ },
73
+ }),
74
+ ];
2
75
 
3
76
  /**
4
77
  * @template {keyof import('../../types').ConfigType} T
5
78
  * @param {{
6
79
  * key: T;
7
- * value: import('../../types').ConfigType[T];
8
- * setValue: (key: T, value: import('../../types').ConfigType[T]) => void;
9
- * getValue: (key: T) => import('../../types').ConfigType[T];
80
+ * setValue: <TSetValue extends keyof import('../../types').ConfigType>(
81
+ * key: TSetValue,
82
+ * value: import('../../types').ConfigType[TSetValue],
83
+ * ) => void;
84
+ * getValue: <TGetValue extends keyof import('../../types').ConfigType>(
85
+ * key: TGetValue,
86
+ * ) => import('../../types').ConfigType[TGetValue];
10
87
  * }} options
11
88
  */
12
- export const runSideEffects = ({ key, value, setValue, getValue }) => {
13
- if (key === 'enableVideoRecording' && value !== null) {
14
- let cameraModes = deserializeCsv(getValue('cameraModes'));
15
- if (value && !cameraModes.includes('video')) {
16
- cameraModes = cameraModes.concat('video');
17
- } else if (!value) {
18
- cameraModes = cameraModes.filter((mode) => mode !== 'video');
89
+ export const runSideEffects = ({ key, setValue, getValue }) => {
90
+ for (const computed of COMPUTED_PROPERTIES) {
91
+ if (computed.deps.includes(key)) {
92
+ const args = {
93
+ [computed.key]: getValue(computed.key),
94
+ ...computed.deps.reduce(
95
+ (acc, dep) => ({
96
+ ...acc,
97
+ [dep]: getValue(dep),
98
+ }),
99
+ /**
100
+ * @type {Record<typeof computed.key, import('../../types').ConfigType[typeof computed.key]> & {
101
+ * [K in (typeof computed.deps)[number]]: import('../../types').ConfigType[K];
102
+ * }}
103
+ */ ({}),
104
+ ),
105
+ };
106
+ const result = computed.fn(args);
107
+ if (result instanceof Promise) {
108
+ const prevValue = getValue(computed.key);
109
+ result
110
+ .then((resolvedValue) => {
111
+ const currentValue = getValue(computed.key);
112
+ if (currentValue === prevValue) {
113
+ setValue(computed.key, resolvedValue);
114
+ }
115
+ })
116
+ .catch((error) => {
117
+ console.error(`Failed to compute value for "${computed.key}"`, error);
118
+ });
119
+ } else {
120
+ setValue(computed.key, result);
121
+ }
19
122
  }
20
- setValue('cameraModes', serializeCsv(cameraModes));
21
- }
22
-
23
- if (key === 'defaultCameraMode' && value !== null) {
24
- let cameraModes = deserializeCsv(getValue('cameraModes'));
25
- cameraModes = cameraModes.sort((a, b) => {
26
- if (a === value) return -1;
27
- if (b === value) return 1;
28
- return 0;
29
- });
30
- setValue('cameraModes', serializeCsv(cameraModes));
31
123
  }
32
124
  };
@@ -16,7 +16,7 @@ export class DropArea extends UploaderBlock {
16
16
  '*collectionState': import("../../index.js").OutputCollectionState | null;
17
17
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
18
18
  '*uploadTrigger': Set<string>;
19
- '*secureUploadsManager': import("../../abstract/managers/SecureUploadsManager.js").SecureUploadsManager | null;
19
+ '*secureUploadsManager': import("../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
20
20
  '*currentActivity': null;
21
21
  '*currentActivityParams': {};
22
22
  '*history': never[];
@@ -14,6 +14,7 @@ export class ExternalSource extends UploaderBlock {
14
14
  showSelectionStatus: boolean;
15
15
  counterText: string;
16
16
  doneBtnTextClass: string;
17
+ toolbarVisible: boolean;
17
18
  onDone: () => void;
18
19
  onCancel: () => void;
19
20
  onSelectAll: () => void;
@@ -25,7 +26,7 @@ export class ExternalSource extends UploaderBlock {
25
26
  '*collectionState': import("../../index.js").OutputCollectionState | null;
26
27
  '*groupInfo': import("@uploadcare/upload-client").UploadcareGroup | null;
27
28
  '*uploadTrigger': Set<string>;
28
- '*secureUploadsManager': import("../../abstract/managers/SecureUploadsManager.js").SecureUploadsManager | null;
29
+ '*secureUploadsManager': import("../../abstract/SecureUploadsManager.js").SecureUploadsManager | null;
29
30
  '*currentActivity': null;
30
31
  '*currentActivityParams': {};
31
32
  '*history': never[];
@@ -39,6 +40,11 @@ export class ExternalSource extends UploaderBlock {
39
40
  * @param {NonNullable<import('./types.js').InputMessageMap['selected-files-change']['selectedFiles']>[number]} selectedFile
40
41
  */
41
42
  private extractUrlFromSelectedFile;
43
+ /**
44
+ * @private
45
+ * @param {import('./types.js').InputMessageMap['toolbar-state-change']} message
46
+ */
47
+ private handleToolbarStateChange;
42
48
  /**
43
49
  * @private
44
50
  * @param {import('./types.js').InputMessageMap['selected-files-change']} message
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalSource.d.ts","sourceRoot":"","sources":["ExternalSource.js"],"names":[],"mappings":"AAWA,+DAA+D;AAE/D;IAEE,yBAAiD;IAK/C;;;QAKE,6FAA6F;sBAAlF,OAAO,YAAY,EAAE,eAAe,CAAC,uBAAuB,CAAC,CAAC,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;MAkC1F;IAGH,6BAA6B;IAC7B,sBADW,cAAc,CAOxB;IAgDD;;;OAGG;IACH,mCAcC;IAED;;;OAGG;IACH,kCAsBC;IAED,eAAe;IACf,yBAIC;IAED,eAAe;IACf,mBAKC;IAED;;;OAGG;IACH,sBAKC;IAED,eAAe;IACf,kBAKC;IAED,eAAe;IACf,kBAeC;IAED,eAAe;IACf,oBA6BC;IALC,eAAe;IACf,uBAA6D;IAM/D,eAAe;IACf,sBAMC;IAED,eAAe;IACf,6BASC;CACF;;;;6BAlQa;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE;8BAPd,iCAAiC"}
1
+ {"version":3,"file":"ExternalSource.d.ts","sourceRoot":"","sources":["ExternalSource.js"],"names":[],"mappings":"AAkBA,+DAA+D;AAE/D;IAEE,yBAAiD;IAK/C;;;QAKE,6FAA6F;sBAAlF,OAAO,YAAY,EAAE,eAAe,CAAC,uBAAuB,CAAC,CAAC,eAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;MAmC1F;IAGH,6BAA6B;IAC7B,sBADW,cAAc,CAOxB;IAgDD;;;OAGG;IACH,mCAcC;IAED;;;OAGG;IACH,iCAIC;IAED;;;OAGG;IACH,kCAsBC;IAED,eAAe;IACf,yBAIC;IAED,eAAe;IACf,mBAKC;IAED;;;OAGG;IACH,sBAKC;IAED,eAAe;IACf,kBAKC;IAED,eAAe;IACf,kBAkBC;IAED,eAAe;IACf,oBA8BC;IANC,eAAe;IACf,uBAA6D;IAO/D,eAAe;IACf,sBAMC;IAED,eAAe;IACf,6BASC;CACF;;;;6BAjRa;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE;8BAdd,iCAAiC"}
@@ -8,6 +8,13 @@ import { wildcardRegexp } from '../../utils/wildcardRegexp.js';
8
8
  import { buildThemeDefinition } from './buildThemeDefinition.js';
9
9
  import { MessageBridge } from './MessageBridge.js';
10
10
  import { queryString } from './query-string.js';
11
+ import { getTopLevelOrigin } from '../../utils/get-top-level-origin.js';
12
+ import { ExternalUploadSource } from '../utils/UploadSource.js';
13
+
14
+ /** @type {Record<string, string>} */
15
+ const SOCIAL_SOURCE_MAPPING = {
16
+ [ExternalUploadSource.GDRIVE]: 'ngdrive',
17
+ };
11
18
 
12
19
  /** @typedef {{ externalSourceType: string }} ActivityParams */
13
20
 
@@ -34,6 +41,7 @@ export class ExternalSource extends UploaderBlock {
34
41
  showSelectionStatus: false,
35
42
  counterText: '',
36
43
  doneBtnTextClass: 'uc-hidden',
44
+ toolbarVisible: true,
37
45
 
38
46
  onDone: () => {
39
47
  for (const message of this.$.selectedList) {
@@ -135,6 +143,16 @@ export class ExternalSource extends UploaderBlock {
135
143
  return selectedFile.url;
136
144
  }
137
145
 
146
+ /**
147
+ * @private
148
+ * @param {import('./types.js').InputMessageMap['toolbar-state-change']} message
149
+ */
150
+ handleToolbarStateChange(message) {
151
+ this.set$({
152
+ toolbarVisible: message.isVisible,
153
+ });
154
+ }
155
+
138
156
  /**
139
157
  * @private
140
158
  * @param {import('./types.js').InputMessageMap['selected-files-change']} message
@@ -201,6 +219,7 @@ export class ExternalSource extends UploaderBlock {
201
219
  remoteUrl() {
202
220
  const { pubkey, remoteTabSessionKey, socialBaseUrl, multiple } = this.cfg;
203
221
  const { externalSourceType } = this.activityParams;
222
+ const sourceName = SOCIAL_SOURCE_MAPPING[externalSourceType] ?? externalSourceType;
204
223
  const lang = this.l10n('social-source-lang')?.split('-')?.[0] || 'en';
205
224
  const params = {
206
225
  lang,
@@ -209,8 +228,10 @@ export class ExternalSource extends UploaderBlock {
209
228
  session_key: remoteTabSessionKey,
210
229
  wait_for_theme: true,
211
230
  multiple: multiple.toString(),
231
+ origin: this.cfg.topLevelOrigin || getTopLevelOrigin(),
232
+ debug: this.cfg.debug,
212
233
  };
213
- const url = new URL(`/window4/${externalSourceType}`, socialBaseUrl);
234
+ const url = new URL(`/window4/${sourceName}`, socialBaseUrl);
214
235
  url.search = queryString(params);
215
236
  return url.toString();
216
237
  }
@@ -243,6 +264,7 @@ export class ExternalSource extends UploaderBlock {
243
264
  /** @private */
244
265
  this._messageBridge = new MessageBridge(iframe.contentWindow);
245
266
  this._messageBridge.on('selected-files-change', this.handleSelectedFilesChange.bind(this));
267
+ this._messageBridge.on('toolbar-state-change', this.handleToolbarStateChange.bind(this));
246
268
 
247
269
  this.resetSelectionStatus();
248
270
  }
@@ -282,7 +304,7 @@ ExternalSource.template = /* HTML */ `
282
304
  </uc-activity-header>
283
305
  <div class="uc-content">
284
306
  <div ref="iframeWrapper" class="uc-iframe-wrapper"></div>
285
- <div class="uc-toolbar">
307
+ <div class="uc-toolbar" set="@hidden: !toolbarVisible">
286
308
  <button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button>
287
309
  <div set="@hidden: !showSelectionStatus" class="uc-selection-status-box">
288
310
  <span>{{counterText}}</span>
@@ -1 +1 @@
1
- {"version":3,"file":"MessageBridge.d.ts","sourceRoot":"","sources":["MessageBridge.js"],"names":[],"mappings":"AAgBA;IAOE,8BAA8B;IAC9B,qBADY,MAAM,EAKjB;IAXD,0GAA0G;IAC1G,aADW,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,SAAS,EAAE,mBAAmB,CAAC,OAAO,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAC9E;IAExB,qBAAqB;IACrB,UADW,MAAM,CACR;IAST,8BAA8B;IAC9B,iBAAkB,GADN,YACO,UAejB;IAEF;;;;OAIG;IACH,GAJkD,CAAC,SAAtC,OAAQ,SAAS,EAAE,gBAAiB,QACtC,CAAC,WACD,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,QASlD;IAED,uDAAuD;IACvD,cADY,OAAO,SAAS,EAAE,aAAa,QAG1C;IAED,gBAEC;CACF"}
1
+ {"version":3,"file":"MessageBridge.d.ts","sourceRoot":"","sources":["MessageBridge.js"],"names":[],"mappings":"AAkBA;IAOE,8BAA8B;IAC9B,qBADY,MAAM,EAKjB;IAXD,0GAA0G;IAC1G,aADW,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,OAAO,SAAS,EAAE,mBAAmB,CAAC,OAAO,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAC9E;IAExB,qBAAqB;IACrB,UADW,MAAM,CACR;IAST,8BAA8B;IAC9B,iBAAkB,GADN,YACO,UAejB;IAEF;;;;OAIG;IACH,GAJkD,CAAC,SAAtC,OAAQ,SAAS,EAAE,gBAAiB,QACtC,CAAC,WACD,OAAO,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC,QASlD;IAED,uDAAuD;IACvD,cADY,OAAO,SAAS,EAAE,aAAa,QAG1C;IAED,gBAEC;CACF"}
@@ -1,5 +1,7 @@
1
+ // @ts-check
2
+
1
3
  /** @type {import('./types').InputMessageType[]} */
2
- const MESSAGE_TYPE_WHITELIST = ['selected-files-change'];
4
+ const MESSAGE_TYPE_WHITELIST = ['selected-files-change', 'toolbar-state-change'];
3
5
 
4
6
  /**
5
7
  * @param {unknown} message
@@ -24,6 +24,10 @@ export type InputMessageMap = {
24
24
  isMultipleMode: false;
25
25
  selectedFiles: [DoneSuccessResponse] | [];
26
26
  });
27
+ "toolbar-state-change": {
28
+ type: "toolbar-state-change";
29
+ isVisible: boolean;
30
+ };
27
31
  };
28
32
  export type InputMessageType = keyof InputMessageMap;
29
33
  export type InputMessage = InputMessageMap[InputMessageType];