@canva/design 2.7.6-beta.2 → 2.8.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.
@@ -0,0 +1,27 @@
1
+ "use strict"
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "createFakeDesignClients", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return createFakeDesignClients;
9
+ }
10
+ });
11
+ const _synthetic_delay = require('../../utils/synthetic_delay');
12
+ const _fake_design_interaction_client = require("./fake_design_interaction_client");
13
+ const _fake_drag_and_drop_client = require("./fake_drag_and_drop_client");
14
+ const _fake_export_client = require("./fake_export_client");
15
+ function createFakeDesignClients() {
16
+ const syntheticDelay = (0, _synthetic_delay.createSyntheticDelay)(10);
17
+ const v2 = {
18
+ designInteraction: new _fake_design_interaction_client.FakeDesignInteractionClient(syntheticDelay),
19
+ dragAndDrop: new _fake_drag_and_drop_client.FakeDragAndDropClient(syntheticDelay),
20
+ export: new _fake_export_client.FakeExportClient(syntheticDelay)
21
+ };
22
+ return {
23
+ design: {
24
+ v2
25
+ }
26
+ };
27
+ }
@@ -1,8 +1,9 @@
1
- "use strict";
1
+ "use strict"
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./beta"), exports);
5
+ const _version = require("./version");
6
+ _export_star(require("./public"), exports);
6
7
  function _export_star(from, to) {
7
8
  Object.keys(from).forEach(function(k) {
8
9
  if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
@@ -16,3 +17,4 @@ function _export_star(from, to) {
16
17
  });
17
18
  return from;
18
19
  }
20
+ window.__canva__?.sdkRegistration?.registerPackageVersion('design', _version.LATEST_VERSION, 'ga');
@@ -1,18 +1,16 @@
1
- "use strict";
1
+ "use strict"
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- _export_star(require("./beta"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
5
+ Object.defineProperty(exports, "initTestEnvironment", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return initTestEnvironment;
9
+ }
10
+ });
11
+ const _create = require('../fake/create');
12
+ const _canva_sdk = require('../../utils/canva_sdk');
13
+ function initTestEnvironment() {
14
+ (0, _canva_sdk.assertIsTestCanvaSdk)();
15
+ (0, _canva_sdk.injectFakeAPIClients)((0, _create.createFakeDesignClients)());
18
16
  }
@@ -19,6 +19,6 @@ _export(exports, {
19
19
  return LATEST_VERSION_BETA;
20
20
  }
21
21
  });
22
- const LATEST_VERSION = '2.7.5';
23
- const LATEST_VERSION_BETA = '2.7.6-beta.2';
22
+ const LATEST_VERSION = '2.8.0';
23
+ const LATEST_VERSION_BETA = '2.7.6-beta.1';
24
24
  const LATEST_VERSION_ALPHA = 'NONE';
@@ -0,0 +1,17 @@
1
+ import { createSyntheticDelay } from '../../utils/synthetic_delay';
2
+ import { FakeDesignInteractionClient } from './fake_design_interaction_client';
3
+ import { FakeDragAndDropClient } from './fake_drag_and_drop_client';
4
+ import { FakeExportClient } from './fake_export_client';
5
+ export function createFakeDesignClients() {
6
+ const syntheticDelay = createSyntheticDelay(10);
7
+ const v2 = {
8
+ designInteraction: new FakeDesignInteractionClient(syntheticDelay),
9
+ dragAndDrop: new FakeDragAndDropClient(syntheticDelay),
10
+ export: new FakeExportClient(syntheticDelay)
11
+ };
12
+ return {
13
+ design: {
14
+ v2
15
+ }
16
+ };
17
+ }
@@ -1 +1,3 @@
1
- export * from './beta';
1
+ import { LATEST_VERSION } from './version';
2
+ export * from './public';
3
+ window.__canva__?.sdkRegistration?.registerPackageVersion('design', LATEST_VERSION, 'ga');
@@ -1 +1,6 @@
1
- export * from './beta';
1
+ import { createFakeDesignClients } from '../fake/create';
2
+ import { assertIsTestCanvaSdk, injectFakeAPIClients } from '../../utils/canva_sdk';
3
+ export function initTestEnvironment() {
4
+ assertIsTestCanvaSdk();
5
+ injectFakeAPIClients(createFakeDesignClients());
6
+ }
@@ -1,3 +1,3 @@
1
- export const LATEST_VERSION = '2.7.5';
2
- export const LATEST_VERSION_BETA = '2.7.6-beta.2';
1
+ export const LATEST_VERSION = '2.8.0';
2
+ export const LATEST_VERSION_BETA = '2.7.6-beta.1';
3
3
  export const LATEST_VERSION_ALPHA = 'NONE';
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@canva/design",
3
- "version": "2.7.6-beta.2",
3
+ "version": "2.8.0",
4
4
  "description": "The Canva Apps SDK design library",
5
5
  "author": "Canva Pty Ltd.",
6
6
  "license": "SEE LICENSE IN LICENSE.md FILE",
7
7
  "peerDependencies": {
8
8
  "@canva/error": "^2.0.0"
9
9
  },
10
- "main": "./lib/cjs/sdk/design/beta.js",
11
- "module": "./lib/esm/sdk/design/beta.js",
10
+ "main": "./lib/cjs/sdk/design/index.js",
11
+ "module": "./lib/esm/sdk/design/index.js",
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./beta.d.ts",
15
- "require": "./lib/cjs/sdk/design/beta.js",
16
- "import": "./lib/esm/sdk/design/beta.js"
14
+ "types": "./index.d.ts",
15
+ "require": "./lib/cjs/sdk/design/index.js",
16
+ "import": "./lib/esm/sdk/design/index.js"
17
17
  },
18
18
  "./test": {
19
- "types": "./test/beta.d.ts",
20
- "require": "./lib/cjs/sdk/design/test/beta.js",
21
- "import": "./lib/esm/sdk/design/test/beta.js"
19
+ "types": "./test/index.d.ts",
20
+ "require": "./lib/cjs/sdk/design/test/index.js",
21
+ "import": "./lib/esm/sdk/design/test/index.js"
22
22
  }
23
23
  },
24
- "typings": "./beta.d.ts"
25
- }
24
+ "typings": "./index.d.ts"
25
+ }
package/test/index.d.ts CHANGED
@@ -1 +1,11 @@
1
- export * from "./beta";
1
+ /**
2
+ * @public
3
+ * Initializes a test environment for the `@canva/design` package, enabling unit tests to mock Canva's APIs.
4
+ * @remarks
5
+ * This method should only be called once in a test environment, such as in a Jest setup file.
6
+ * @see
7
+ * https://www.canva.dev/docs/apps/testing/
8
+ */
9
+ export declare function initTestEnvironment(): void;
10
+
11
+ export { }