@uploadcare/file-uploader 1.19.2 → 1.19.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AAyFO,+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;wCAnHqD,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
+ {"version":3,"file":"side-effects.d.ts","sourceRoot":"","sources":["side-effects.js"],"names":[],"mappings":"AA0FO,+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;wCAnHqD,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"}
@@ -5,6 +5,7 @@
5
5
  import { getPrefixedCdnBaseAsync, isPrefixedCdnBase } from '@uploadcare/cname-prefix/async';
6
6
  import { deserializeCsv, serializeCsv } from '../utils/comma-separated.js';
7
7
  import { DEFAULT_CDN_CNAME } from './initialConfig.js';
8
+ import { isPromiseLike } from '../../utils/isPromiseLike.js';
8
9
 
9
10
  /**
10
11
  * @template {keyof import('../../types').ConfigType} TKey
@@ -105,7 +106,7 @@ export const runSideEffects = ({ key, setValue, getValue }) => {
105
106
  ),
106
107
  };
107
108
  const result = computed.fn(args);
108
- if (result instanceof Promise) {
109
+ if (isPromiseLike(result)) {
109
110
  const prevValue = getValue(computed.key);
110
111
  result
111
112
  .then((resolvedValue) => {
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.2";
3
+ export const PACKAGE_VERSION: "1.19.3";
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.2';
3
+ export const PACKAGE_VERSION = '1.19.3';
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.2";
553
+ export const PACKAGE_VERSION: "1.19.3";
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.2`;
1073
+ export const PACKAGE_VERSION = `1.19.3`;
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.2",
3
+ "version": "1.19.3",
4
4
  "description": "Building blocks for Uploadcare products integration",
5
5
  "keywords": [
6
6
  "web components",
@@ -0,0 +1,2 @@
1
+ export function isPromiseLike(value: unknown): value is Promise<any>;
2
+ //# sourceMappingURL=isPromiseLike.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromiseLike.d.ts","sourceRoot":"","sources":["isPromiseLike.js"],"names":[],"mappings":"AAMO,qCAHI,OAAO,GACL,KAAK,gBAAW,CAO5B"}
@@ -0,0 +1,12 @@
1
+ // @ts-check
2
+
3
+ /**
4
+ * @param {unknown} value
5
+ * @returns {value is Promise}
6
+ */
7
+ export const isPromiseLike = (value) => {
8
+ return (
9
+ value instanceof Promise ||
10
+ Boolean(value && typeof value === 'object' && 'then' in value && typeof value.then === 'function')
11
+ );
12
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=isPromiseLike.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isPromiseLike.test.d.ts","sourceRoot":"","sources":["isPromiseLike.test.js"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { isPromiseLike } from './isPromiseLike';
2
+ import { expect } from '@esm-bundle/chai';
3
+
4
+ describe('isPromiseLike', () => {
5
+ it('should return true for Promise instances', () => {
6
+ expect(isPromiseLike(Promise.resolve())).to.be.true;
7
+ });
8
+
9
+ it('should return true for thenable objects', () => {
10
+ const thenable = { then: () => {} };
11
+ expect(isPromiseLike(thenable)).to.be.true;
12
+ });
13
+
14
+ it('should return false for non-thenable objects', () => {
15
+ expect(isPromiseLike({})).to.be.false;
16
+ expect(isPromiseLike(null)).to.be.false;
17
+ expect(isPromiseLike(42)).to.be.false;
18
+ expect(isPromiseLike('string')).to.be.false;
19
+ });
20
+ });