@canva/design 2.7.6-beta.1 → 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
+ }
@@ -36,19 +36,23 @@ class FakeDesignInteractionClient {
36
36
  },
37
37
  pageMetadata: [
38
38
  {
39
+ type: 'absolute',
39
40
  dimensions: {
40
41
  width: 800,
41
42
  height: 600
42
- }
43
+ },
44
+ title: 'page1'
45
+ },
46
+ {
47
+ type: 'unsupported'
43
48
  },
44
49
  {
50
+ type: 'absolute',
45
51
  dimensions: {
46
52
  width: 300,
47
53
  height: 900
48
- }
49
- },
50
- {
51
- dimensions: undefined
54
+ },
55
+ title: undefined
52
56
  }
53
57
  ],
54
58
  durationInSeconds: 30
@@ -154,6 +158,12 @@ class FakeDesignInteractionClient {
154
158
  return ()=>{};
155
159
  }
156
160
  };
161
+ this.publish = {
162
+ launch: ()=>this.delay()
163
+ };
164
+ this.bulkCreate = {
165
+ launch: ()=>this.delay()
166
+ };
157
167
  }
158
168
  }
159
169
  const fakeBounds = {
@@ -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');
@@ -24,6 +24,9 @@ _export(exports, {
24
24
  get addPage () {
25
25
  return addPage;
26
26
  },
27
+ get bulkCreate () {
28
+ return bulkCreate;
29
+ },
27
30
  get createRichtextRange () {
28
31
  return createRichtextRange;
29
32
  },
@@ -51,6 +54,9 @@ _export(exports, {
51
54
  get overlay () {
52
55
  return overlay;
53
56
  },
57
+ get publish () {
58
+ return publish;
59
+ },
54
60
  get requestExport () {
55
61
  return requestExport;
56
62
  },
@@ -83,3 +89,5 @@ const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesignMetadat
83
89
  const createRichtextRange = canva_sdk.design.v2.designInteraction.createRichtextRange;
84
90
  const editContent = canva_sdk.design.v2.designInteraction.editContent;
85
91
  const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
92
+ const publish = canva_sdk.design.v2.designInteraction.publish;
93
+ const bulkCreate = canva_sdk.design.v2.designInteraction.bulkCreate;
@@ -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';
22
+ const LATEST_VERSION = '2.8.0';
23
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
+ }
@@ -15,19 +15,23 @@ export class FakeDesignInteractionClient {
15
15
  },
16
16
  pageMetadata: [
17
17
  {
18
+ type: 'absolute',
18
19
  dimensions: {
19
20
  width: 800,
20
21
  height: 600
21
- }
22
+ },
23
+ title: 'page1'
24
+ },
25
+ {
26
+ type: 'unsupported'
22
27
  },
23
28
  {
29
+ type: 'absolute',
24
30
  dimensions: {
25
31
  width: 300,
26
32
  height: 900
27
- }
28
- },
29
- {
30
- dimensions: undefined
33
+ },
34
+ title: undefined
31
35
  }
32
36
  ],
33
37
  durationInSeconds: 30
@@ -133,6 +137,12 @@ export class FakeDesignInteractionClient {
133
137
  return ()=>{};
134
138
  }
135
139
  };
140
+ this.publish = {
141
+ launch: ()=>this.delay()
142
+ };
143
+ this.bulkCreate = {
144
+ launch: ()=>this.delay()
145
+ };
136
146
  }
137
147
  }
138
148
  const fakeBounds = {
@@ -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');
@@ -17,3 +17,5 @@ export const getDesignMetadata = canva_sdk.design.v2.designInteraction.getDesign
17
17
  export const createRichtextRange = canva_sdk.design.v2.designInteraction.createRichtextRange;
18
18
  export const editContent = canva_sdk.design.v2.designInteraction.editContent;
19
19
  export const openDesign = canva_sdk.design.v2.designInteraction.openDesign;
20
+ export const publish = canva_sdk.design.v2.designInteraction.publish;
21
+ export const bulkCreate = canva_sdk.design.v2.designInteraction.bulkCreate;
@@ -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';
1
+ export const LATEST_VERSION = '2.8.0';
2
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.1",
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 { }