@uploadcare/file-uploader 1.19.5-alpha.0 → 1.19.5

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.
@@ -36,8 +36,6 @@ export class UploaderBlock extends ActivityBlock {
36
36
  private _unobserveCollection;
37
37
  /** @private */
38
38
  private _unobserveCollectionProperties;
39
- /** @private */
40
- private destroyCtxOwner;
41
39
  /**
42
40
  * @private
43
41
  * @param {import('../types').OutputCollectionState} collectionState
@@ -1 +1 @@
1
- {"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,mCAHa,iBAAiB,CAQ7B;IAED,mCAAmC;IACnC,WADc,iBAAiB,CAM9B;IAED,4BAEC;IAED,2DAA2D;IAC3D,wBADc,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAMtD;IAsBD,eAAe;IACf,qBAkBC;IAfC,eAAe;IACf,6BAAiG;IAEjG,eAAe;IACf,uCAEC;IAWH,eAAe;IACf,wBASC;IAED;;;OAGG;IACH,qBAkBC;IAED,eAAe;IACf,0BAYQ;IAER;;;OAGG;IACH,gCAkCE;IAEF;;;OAGG;IACH,0CA6FE;IAEF,eAAe;IACf,mCAsBE;IAEF,6BAiBC;IAED,eAAe;IACf,uBAkDC;IAED;;;OAGG;IACH,kCAHW,MAAM,qEAWhB;IAED;;;OAGG;IACH,oCAHa,OAAO,CAAC,OAAO,2BAA2B,EAAE,eAAe,CAAC,CA4BxE;IAED,kEAAkE;IAClE,iBADc,OAAO,sBAAsB,EAAE,eAAe,EAAE,CAK7D;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAxd6B,oBAAoB;qCAWb,2BAA2B;kCAG9B,wBAAwB;kCADxB,wBAAwB;gCAD1B,sBAAsB;kCAGpB,wBAAwB"}
1
+ {"version":3,"file":"UploaderBlock.d.ts","sourceRoot":"","sources":["UploaderBlock.js"],"names":[],"mappings":"AAmBA;IACE,iBAAiB;IACjB,mCAAwB;IAExB,eAAe;IACf,mBAAmB;IAEnB;;;;;;;;;;;;;;MAA+B;IAE/B,eAAe;IACf,0BAOC;IA2BD;;;OAGG;IACH,mCAHa,iBAAiB,CAQ7B;IAED,mCAAmC;IACnC,WADc,iBAAiB,CAM9B;IAED,4BAEC;IAED,2DAA2D;IAC3D,wBADc,eAAe,CAAC,OAAO,iBAAiB,CAAC,CAMtD;IAkBD,eAAe;IACf,qBAkBC;IAfC,eAAe;IACf,6BAAiG;IAEjG,eAAe;IACf,uCAEC;IAWH;;;OAGG;IACH,qBAkBC;IAED,eAAe;IACf,0BAYQ;IAER;;;OAGG;IACH,gCAkCE;IAEF;;;OAGG;IACH,0CA6FE;IAEF,eAAe;IACf,mCAsBE;IAEF,6BAiBC;IAED,eAAe;IACf,uBAkDC;IAED;;;OAGG;IACH,kCAHW,MAAM,qEAWhB;IAED;;;OAGG;IACH,oCAHa,OAAO,CAAC,OAAO,2BAA2B,EAAE,eAAe,CAAC,CA4BxE;IAED,kEAAkE;IAClE,iBADc,OAAO,sBAAsB,EAAE,eAAe,EAAE,CAK7D;CACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BAxc6B,oBAAoB;qCAWb,2BAA2B;kCAG9B,wBAAwB;kCADxB,wBAAwB;gCAD1B,sBAAsB;kCAGpB,wBAAwB"}
@@ -94,9 +94,8 @@ export class UploaderBlock extends ActivityBlock {
94
94
 
95
95
  /** @protected */
96
96
  destroyCtxCallback() {
97
- if (this.isCtxOwner) {
98
- this.destroyCtxOwner();
99
- }
97
+ this._unobserveCollectionProperties?.();
98
+ this._unobserveCollection?.();
100
99
  this.uploadCollection.destroy();
101
100
  this.$['*uploadCollection'] = null;
102
101
 
@@ -106,9 +105,6 @@ export class UploaderBlock extends ActivityBlock {
106
105
  destroyCallback() {
107
106
  super.destroyCallback();
108
107
 
109
- if (this.isCtxOwner) {
110
- this.destroyCtxOwner();
111
- }
112
108
  this._flushOutputItems.cancel();
113
109
  }
114
110
 
@@ -133,18 +129,6 @@ export class UploaderBlock extends ActivityBlock {
133
129
  }
134
130
  }
135
131
 
136
- /** @private */
137
- destroyCtxOwner() {
138
- if (!this.isCtxOwner) {
139
- return;
140
- }
141
-
142
- this._unobserveCollectionProperties?.();
143
- this._unobserveCollection?.();
144
- this.$['*secureUploadsManager'] = null;
145
- this.isCtxOwner = false;
146
- }
147
-
148
132
  /**
149
133
  * @private
150
134
  * @param {import('../types').OutputCollectionState} collectionState
package/env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /** Do not edit this file manually. It's generated during build process. */
2
2
  export const PACKAGE_NAME: "blocks";
3
- export const PACKAGE_VERSION: "1.19.4";
3
+ export const PACKAGE_VERSION: "1.19.5";
4
4
  //# sourceMappingURL=env.d.ts.map
package/env.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** Do not edit this file manually. It's generated during build process. */
2
2
  export const PACKAGE_NAME = 'blocks';
3
- export const PACKAGE_VERSION = '1.19.4';
3
+ export const PACKAGE_VERSION = '1.19.5';
package/index.ssr.d.ts CHANGED
@@ -550,7 +550,7 @@ export namespace ModalEvents {
550
550
  let DESTROY: string;
551
551
  }
552
552
  export const PACKAGE_NAME: "blocks";
553
- export const PACKAGE_VERSION: "1.19.4";
553
+ export const PACKAGE_VERSION: "1.19.5";
554
554
  export const PresenceToggle: {
555
555
  new (): {};
556
556
  template: string;
package/index.ssr.js CHANGED
@@ -1070,7 +1070,7 @@ export const ModalEvents = {
1070
1070
  DESTROY: "modal:destroy",
1071
1071
  };
1072
1072
  export const PACKAGE_NAME = `blocks`;
1073
- export const PACKAGE_VERSION = `1.19.4`;
1073
+ export const PACKAGE_VERSION = `1.19.5`;
1074
1074
  export const PresenceToggle = class {
1075
1075
  static template = `<slot></slot> `;
1076
1076
  static reg = () => {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uploadcare/file-uploader",
3
- "version": "1.19.5-alpha.0",
3
+ "version": "1.19.5",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -1 +1 @@
1
- {"version":3,"file":"parseCdnUrl.d.ts","sourceRoot":"","sources":["parseCdnUrl.js"],"names":[],"mappings":"AAIO,8CADK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;SAgB3C"}
1
+ {"version":3,"file":"parseCdnUrl.d.ts","sourceRoot":"","sources":["parseCdnUrl.js"],"names":[],"mappings":"AAMO,8CADK;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;;;;SAiB3C"}
@@ -1,12 +1,15 @@
1
+ import { DEFAULT_CDN_CNAME } from '../blocks/Config/initialConfig.js';
2
+
1
3
  const uuidRegex = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i;
2
4
  const cdnUrlRegex = new RegExp(`^/?(${uuidRegex.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`, 'i');
3
5
 
4
6
  /** @param {{ url: string; cdnBase: string }} options */
5
7
  export const parseCdnUrl = ({ url, cdnBase }) => {
6
8
  const cdnBaseUrlObj = new URL(cdnBase);
9
+ const fallbackCdnBaseUrlObj = new URL(DEFAULT_CDN_CNAME);
7
10
  const urlObj = new URL(url);
8
11
 
9
- if (cdnBaseUrlObj.host !== urlObj.host) {
12
+ if (cdnBaseUrlObj.host !== urlObj.host && fallbackCdnBaseUrlObj.host !== urlObj.host) {
10
13
  return null;
11
14
  }
12
15
 
@@ -75,4 +75,17 @@ describe('parseCdnUrl', () => {
75
75
  filename: null,
76
76
  });
77
77
  });
78
+
79
+ it('should fallback to ucarecdn.com if cdnBase is not matched', () => {
80
+ expect(
81
+ parseCdnUrl({
82
+ url: 'https://ucarecdn.com/12345678-1234-5678-1234-567812345678/',
83
+ cdnBase: 'https://cdn.example.com',
84
+ }),
85
+ ).to.deep.equal({
86
+ uuid: '12345678-1234-5678-1234-567812345678',
87
+ cdnUrlModifiers: '',
88
+ filename: null,
89
+ });
90
+ });
78
91
  });